diff --git a/Reconstruction/eflowRec/eflowRec/PFTrackSelector.h b/Reconstruction/eflowRec/eflowRec/PFTrackSelector.h index 495255efe038c17153c5b3c279830bbc70c608b0..6a428af8ec146bd836e1fa6c320dec5c012f6bbf 100644 --- a/Reconstruction/eflowRec/eflowRec/PFTrackSelector.h +++ b/Reconstruction/eflowRec/eflowRec/PFTrackSelector.h @@ -7,12 +7,12 @@ #include "StoreGate/DataHandle.h" #include "eflowRec/eflowRecTrack.h" +#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" #include "Particle/TrackParticleContainer.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODMuon/MuonContainer.h" class eflowTrackExtrapolatorBaseAlgTool; -namespace InDet { class IInDetTrackSelectionTool; } class PFTrackSelector : public AthAlgorithm { diff --git a/Reconstruction/eflowRec/eflowRec/eflowBuilder.h b/Reconstruction/eflowRec/eflowRec/eflowBuilder.h deleted file mode 100644 index 0dac11d1bfbddd8d0ada565eea76479cc2de5900..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowBuilder.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWREC_EFLOWBUILDER_H -#define EFLOWREC_EFLOWBUILDER_H -/******************************************************************** - -NAME: eflowBuilder.h -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: D.R.Tovey -CREATED: 10th November, 2001 - -********************************************************************/ - - -#include "AthenaBaseComps/AthAlgorithm.h" - -class StoreGateSvc; - -class eflowBuilder : public AthAlgorithm -{ - - public: - - // contructor - eflowBuilder(const std::string& name, ISvcLocator* pSvcLocator); - - ~eflowBuilder(); - // Gaudi algorithm hooks - - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - - private: - - std::string m_eflowPreparationAlgName; - std::string m_eflowObjectBuilderAlgName; - std::string m_eflowQuantitiesAlgName; - - // Pointers to the corresponding sub-algorithms: - AthAlgorithm* m_eflowPreparationAlg; // Build calo objects - AthAlgorithm* m_eflowObjectBuilderAlg; // Build eflow objects - AthAlgorithm* m_eflowQuantitiesAlg; // Calculate eflow, pTmiss - -}; -#endif diff --git a/Reconstruction/eflowRec/eflowRec/eflowCaloObjectBuilder.h b/Reconstruction/eflowRec/eflowRec/eflowCaloObjectBuilder.h deleted file mode 100644 index 347f17dc01533f12adfe9f7ce002d36768cd0cc0..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowCaloObjectBuilder.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWREC_EFLOWOBJECTBUILDER_TOOLS_H -#define EFLOWREC_EFLOWOBJECTBUILDER_TOOLS_H - -/******************************************************************** - -NAME: eflowCaloObjectBuilder.h -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: M.Hodgkinson -CREATED: 24th January, 2005 - -********************************************************************/ - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -class eflowISubtractionAlgTool; -class StoreGateSvc; - -class eflowCaloObjectBuilder : public AthAlgorithm { - - public: - - eflowCaloObjectBuilder(const std::string& name, ISvcLocator* pSvcLocator); - ~eflowCaloObjectBuilder(); - - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - - private: - void printTools(); - - //Name of eflow cluster Container to write out: - std::string m_eflowClustersOutputName; - - // Name of eflow calo object Container to read in: - std::string m_eflowCaloObjectsName; - // Name of rec track object Container to read in: - std::string m_eflowRecTracksName; - // Name of rec cluster object Container to read in: - std::string m_eflowRecClustersName; - - StoreGateSvc* m_storeGate; - - ToolHandleArray< eflowISubtractionAlgTool > m_tools; - -}; -#endif diff --git a/Reconstruction/eflowRec/eflowRec/eflowCellLevelSubtractionTool.h b/Reconstruction/eflowRec/eflowRec/eflowCellLevelSubtractionTool.h deleted file mode 100644 index ab627b1af7dd5bc70afd4c214ace925e093941c0..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowCellLevelSubtractionTool.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWREC_EFLOWCELLLEVELSUBTRACTIONTOOL_H -#define EFLOWREC_EFLOWCELLLEVELSUBTRACTIONTOOL_H - -/******************************************************************** - -NAME: eflowFlowCellLevelSubtractionTool.h -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: M.Hodgkinson -CREATED: 25th January, 2005 - -********************************************************************/ - -#include "AthenaBaseComps/AthAlgTool.h" -#include "eflowRec/eflowISubtractionAlgTool.h" -#include "GaudiKernel/ToolHandle.h" - -#include "eflowRec/eflowCellList.h" -#include "eflowRec/eflowLayerIntegrator.h" -#include "eflowRec/eflowEEtaBinnedParameters.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODTracking/TrackParticle.h" - -#include <vector> -#include <cassert> - -class eflowCaloObjectContainer; -class eflowRecTrackContainer; -class eflowRecClusterContainer; -class IEFlowCellEOverPTool; -class PFTrackClusterMatchingTool; -class eflowRecTrack; - -static const InterfaceID IID_eflowCellLevelSubtractionTool("eflowCellLevelSubtractionTool", 1, 0); - -class eflowCellLevelSubtractionTool : virtual public eflowISubtractionAlgTool, public AthAlgTool { -public: - - eflowCellLevelSubtractionTool(const std::string& type,const std::string& name,const IInterface* parent); - - ~eflowCellLevelSubtractionTool(); - - static const InterfaceID& interfaceID(); - - StatusCode initialize(); - void execute(eflowCaloObjectContainer* theEflowCaloObjectContainer, eflowRecTrackContainer* recTrackContainer, eflowRecClusterContainer* recClusterContainer); - StatusCode finalize(); - - private: - - void calculateRadialEnergyProfiles(); - void calculateAverageEnergyDensity(); - void performSubtraction(); - bool runInGoldenMode() { return ((m_goldenModeString == "golden1") || (m_goldenModeString == "golden2")); } - bool isEOverPFail(double expectedEnergy, double sigma, double clusterEnergy, bool consistencySigmaCut, bool useGoldenMode); - bool canAnnihilated(double expectedEnergy, double sigma, double clusterEnergy); - - int matchAndCreateEflowCaloObj(int n); - std::string printTrack(const xAOD::TrackParticle* track); - std::string printCluster(const xAOD::CaloCluster* cluster); - void printAllClusters(eflowRecClusterContainer* recClusterContainer); - - private: - - eflowCaloObjectContainer* m_eflowCaloObjectContainer; - eflowRecTrackContainer* m_eflowTrackContainer; - eflowRecClusterContainer* m_eflowClusterContainer; - - ToolHandle<PFTrackClusterMatchingTool> m_matchingTool; - /* Matching tools for calculating the pull */ - ToolHandle<PFTrackClusterMatchingTool> m_matchingToolForPull_015; - ToolHandle<PFTrackClusterMatchingTool> m_matchingToolForPull_02; - - /* Tools for "shower simulation" */ - std::unique_ptr<eflowEEtaBinnedParameters> m_binnedParameters; - std::unique_ptr<eflowLayerIntegrator> m_integrator; - ToolHandle<IEFlowCellEOverPTool> m_theEOverPTool; - - //double m_rCell; - - double m_subtractionSigmaCut; - double m_consistencySigmaCut; - - //flag if we want to caluclate EoVerP from single particles we dont do eflow, so clusters are original unmodified ones. - bool m_calcEOverP; - - // string flag to configure for running in golden e/p match mode - std::string m_goldenModeString; - - // Number of clusters to match - int m_nMatchesInCellLevelSubtraction; - - /** Toggle whether to use updated 2015 charged shower subtraction, which disables the shower subtraction in high calorimeter energy density regions */ - bool m_useUpdated2015ChargedShowerSubtraction; - -}; - -inline const InterfaceID& eflowCellLevelSubtractionTool::interfaceID() -{ - return IID_eflowCellLevelSubtractionTool; -} - -#endif // not EFLOWREC_EFLOWCELLLEVELSUBTRACTIONTOOL_H diff --git a/Reconstruction/eflowRec/eflowRec/eflowClusterCollectionTool.h b/Reconstruction/eflowRec/eflowRec/eflowClusterCollectionTool.h deleted file mode 100644 index 3d6d75ab69b400da8fedee4dcca662f13623083f..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowClusterCollectionTool.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWCLUSTERCOLLECTIONTOOL_H -#define EFLOWCLUSTERCOLLECTIONTOOL_H - -/******************************************************************** - -NAME: eflowClusterCollectionTool.h - split off from eflowLCCalibTool -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: M.Hodgkinson -CREATED: May 2014 - -********************************************************************/ - -#include "GaudiKernel/ToolHandle.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "eflowRec/IEFlowClusterCollectionTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -class eflowRecClusterContainer; - -class eflowClusterCollectionTool : virtual public IEFlowClusterCollectionTool, public AthAlgTool { - - public: - - eflowClusterCollectionTool(const std::string& type,const std::string& name,const IInterface* parent); - - ~eflowClusterCollectionTool() {}; - - static const InterfaceID& interfaceID(); - - StatusCode initialize(); - std::unique_ptr<xAOD::CaloClusterContainer> execute(eflowCaloObjectContainer* theEflowCaloObjectContainer, bool useNonModifiedClusters); - std::unique_ptr<eflowRecClusterContainer> retrieve(eflowCaloObjectContainer* theEflowCaloObjectContainer, bool useNonModifiedClusters); - StatusCode finalize(); - -}; -#endif - diff --git a/Reconstruction/eflowRec/eflowRec/eflowLCCalibTool.h b/Reconstruction/eflowRec/eflowRec/eflowLCCalibTool.h deleted file mode 100644 index 3d50792f99dac95b16077b92ce765bee7648eddb..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowLCCalibTool.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWLCCALIBTOOL_H -#define EFLOWLCCALIBTOOL_H - -/******************************************************************** - -NAME: eflowLCCalibTool.h -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: T. Velz, M.Hodgkinson -CREATED: Jan 2014 - -********************************************************************/ - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "CaloRec/CaloClusterCollectionProcessor.h" -#include "eflowRec/eflowBaseAlgTool.h" -#include "eflowRec/IEFlowClusterCollectionTool.h" - -#include <cassert> - -class eflowCaloObjectContainer; -class eflowRecCluster; - -static const InterfaceID IID_eflowLCCalibTool("eflowLCCalibTool", 1, 0); - -class eflowLCCalibTool : virtual public eflowBaseAlgTool, public AthAlgTool { - - public: - - eflowLCCalibTool(const std::string& type,const std::string& name,const IInterface* parent); - - ~eflowLCCalibTool() {} - - static const InterfaceID& interfaceID(); - - StatusCode initialize(); - void execute(eflowCaloObjectContainer* theEflowCaloObjectContainer); - StatusCode finalize(); - - private: - - void apply(ToolHandle<CaloClusterCollectionProcessor>& calibTool, xAOD::CaloCluster* cluster); - void applyLocal(ToolHandle<CaloClusterCollectionProcessor>& calibTool, eflowRecCluster *cluster); - void applyLocalWeight(eflowRecCluster* theEFRecCluster); - - /** Tool to put all clusters into a temporary container - then we use this to calculate moments, some of which depend on configuration of nearby clusters */ - ToolHandle<IEFlowClusterCollectionTool> m_clusterCollectionTool; - - /* Tool for applying local hadronc calibration weights to cells */ - ToolHandle<CaloClusterCollectionProcessor> m_clusterLocalCalibTool; - - /* Tool to deal with out of cluster corrections */ - ToolHandle<CaloClusterCollectionProcessor> m_clusterLocalCalibOOCCTool; - - /* Tool to do Pi0 corrections */ - ToolHandle<CaloClusterCollectionProcessor> m_clusterLocalCalibOOCCPi0Tool; - - /* Tool for correcting clusters at cell level for dead materia */ - ToolHandle<CaloClusterCollectionProcessor> m_clusterLocalCalibDMTool; - - bool m_useLocalWeight; - -}; - -inline const InterfaceID& eflowLCCalibTool::interfaceID() -{ - return IID_eflowLCCalibTool; -} - -#endif diff --git a/Reconstruction/eflowRec/eflowRec/eflowMomentCalculatorTool.h b/Reconstruction/eflowRec/eflowRec/eflowMomentCalculatorTool.h deleted file mode 100644 index 755fb5d1c0e4ed6407e50fdd2735e3f9d231d4c4..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowMomentCalculatorTool.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWMOMENTCALCULATORTOOL_H -#define EFLOWMOMENTCALCULATORTOOL_H - -/******************************************************************** - -NAME: eflowMomentCalculatorTool - split from eflowLCCalibTool -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: M.Hodgkinson -CREATED: May 2014 - -********************************************************************/ - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "CaloRec/CaloClusterCollectionProcessor.h" -#include "eflowRec/eflowBaseAlgTool.h" -#include "eflowRec/IEFlowClusterCollectionTool.h" - -#include <cassert> - -class eflowCaloObjectContainer; - -static const InterfaceID IID_eflowMomentCalculatorTool("eflowMomentCalculatorTool", 1, 0); - -class eflowMomentCalculatorTool : virtual public eflowBaseAlgTool, public AthAlgTool { - - public: - - eflowMomentCalculatorTool(const std::string& type,const std::string& name,const IInterface* parent); - - ~eflowMomentCalculatorTool() {} - - static const InterfaceID& interfaceID(); - - StatusCode initialize(); - void execute(eflowCaloObjectContainer* theEflowCaloObjectContainer); - StatusCode finalize(); - - private: - - /** Tool to put all clusters into a temporary container - then we use this to calculate moments, some of which depend on configuration of nearby clusters */ - ToolHandle<IEFlowClusterCollectionTool> m_clusterCollectionTool; - - /* Tool to calculate cluster moments */ - ToolHandle<CaloClusterCollectionProcessor> m_clusterMomentsMaker; - - /** Bool to toggle whether we are in LC mode - false by default */ - bool m_LCMode; - -}; - -inline const InterfaceID& eflowMomentCalculatorTool::interfaceID() -{ - return IID_eflowMomentCalculatorTool; -} - -#endif diff --git a/Reconstruction/eflowRec/eflowRec/eflowObjectBuilder.h b/Reconstruction/eflowRec/eflowRec/eflowObjectBuilder.h deleted file mode 100644 index d4eec598913b74af44d16d705b3c8bfaaed56ec8..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowObjectBuilder.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/* - * eflowObjectBuilder.h - * - * Created on: Mar 2, 2015 - * Author: zhangrui - */ - -#ifndef EFLOWOBJECTBUILDER_H_ -#define EFLOWOBJECTBUILDER_H_ - - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -#include <cassert> - -class eflowBaseAlgTool; -class StoreGateSvc; - -class eflowObjectBuilder : public AthAlgorithm { - - public: - - eflowObjectBuilder(const std::string& name, ISvcLocator* pSvcLocator); - ~eflowObjectBuilder(); - - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - - private: - void printTools(); - - //Name of eflow cluster Container to write out: - std::string m_eflowClustersOutputName; - - // Name of eflow calo object Container to read in: - std::string m_eflowCaloObjectsName; - - StoreGateSvc* m_storeGate; - - ToolHandleArray< eflowBaseAlgTool > m_tools; - -}; - -#endif /* EFLOWOBJECTBUILDER_H_ */ diff --git a/Reconstruction/eflowRec/eflowRec/eflowObjectCreatorTool.h b/Reconstruction/eflowRec/eflowRec/eflowObjectCreatorTool.h deleted file mode 100644 index 37250a24b1ee8714622a2ee9f38e8bba26927a08..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowObjectCreatorTool.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWOBJECTCREATORTOOL_H -#define EFLOWOBJECTCREATORTOOL_H - -/******************************************************************** - -NAME: eflowObjectCreatorTool.h -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: M.Hodgkinson (based on eflowObjectBuilder class written by D.Tovey) -CREATED: 15th August, 2005 - -********************************************************************/ - -#include "AthenaBaseComps/AthAlgTool.h" -#include "eflowRec/eflowBaseAlgTool.h" -#include "GaudiKernel/ToolHandle.h" - -#include "AthLinks/ElementLink.h" -#include "xAODCaloEvent/CaloCluster.h" - -#include "TrackVertexAssociationTool/ITrackVertexAssociationTool.h" - -#include "xAODTracking/VertexContainer.h" - -#include "xAODPFlow/PFO.h" -#include "xAODPFlow/PFOContainer.h" - -#include <cassert> - -class eflowRecTrack; -class eflowRecCluster; -class eflowCaloObject; -class eflowCaloObjectContainer; - -static const InterfaceID IID_eflowObjectCreatorTool("eflowObjectCreatorTool", 1, 0); - -class eflowObjectCreatorTool : virtual public eflowBaseAlgTool, public AthAlgTool { - - public: - - eflowObjectCreatorTool(const std::string& type,const std::string& name,const IInterface* parent); - - ~eflowObjectCreatorTool() {}; - - static const InterfaceID& interfaceID(); - - StatusCode initialize(); - StatusCode execute(eflowCaloObject* energyFlowCaloObject); - void execute(eflowCaloObjectContainer* theEflowCaloObjectContainer); - StatusCode finalize(); - - private: - StatusCode setupPFOContainers(); - void createChargedEflowObjects(eflowCaloObject* energyFlowCaloObject, bool addClusters = false); - void createChargedEflowObject(eflowRecTrack* efRecTrack, bool addClusters = false); - void createNeutralEflowObjects(eflowCaloObject* energyFlowCaloObject); - - /** Function to add links to the vertex to which a charged PFO is matched (using the tracking CP loose vertex association tool) */ - void addVertexLinksToChargedEflowObjects(const xAOD::VertexContainer* theVertexContainer); - - /** Function to add cluster moments onto PFO */ - void addMoment(xAOD::CaloCluster::MomentType momentType, xAOD::PFODetails::PFOAttributes pfoAttribute, const xAOD::CaloCluster* theCluster, xAOD::PFO* thePFO); - - /* Name of PFO container to write out: */ - std::string m_PFOOutputName; - - xAOD::PFOContainer* m_chargedPFOContainer; - xAOD::PFOContainer* m_neutralPFOContainer; - xAOD::PFOContainer* m_neutralPFOContainer_nonModified; - - bool m_eOverPMode; - - /* String flag to configure for running in golden e/p match mode */ - std::string m_goldenModeString; - - /* Bool to toggle which jetetmiss configuration we are in - EM cluster input or LC cluster input */ - bool m_LCMode; - - /* ToolHandle to tracking CP loose vertex selection tool */ - ToolHandle<CP::ITrackVertexAssociationTool> m_trackVertexAssociationTool; - - /* String to specify name of VertexContainer to retrieve */ - std::string m_vertexContainerName; - - /* Bool to toggle AOD reduction task force cluster moment list */ - bool m_useAODReductionMomentList; - -}; - -inline const InterfaceID& eflowObjectCreatorTool::interfaceID() { return IID_eflowObjectCreatorTool; } - -#endif diff --git a/Reconstruction/eflowRec/eflowRec/eflowPreparation.h b/Reconstruction/eflowRec/eflowRec/eflowPreparation.h deleted file mode 100644 index 93cad4a094e9fecbf616fbbe7ba3806471c32c70..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowPreparation.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWREC_EFLOWPREPARATION_H -#define EFLOWREC_EFLOWPREPARATION_H -/******************************************************************** - -NAME: eflowPreparation.h -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: D.R.Tovey -CREATED: 10th November, 2001 - -********************************************************************/ - -#include <vector> -#include <sstream> -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "Particle/TrackParticleContainer.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "xAODEgamma/Egamma.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODMuon/Muon.h" -#include "xAODMuon/MuonContainer.h" -#include "xAODTracking/TrackParticle.h" -#include "AthContainers/ConstDataVector.h" - -#include "StoreGate/DataHandle.h" - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" - -class eflowTrackExtrapolatorBaseAlgTool; -class eflowCaloObjectContainer; -class PFTrackClusterMatchingTool; - -class CaloCellContainer; -class eflowRecTrackContainer; -class eflowRecClusterContainer; - -class eflowPreparation : public AthAlgorithm { - public: - - // constructor - eflowPreparation(const std::string& name, ISvcLocator* pSvcLocator); - - ~eflowPreparation(); - - // Gaudi algorithm hooks - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - - private: - - StatusCode makeClusterContainer(); - StatusCode makeTrackContainer(); - - /** for EM mode, LC weight for cells are retrieved before doing any subtraction; they will be used after subtraction */ - void retrieveLCCalCellWeight(double energy, unsigned index, std::map<IdentifierHash, double>& cellWeights); - - bool selectTrack(const xAOD::TrackParticle* track); - - /** Put electron container and list of lepton cells into Storegate */ - StatusCode recordLeptonContainers(); - - /** select electrons to use */ - StatusCode selectElectrons(); - /** check if track belongs to an electron */ - bool isElectron(const xAOD::TrackParticle* track); - /** store the cells of the electrons */ - void storeElectronCells(const xAOD::Egamma* electron); - - /** select third chain muons to use */ - StatusCode selectMuons(); - - /** check if track belongs to an muon */ - bool isMuon(const xAOD::TrackParticle* track); - /** store the cells of the electrons */ - void storeMuonCells(const xAOD::Muon* muon); - - /** puts set of lepton cells into the lepton container */ - void storeLeptonCells(const xAOD::CaloCluster* theCluster); - - void clearContainers(); - - private: - - - /// ReadHandle for the CaloClusterContainer to be used as input */ - SG::ReadHandle<xAOD::CaloClusterContainer> m_caloClusterReadHandle; - - /// ReadHandle for the CaloClusterContainer, at LC scale, to be used as input*/ - SG::ReadHandle<xAOD::CaloClusterContainer> m_caloCalClusterReadHandle; - - /// ReadHandle for the TrackParticleContainer to be used as input */ - SG::ReadHandle<xAOD::TrackParticleContainer> m_trackReadHandle; - - /// ReadHandle for the ElectronContainer to be used as input */ - SG::ReadHandle<xAOD::ElectronContainer> m_electronReadHandle; - - /// ReadHandle for the MuonContainer to be used as input */ - SG::ReadHandle<xAOD::MuonContainer> m_muonReadHandle; - - /// WriteHandle for the eflowCaloObjectContainer to write out: */ - SG::WriteHandle<eflowCaloObjectContainer> m_eflowCaloObjectContainerWriteHandle; - - /// WriteHandle for the eflowRecTrackContainer to write out: */ - SG::WriteHandle<eflowRecTrackContainer> m_eflowRecTrackContainerWriteHandle; - - /// WriteHandle for the eflowRecClusterContainer to write out: */ - SG::WriteHandle<eflowRecClusterContainer> m_eflowRecClusterContainerWriteHandle; - - /// Handle to interface on TrackToCalo tool. */ - ToolHandle<eflowTrackExtrapolatorBaseAlgTool> m_theTrackExtrapolatorTool; - - ToolHandle<PFTrackClusterMatchingTool> m_matchingTool; - - /// Which eflow mode is in use - Tau, MET or Full */ - std::string m_eflowMode; - - /// WriteHandle for the ElectronContainer, that will be filled with electrons passing the electron ID in eflowPreparation::selectElectrons */ - SG::WriteHandle<xAOD::ElectronContainer> m_selectedElectronsWriteHandle; - - /// container of muons that we will select */ - std::unique_ptr<xAOD::MuonContainer> m_selectedMuons; - - /// WriteHandle for the CaloCellContainer, that will store calorimeter cells associated to leptons (electrons and muons) */ - SG::WriteHandle<ConstDataVector<CaloCellContainer> > m_leptonCaloCellContainerWriteHandle; - - /// bool to toggle masking out of lepton tracks */ - bool m_useLeptons; - - /// bool to toggle storage of lepton CaloCells */ - bool m_storeLeptonCells; - - /// Count the number of track-cluster matches -- for the summary in finalize() */ - unsigned int m_nMatches; - - /// New track selection tool */ - ToolHandle<InDet::IInDetTrackSelectionTool> m_selTool; - - /// Upper limit on track Pt for input tracks */ - float m_upperTrackPtCut; - -}; -#endif diff --git a/Reconstruction/eflowRec/eflowRec/eflowRecoverSplitShowersTool.h b/Reconstruction/eflowRec/eflowRec/eflowRecoverSplitShowersTool.h deleted file mode 100644 index daada2986e4610838106351f67cb0a145f5b4700..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowRecoverSplitShowersTool.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWREC_EFLOWRECOVERSPLITSHOWERSTOOL_H -#define EFLOWREC_EFLOWRECOVERSPLITSHOWERSTOOL_H - -/******************************************************************** - -NAME: eflowRecoverSplitShowersTool -PACKAGE: offline/Reconstruction/eflowRec - -AUTHOR: Thomas Velz, Mark Hodgkinson -CREATED: 16 January 2014 - -********************************************************************/ - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "eflowRec/eflowISubtractionAlgTool.h" - -#include <cassert> - -class eflowCaloObjectContainer; -class eflowRecCluster; -class eflowRecTrack; -class eflowTrackCaloPoints; -class eflowLayerIntegrator; -class eflowEEtaBinnedParameters; -class IEFlowCellEOverPTool; -class PFTrackClusterMatchingTool; -class eflowRingSubtractionManager; -class eflowRecTrackContainer; -class eflowRecClusterContainer; -class eflowCaloObject; - -static const InterfaceID IID_eflowRecoverSplitShowersTool("eflowRecoverSplitShowersTool", 1, 0); - -class eflowRecoverSplitShowersTool : virtual public eflowISubtractionAlgTool, public AthAlgTool { - - public: - - eflowRecoverSplitShowersTool(const std::string& type,const std::string& name,const IInterface* parent); - - ~eflowRecoverSplitShowersTool(); - - static const InterfaceID& interfaceID(); - - virtual StatusCode initialize(); - void execute(eflowCaloObjectContainer* theEflowCaloObjectContainer, eflowRecTrackContainer*, eflowRecClusterContainer*); - virtual StatusCode finalize(); - - private: - - void recycleTracksClusters(); - void getClustersToConsider(); - void getTracksToRecover(); - int matchAndCreateEflowCaloObj(); - void performRecovery(int const nOriginalObj); - void subtractTrackFromClusters(const eflowTrackCaloPoints& trackCalo, eflowRingSubtractionManager& ranking, eflowRecTrack* efRecTrack, std::vector<xAOD::CaloCluster*> clusterSubtractionList); - double getSumEnergy(const std::vector<xAOD::CaloCluster*>& clusters); - - void printClusterList(std::vector<xAOD::CaloCluster*>& clusters, std::string prefix); - void performSubtraction(eflowCaloObject* thisEflowCaloObject); - -private: - - eflowCaloObjectContainer* m_eflowCaloObjectContainer; - std::vector<eflowRecCluster*> m_clustersToConsider; - std::vector<eflowRecTrack*> m_tracksToRecover; - - double m_rCell; - double m_windowRms; - - /* Tool for getting e/p values and hadronic shower cell ordering principle parameters */ - ToolHandle<IEFlowCellEOverPTool> m_theEOverPTool; - - /** Track-Cluster matching tool */ - ToolHandle<PFTrackClusterMatchingTool> m_matchingTool; - - std::unique_ptr<eflowEEtaBinnedParameters> m_binnedParameters; - std::unique_ptr<eflowLayerIntegrator> m_integrator; - - double m_subtractionSigmaCut; - - bool m_recoverIsolatedTracks; - - /** Count the number of track-cluster matches -- for the summary in finalize */ - unsigned int m_nTrackClusterMatches; - - /** Toggle whether to use updated 2015 charged shower subtraction, which disables the shower subtraction in high calorimeter energy density regions */ - bool m_useUpdated2015ChargedShowerSubtraction; - -}; - -inline const InterfaceID& eflowRecoverSplitShowersTool::interfaceID() -{ - return IID_eflowRecoverSplitShowersTool; -} - -#endif diff --git a/Reconstruction/eflowRec/eflowRec/eflowVertexInformationSetter.h b/Reconstruction/eflowRec/eflowRec/eflowVertexInformationSetter.h deleted file mode 100644 index 86fe3160a2f20a0cdb508739140f83aeda0b44b3..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/eflowRec/eflowVertexInformationSetter.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EFLOWVERTEXINFORMATIONSETTER_H -#define EFLOWVERTEXINFORMATIONSETTER_H - -/* - -Class to add information to neutral EFO that is required to do a vertex correction - -Author: Mark Hodgkinson -Created: 19 April 2013 - -*/ - -//Athena -#include "AthenaBaseComps/AthAlgorithm.h" - -#include <string> - -class StoreGateSvc; - -class eflowVertexInformationSetter : public AthAlgorithm { - - public: - - eflowVertexInformationSetter(const std::string& name, ISvcLocator* pSvcLocator); - ~eflowVertexInformationSetter(); - - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - private: - - std::string m_PFOName; - - StoreGateSvc* m_storeGate; - -}; -#endif diff --git a/Reconstruction/eflowRec/python/eflowLocalHadCal.py b/Reconstruction/eflowRec/python/PFLocalHadCal.py similarity index 88% rename from Reconstruction/eflowRec/python/eflowLocalHadCal.py rename to Reconstruction/eflowRec/python/PFLocalHadCal.py index 6053c6ab495faaf2d15e3e44d008fa4fa97490ed..b5e6c2d34c288c17dff8a47260e679a0d5f62329 100644 --- a/Reconstruction/eflowRec/python/eflowLocalHadCal.py +++ b/Reconstruction/eflowRec/python/PFLocalHadCal.py @@ -4,11 +4,11 @@ from AthenaCommon.Logging import logging from AthenaCommon.JobProperties import jobproperties import traceback -class eflowLocalHadCal: +class PFLocalHadCal: - def eflowCaloClusterLocalCalib(self,name): + def PFCaloClusterLocalCalib(self,name): - mlog = logging.getLogger( 'eflowLocalHadCal::eflowCaloClusterLocalCalib' ) + mlog = logging.getLogger( 'PFLocalHadCal::PFCaloClusterLocalCalib' ) try: from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib @@ -56,7 +56,7 @@ class eflowLocalHadCal: def getLCWeightTool(self,name): - mlog = logging.getLogger( 'eflowLocalHadCal::getLCWeightTool' ) + mlog = logging.getLogger( 'PFLocalHadCal::getLCWeightTool' ) try: from CaloUtils.CaloUtilsConf import CaloLCWeightTool; @@ -100,9 +100,9 @@ class eflowLocalHadCal: return LCWeight - def eflowCaloClusterLocalCalibDM(self,name): + def PFCaloClusterLocalCalibDM(self,name): - mlog = logging.getLogger( 'eflowLocalHadCal::eflowCaloClusterLocalCalibDM' ) + mlog = logging.getLogger( 'PFLocalHadCal::PFCaloClusterLocalCalibDM' ) try: from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib @@ -123,7 +123,7 @@ class eflowLocalHadCal: def getDeadMaterialCorrectionTool(self,name): - mlog = logging.getLogger( 'eflowLocalHadCal::getDeadMaterialCorrectionTool' ) + mlog = logging.getLogger( 'PFLocalHadCal::getDeadMaterialCorrectionTool' ) try: from CaloUtils.CaloUtilsConf import CaloLCDeadMaterialTool @@ -140,9 +140,9 @@ class eflowLocalHadCal: return LCDeadMaterial - def eflowCaloClusterLocalCalibOO(self,name): + def PFCaloClusterLocalCalibOO(self,name): - mlog = logging.getLogger( 'eflowLocalHadCal::eflowCaloClusterLocalCalibOO' ) + mlog = logging.getLogger( 'PFLocalHadCal::PFCaloClusterLocalCalibOO' ) try: from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib @@ -162,9 +162,9 @@ class eflowLocalHadCal: return CalibOO - def eflowCaloClusterLocalCalibOOPi0(self,name): + def PFCaloClusterLocalCalibOOPi0(self,name): - mlog = logging.getLogger( 'eflowLocalHadCal::eflowCaloClusterLocalCalibOOPi0' ) + mlog = logging.getLogger( 'PFLocalHadCal::PFCaloClusterLocalCalibOOPi0' ) try: from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib @@ -185,7 +185,7 @@ class eflowLocalHadCal: def getOutOfClusterCorrectionTool(self,name): - mlog = logging.getLogger( 'eflowLocalHadCal::getOutOfClusterCorrectionTool' ) + mlog = logging.getLogger( 'PFLocalHadCal::getOutOfClusterCorrectionTool' ) try: from CaloUtils.CaloUtilsConf import CaloLCOutOfClusterTool @@ -203,7 +203,7 @@ class eflowLocalHadCal: def getOutOfClusterCorrectionPi0Tool(self,name): - mlog = logging.getLogger( 'eflowLocalHadCal::getOutOfClusterCorrectionPi0Tool' ) + mlog = logging.getLogger( 'PFLocalHadCal::getOutOfClusterCorrectionPi0Tool' ) try: from CaloUtils.CaloUtilsConf import CaloLCOutOfClusterTool diff --git a/Reconstruction/eflowRec/python/eflowCaloObjectBuilder.py b/Reconstruction/eflowRec/python/eflowCaloObjectBuilder.py deleted file mode 100644 index 31cb45f630c36f5c6182f30a78fd0b5eb92cd3ea..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowCaloObjectBuilder.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - - -from AthenaCommon.Logging import logging # loads logger -import traceback # to allow printout of trace back -from RecExConfig.Configured import Configured # import base class - -def setup_eflowObjectBuilderTools(Configured, nameModifier,mlog): - - if nameModifier != "EM" and nameModifier != "LC": - mlog.error("Invalid calorimeter scale was specified : should be LC or EM, but was "+nameModifier) - return False - - try: - from eflowRec.eflowRecConf import eflowCaloObjectBuilder - ObjectBuilder_Tools=eflowCaloObjectBuilder("eflowCaloObjectBuilder_"+nameModifier) - except: - mlog.error("could not import eflowRec.eflowObjectBuilderTools") - print traceback.format_exc() - return False - - Configured._eflowObjectBuilderToolsHandle = ObjectBuilder_Tools - - from eflowRec.eflowRecFlags import jobproperties - - ObjectBuilder_Tools.PrivateToolList = [] - - if jobproperties.eflowRecFlags.eflowAlgType == "CellLevel" or jobproperties.eflowRecFlags.eflowAlgType == "EOverP" : - try: - from eflowRec.eflowCellLevelSubtractionToolDefault import eflowCellLevelSubtractionToolDefault - CellLevelSubtractionTool = eflowCellLevelSubtractionToolDefault("eflowCellLevelSubtractionTool_"+nameModifier) - except: - mlog.error("could not import eflowRec.eflowCellLevelSubtractionTool") - print traceback.format_exc() - return False - - # Toggle e/p mode - if jobproperties.eflowRecFlags.eflowAlgType == "EOverP": - CellLevelSubtractionTool.CalcEOverP = True - - ObjectBuilder_Tools.PrivateToolList += [CellLevelSubtractionTool] - - if jobproperties.eflowRecFlags.useSplitShowers == True and jobproperties.eflowRecFlags.eflowAlgType != "EOverP": - if nameModifier == "EM": - try: - from eflowRec.eflowRecoverSplitShowersToolDefault import eflowRecoverSplitShowersToolDefault - RecoverSplitShowersToolDefault=eflowRecoverSplitShowersToolDefault("eflowRecoverSplitShowers_"+nameModifier) - except: - mlog.error("could not import eflowRec.eflowRecoverSplitShowersToolDefault") - print traceback.format_exc() - return False - ObjectBuilder_Tools.PrivateToolList += [RecoverSplitShowersToolDefault] - - elif nameModifier == "LC": - try: - from eflowRec.eflowRecoverSplitShowersToolDefault_LC import eflowRecoverSplitShowersToolDefault_LC - RecoverSplitShowersToolDefault_LC=eflowRecoverSplitShowersToolDefault_LC("eflowRecoverSplitShowers_"+nameModifier) - except: - mlog.error("could not import eflowRec.eflowRecoverSplitShowersToolDefault") - print traceback.format_exc() - return False - ObjectBuilder_Tools.PrivateToolList += [RecoverSplitShowersToolDefault_LC] - - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - topSequence += ObjectBuilder_Tools - - return True diff --git a/Reconstruction/eflowRec/python/eflowCaloObjectBuilderGetter.py b/Reconstruction/eflowRec/python/eflowCaloObjectBuilderGetter.py deleted file mode 100644 index 0cf87cad76047813c21efd12f84d0e03b0c92bd0..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowCaloObjectBuilderGetter.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -from RecExConfig.Configured import Configured # import base class - -class eflowCaloObjectBuilderGetter ( Configured ) : - - def configure(self): - - mlog = logging.getLogger( 'eflowCaloObjectBuilderGetter:configure :' ) - - from eflowRec.eflowCaloObjectBuilder import setup_eflowObjectBuilderTools - return setup_eflowObjectBuilderTools(self, "EM", mlog) - - def eflowObjectBuilderToolsHandle(self): - return self._eflowObjectBuilderToolsHandle - - diff --git a/Reconstruction/eflowRec/python/eflowCaloObjectBuilderGetter_LC.py b/Reconstruction/eflowRec/python/eflowCaloObjectBuilderGetter_LC.py deleted file mode 100644 index 20417f67c995e47301b8227d603e48aae84bc8b5..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowCaloObjectBuilderGetter_LC.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -from RecExConfig.Configured import Configured # import base class - -class eflowCaloObjectBuilderGetter_LC ( Configured ) : - - def configure(self): - - mlog = logging.getLogger( 'eflowCaloObjectBuilderGetter_LC:configure :' ) - - from eflowRec.eflowCaloObjectBuilder import setup_eflowObjectBuilderTools - return setup_eflowObjectBuilderTools(self, "LC", mlog) - - def eflowObjectBuilderToolsHandle(self): - return self._eflowObjectBuilderToolsHandle - - diff --git a/Reconstruction/eflowRec/python/eflowCaloSetup.py b/Reconstruction/eflowRec/python/eflowCaloSetup.py deleted file mode 100644 index efe3c995ec2994afd3e43ab40d19f32d17a8cdea..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowCaloSetup.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -import traceback # to allow printout of trace back -from RecExConfig.Configured import Configured # import base class - -def setup_eflowCaloObjectCreator(Configured, nameModifier,mlog): - - if nameModifier != "EM" and nameModifier != "LC": - mlog.error("Invalid calorimeter scale was specified : should be LC or EM, but was "+nameModifier) - return False - - try: - from eflowRec.eflowRecConf import eflowPreparation - eflowPreparationAlgorithm=eflowPreparation("eflow"+nameModifier+"CaloObjectBuilder") - except: - mlog.error("could not import eflowRec.eflowPreparation") - print traceback.format_exc() - return False - - Configured._eflowPreparationHandle = eflowPreparationAlgorithm - - try: - from eflowRec.eflowRecConf import eflowTrackCaloExtensionTool - TrackCaloExtensionTool=eflowTrackCaloExtensionTool() - except: - mlog.error("could not import eflowRec.eflowTrackCaloExtensionTool") - print traceback.format_exc() - return False - - eflowPreparationAlgorithm.TrackExtrapolatorTool = TrackCaloExtensionTool - - # sets output key of C++ algorithm equal to the python side - eflowPreparationAlgorithm.EflowCaloObjectsOutputName=Configured.outputKey() - - from eflowRec.eflowRecFlags import jobproperties - - if "EM" == nameModifier: - eflowPreparationAlgorithm.ClustersName = "CaloTopoCluster" - eflowPreparationAlgorithm.CalClustersName = "CaloCalTopoClusters" - elif "LC" == nameModifier: - eflowPreparationAlgorithm.ClustersName = "CaloCalTopoClusters" - eflowPreparationAlgorithm.CalClustersName = "" - - if True == jobproperties.eflowRecFlags.useLeptons: - eflowPreparationAlgorithm.useLeptons = True - if True == jobproperties.eflowRecFlags.storeLeptonCells: - eflowPreparationAlgorithm.storeLeptonCells = True - if "LC" == nameModifier: - eflowPreparationAlgorithm.eflowLeptonCellsName="eflowRec_leptonCellContainer_LC" - else: - eflowPreparationAlgorithm.useLeptons = False - - if "LC" == nameModifier: - eflowPreparationAlgorithm.EflowCaloObjectsOutputName="eflowCaloObjects_LC" - eflowPreparationAlgorithm.eflowElectronsName="eflowRec_selectedElectrons_LC" - - try: - from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool - TrackSelectionTool = InDet__InDetTrackSelectionTool() - except: - mlog.error("could not import InDetTrackSelectionTool.InDet__InDetTrackSelectionTool") - print traceback.format_exc() - return False - - try: - from AthenaCommon.AppMgr import ToolSvc - except: - mlog.error("could not import ToolSvc") - print traceback.format_exc() - return False - - ToolSvc += TrackSelectionTool - - TrackSelectionTool.CutLevel = "TightPrimary" - TrackSelectionTool.minPt = 500.0 - - eflowPreparationAlgorithm.TrackSelectionTool = TrackSelectionTool - - from RecExConfig.ObjKeyStore import objKeyStore - objKeyStore.addTransient(Configured.outputType(),Configured.outputKey()) - - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - topSequence += eflowPreparationAlgorithm ; - - return True diff --git a/Reconstruction/eflowRec/python/eflowCellLevelSubtractionSetup.py b/Reconstruction/eflowRec/python/eflowCellLevelSubtractionSetup.py deleted file mode 100644 index 7802fbaf7e86d0f10a6e8888fd1e723d2241908f..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowCellLevelSubtractionSetup.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from RecExConfig.Configured import Configured # import base class - -def setup_eflowCellLevelSubtraction(Configured, nameModifier, mlog): - - Configured.SubtractionSigmaCut = 1.5 - Configured.ConsistencySigmaCut = 1.0 - - if "EM" == nameModifier: - - try: - from eflowRec.eflowRecConf import eflowCellEOverPTool_mc12_JetETMiss - CellEOverPTool=eflowCellEOverPTool_mc12_JetETMiss() - except: - mlog.error("could not import eflowRec.eflowCellEOverPTool_mc12") - print traceback.format_exc() - return False - - Configured.eflowCellEOverPTool=CellEOverPTool - - elif "LC" == nameModifier: - try: - from eflowRec.eflowRecConf import eflowCellEOverPTool_mc12_LC - CellEOverPTool=eflowCellEOverPTool_mc12_LC() - except: - mlog.error("could not import eflowRec.eflowCellEOverPTool_mc12_LC") - print traceback.format_exc() - return False - - Configured.eflowCellEOverPTool=CellEOverPTool - - from eflowRec.eflowRecFlags import jobproperties - if jobproperties.eflowRecFlags.useUpdated2015ChargedShowerSubtraction == False: - Configured.useUpdated2015ChargedShowerSubtraction = False - - return True diff --git a/Reconstruction/eflowRec/python/eflowCellLevelSubtractionToolDefault.py b/Reconstruction/eflowRec/python/eflowCellLevelSubtractionToolDefault.py deleted file mode 100644 index 58d0b351dac73c9d73bb3267ca36b9213e3d95a3..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowCellLevelSubtractionToolDefault.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging -from AthenaCommon.JobProperties import jobproperties -import traceback -# import the base class -from eflowRec.eflowRecConf import eflowCellLevelSubtractionTool - -from eflowRec.eflowRecFlags import jobproperties - -class eflowCellLevelSubtractionToolDefault(eflowCellLevelSubtractionTool) : - - def __init__(self, name="eflowCellLevelSubtractionToolDefault"): - - eflowCellLevelSubtractionTool.__init__( self, name ) - - mlog = logging.getLogger( 'eflowCellLevelSubtractionToolDefault::__init__ ' ) - mlog.info("entering") - - self.SubtractionSigmaCut = 1.2 - self.ConsistencySigmaCut = 1.0 - - from eflowRec.eflowRecFlags import jobproperties - if jobproperties.eflowRecFlags.eflowAlgType == "EOverP": - self.nMatchesInCellLevelSubtraction = -1 - else: - self.nMatchesInCellLevelSubtraction = 1 - - try: - from eflowRec.eflowRecConf import PFTrackClusterMatchingTool - MatchingTool = PFTrackClusterMatchingTool("CalObjBldMatchingTool") - MatchingTool_Pull_02 = PFTrackClusterMatchingTool("MatchingTool_Pull_02") - MatchingTool_Pull_015 = PFTrackClusterMatchingTool("MatchingTool_Pull_015") - except: - mlog.error("could not import eflowRec.PFTrackClusterMatchingTool") - print traceback.format_exc() - return False - - MatchingTool_Pull_015.TrackPositionType = 'EM2EtaPhi' # str - MatchingTool_Pull_015.ClusterPositionType = 'PlainEtaPhi' # str - MatchingTool_Pull_015.DistanceType = 'EtaPhiSquareDistance' # str - MatchingTool_Pull_015.MatchCut = 0.15*0.15 # float - self.PFTrackClusterMatchingTool_015 = MatchingTool_Pull_015 - - MatchingTool_Pull_02.TrackPositionType = 'EM2EtaPhi' # str - MatchingTool_Pull_02.ClusterPositionType = 'PlainEtaPhi' # str - MatchingTool_Pull_02.DistanceType = 'EtaPhiSquareDistance' # str - MatchingTool_Pull_02.MatchCut = 0.2*0.2 # float - self.PFTrackClusterMatchingTool_02 = MatchingTool_Pull_02 - - self.PFTrackClusterMatchingTool = MatchingTool - - if jobproperties.eflowRecFlags.eflowAlgType == "EOverP": - MatchingTool.ClusterPositionType = 'PlainEtaPhi' # str - MatchingTool.DistanceType = 'EtaPhiSquareDistance' - MatchingTool.MatchCut = 0.2*0.2 # float - - - from eflowRec.eflowCellLevelSubtractionSetup import setup_eflowCellLevelSubtraction - return setup_eflowCellLevelSubtraction(self, "EM", mlog) - - if jobproperties.eflowRecFlags.useUpdated2015ChargedShowerSubtraction == False: - self.useUpdated2015ChargedShowerSubtraction = False - - - gmFlag=""# default set to "golden1" for goldenMode. In the end this should come from this flag jobproperties.eflowRecFlags.goldenModeString() - self.goldenModeString=gmFlag - print "Configuring eflowCellLevelSubtractionTool with goldenModeString: ",gmFlag - diff --git a/Reconstruction/eflowRec/python/eflowLCCalibToolDefault.py b/Reconstruction/eflowRec/python/eflowLCCalibToolDefault.py deleted file mode 100644 index 1fd010351b62a084a785400527f422d912b9eb13..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowLCCalibToolDefault.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger - -from eflowRec.eflowRecConf import eflowLCCalibTool - -class eflowLCCalibToolDefault(eflowLCCalibTool) : - - def __init__(self, name="eflowLCCalibToolDefault"): - - eflowLCCalibTool.__init__( self, name ) - - mlog = logging.getLogger( 'eflowLCCalibToolDefault::__init__ ' ) - mlog.info("entering") - - try: - from eflowRec.eflowLocalHadCal import eflowLocalHadCal - except: - mlog.error("could not import eflowRec.eflowLocalHadCal") - print traceback.format_exc() - return False - - LocalHadCal = eflowLocalHadCal() - Calib = LocalHadCal.eflowCaloClusterLocalCalib(name) - CalibOO = LocalHadCal.eflowCaloClusterLocalCalibOO(name) - CalibOOPi0 = LocalHadCal.eflowCaloClusterLocalCalibOOPi0(name) - CalibDM = LocalHadCal.eflowCaloClusterLocalCalibDM(name) - - from CaloRec.CaloTopoClusterFlags import jobproperties - if not (jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib()): - #load local hadron calibration database, if not done so by CaloRec already - from CaloRec import CaloClusterTopoCoolFolder - - self.CaloClusterLocalCalib=Calib - self.CaloClusterLocalCalibOOCC=CalibOO - self.CaloClusterLocalCalibOOCCPi0=CalibOOPi0 - self.CaloClusterLocalCalibDM=CalibDM - - try: - from eflowRec.eflowRecConf import eflowClusterCollectionTool - eflowClusterCollectionTool = eflowClusterCollectionTool("eflowClusterCollectionTool_LCCalib") - except: - mlog.error("could not import eflowRec. eflowClusterCollectionTool") - print traceback.format_exc() - return False - - self.eflowRecClusterCollectionTool = eflowClusterCollectionTool - self.UseLocalWeight = False diff --git a/Reconstruction/eflowRec/python/eflowMomentCalculatorSetup.py b/Reconstruction/eflowRec/python/eflowMomentCalculatorSetup.py deleted file mode 100644 index 9536dcf6e122a5378a8457bd96bdd373383587d1..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowMomentCalculatorSetup.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -import traceback # to allow printout of trace back -from RecExConfig.Configured import Configured # import base class - -def setup_eflowMomentCalculatorTool(Configured, nameModifier,mlog): - - if nameModifier != "EM" and nameModifier != "LC": - mlog.error("Invalid calorimeter scale was specified : should be LC or EM, but was "+nameModifier) - return False - - try: - from eflowRec.eflowRecConf import eflowClusterCollectionTool - eflowClusterCollectionTool = eflowClusterCollectionTool("eflowClusterCollectionTool_MomentCalculator_"+nameModifier) - except: - mlog.error("could not import eflowRec. eflowClusterCollectionTool") - print traceback.format_exc() - return False - - Configured.eflowRecClusterCollectionTool = eflowClusterCollectionTool diff --git a/Reconstruction/eflowRec/python/eflowMomentCalculatorToolDefault.py b/Reconstruction/eflowRec/python/eflowMomentCalculatorToolDefault.py deleted file mode 100644 index 519971ebd8f14193229e5856ce2e004cbf7f317a..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowMomentCalculatorToolDefault.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -from AthenaCommon.SystemOfUnits import deg -from AthenaCommon.Constants import INFO - -from eflowRec.eflowRecConf import eflowMomentCalculatorTool - -class eflowMomentCalculatorToolDefault(eflowMomentCalculatorTool) : - - def __init__(self, name="eflowMomentCalculatorToolDefault"): - - eflowMomentCalculatorTool.__init__( self, name ) - - mlog = logging.getLogger( 'eflowMomentCalculatorToolDefault::__init__ ' ) - mlog.info("entering") - - try: - from CaloRec.CaloRecConf import CaloClusterMomentsMaker - ClusterMomentsMaker = CaloClusterMomentsMaker() - except: - mlog.error("could not import CaloRec.CaloClusterMomentsMaker") - print traceback.format_exc() - return False - - from CaloRec.CaloTopoClusterFlags import jobproperties - - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool = CaloNoiseToolDefault() - from AthenaCommon.AppMgr import ToolSvc - ToolSvc += theCaloNoiseTool - - ClusterMomentsMaker.MaxAxisAngle = 20*deg - ClusterMomentsMaker.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute() - ClusterMomentsMaker.MinBadLArQuality = 4000 - ClusterMomentsMaker.CaloNoiseTool = theCaloNoiseTool - ClusterMomentsMaker.UsePileUpNoise = True - ClusterMomentsMaker.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() - ClusterMomentsMaker.OutputLevel = INFO - ClusterMomentsMaker.MomentsNames = [ - "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" - ,"FIRST_ENG_DENS" - ,"ENG_FRAC_EM" - ,"ENG_FRAC_MAX" - ,"ENG_FRAC_CORE" - ,"FIRST_ENG_DENS" - ,"SECOND_ENG_DENS" - ,"ISOLATION" - ,"EM_PROBABILITY" - ,"ENG_POS" - ,"ENG_BAD_CELLS" - ,"N_BAD_CELLS" - ,"BADLARQ_FRAC" - ,"AVG_LAR_Q" - ,"AVG_TILE_Q" - ,"SIGNIFICANCE" - ] - - - self.CaloClusterMomentsMaker=ClusterMomentsMaker - - from eflowRec.eflowMomentCalculatorSetup import setup_eflowMomentCalculatorTool - return setup_eflowMomentCalculatorTool(self, "LC", mlog) diff --git a/Reconstruction/eflowRec/python/eflowObjectBuilderGetter.py b/Reconstruction/eflowRec/python/eflowObjectBuilderGetter.py deleted file mode 100644 index 6d511caa196380ca49340059827b9de3b0b36c79..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowObjectBuilderGetter.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -from RecExConfig.Configured import Configured # import base class - -class eflowObjectBuilderGetter ( Configured ) : - - _outputType = "xAOD::PFOContainer" - _output = { _outputType : "chargedJetETMiss_eflowRec", _outputType : "neutralJetETMiss_eflowRec"} - - def configure(self): - - mlog = logging.getLogger( 'eflowObjectBuilderGetter:configure :' ) - mlog.info("Output="+self.outputKey() ) # prints an info message - - from eflowRec.eflowObjectBuilderSetup import setup_eflowObjectBuilder - return setup_eflowObjectBuilder(self, "EM", mlog) - - def outputKey(self): - return self._output[self._outputType] - - def outputType(self): - return self._outputType - - def eflowObjectBuilderHandle(self): - return self._eflowObjectBuilderHandle diff --git a/Reconstruction/eflowRec/python/eflowObjectBuilderGetter_LC.py b/Reconstruction/eflowRec/python/eflowObjectBuilderGetter_LC.py deleted file mode 100644 index f82a8f406a48f28c7e5f7b2d58cb1e7f72a75bcb..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowObjectBuilderGetter_LC.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -from RecExConfig.Configured import Configured # import base class - -class eflowObjectBuilderGetter_LC ( Configured ) : - - _outputType = "xAOD::PFOContainer" - _output = { _outputType : "chargedJetETMiss_LC_eflowRec", _outputType : "neutralJetETMiss_LC_eflowRec"} - - def configure(self): - - mlog = logging.getLogger( 'eflowObjectBuilderGetter_LC:configure :' ) - mlog.info("Output="+self.outputKey() ) # prints an info message - - from eflowRec.eflowObjectBuilderSetup import setup_eflowObjectBuilder - return setup_eflowObjectBuilder(self, "LC", mlog) - - def outputKey(self): - return self._output[self._outputType] - - def outputType(self): - return self._outputType - - def eflowObjectBuilderHandle(self): - return self._eflowObjectBuilderHandle diff --git a/Reconstruction/eflowRec/python/eflowObjectBuilderSetup.py b/Reconstruction/eflowRec/python/eflowObjectBuilderSetup.py deleted file mode 100644 index a8e9271f8864e639fe019dd774e1a4be05f8a9f3..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowObjectBuilderSetup.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - - -from AthenaCommon.Logging import logging # loads logger -import traceback # to allow printout of trace back -from RecExConfig.Configured import Configured # import base class - -def setup_eflowObjectBuilder(Configured, nameModifier,mlog): - print "eflowObjectBuilderSetup.py : setup_eflowObjectBuilder" - - if nameModifier != "EM" and nameModifier != "LC": - mlog.error("Invalid calorimeter scale was specified : should be LC or EM, but was "+nameModifier) - return False - - try: - from eflowRec.eflowRecConf import eflowObjectBuilder - ObjectBuilder=eflowObjectBuilder("eflowObjectBuilder_"+nameModifier) - except: - mlog.error("could not import eflowRec.eflowObjectBuilder") - print traceback.format_exc() - return False - - Configured._eflowObjectBuilderHandle = ObjectBuilder - - from eflowRec.eflowRecFlags import jobproperties - - ObjectBuilder.PrivateToolList = [] - - try: - from eflowRec.eflowMomentCalculatorToolDefault import eflowMomentCalculatorToolDefault - MomentCalculatorTool = eflowMomentCalculatorToolDefault("eflowMomentCalculatorTool_"+nameModifier) - except: - mlog.error("could not import eflowRec.eflowMomentCalculatorTool") - print traceback.format_exc() - return False - - if nameModifier == "LC": - MomentCalculatorTool.LCMode = True - - ObjectBuilder.PrivateToolList += [MomentCalculatorTool] - - if nameModifier == "EM" and not jobproperties.eflowRecFlags.CalType == "NoCal": - try: - from eflowRec.eflowLCCalibToolDefault import eflowLCCalibToolDefault - LCCalibTool = eflowLCCalibToolDefault("eflowLCCalibTool_"+nameModifier) - except: - mlog.error("could not import eflowRec.eflowLCCalibTool") - print traceback.format_exc() - return False - - ObjectBuilder.PrivateToolList += [LCCalibTool] - - try: - from eflowRec.eflowObjectCreatorToolDefault import eflowObjectCreatorToolDefault - ObjectCreatorTool=eflowObjectCreatorToolDefault("eflowObjectCreatorTool_"+nameModifier) - except: - mlog.error("could not import eflowRec.eflowObjectCreatorTool") - print traceback.format_exc() - return False - - if "LC" == nameModifier: - ObjectCreatorTool.LCMode=True - ObjectBuilder.EflowClustersOutputName="PFOClusters_JetETMiss_LC" - ObjectBuilder.EflowCaloObjectsName="eflowCaloObjects_LC" - if jobproperties.eflowRecFlags.eflowAlgType == "EOverP": - ObjectCreatorTool.PFOOutputName = 'EOverP' - ObjectCreatorTool.EOverPMode = True - else: - ObjectCreatorTool.PFOOutputName="JetETMiss_LCPFO" - - if jobproperties.eflowRecFlags.eflowAlgType == "EOverP": - ObjectCreatorTool.PFOOutputName = 'EOverP' - ObjectCreatorTool.EOverPMode = True - ObjectBuilder.EflowClustersOutputName="eflowCluster01" - - ObjectBuilder.PrivateToolList += [ObjectCreatorTool] - - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - topSequence += ObjectBuilder - - return True diff --git a/Reconstruction/eflowRec/python/eflowObjectCreatorToolDefault.py b/Reconstruction/eflowRec/python/eflowObjectCreatorToolDefault.py deleted file mode 100644 index 284d273edc10de4d6de97aaf4a98e13d4f79b8b2..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowObjectCreatorToolDefault.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging -from AthenaCommon.JobProperties import jobproperties -import traceback -# import the base class -from eflowRec.eflowRecConf import eflowObjectCreatorTool - -class eflowObjectCreatorToolDefault(eflowObjectCreatorTool) : - - def __init__(self, name="eflowObjectCreatorToolDefault"): - - eflowObjectCreatorTool.__init__( self, name ) - - mlog = logging.getLogger( 'eflowObjectCreatorToolDefault::__init__ ' ) - mlog.info("entering") - - try: - from AthenaCommon.AppMgr import ToolSvc - except: - mlog.error("could not import ToolSvc") - print traceback.format_exc() - return False - - try: - from TrackVertexAssociationTool.TrackVertexAssociationToolConf import CP__TightTrackVertexAssociationTool - PFlowTrackVertexAssociationTool = CP__TightTrackVertexAssociationTool(name="PFlowTightCPTool", dzSinTheta_cut=2.0, doPV=True) - except: - mlog.error("could not import CP__TightTrackVertexAssociationTool") - print traceback.format_exc() - return False - - ToolSvc += PFlowTrackVertexAssociationTool - - self.TrackVertexAssociationTool = PFlowTrackVertexAssociationTool - - from eflowRec.eflowRecFlags import jobproperties - gmFlag=""# default set to "golden1" for goldenMode. In the end this should come from this flag jobproperties.eflowRecFlags.goldenModeString() - self.goldenModeString=gmFlag - print "Configuring eflowObjectCreatorTool with goldenModeString: ",gmFlag - - if jobproperties.eflowRecFlags.useAODReductionClusterMomentList == True: - self.UseAODReductionMomentList = True diff --git a/Reconstruction/eflowRec/python/eflowPreparationGetter.py b/Reconstruction/eflowRec/python/eflowPreparationGetter.py deleted file mode 100644 index aea01ef299fb0f0abcde3359d3ee15f94f3f024c..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowPreparationGetter.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -from RecExConfig.Configured import Configured # import base class - -class eflowPreparationGetter ( Configured ) : # python way to define inheritance - - _outputType = "eflowCaloObjectContainer" - _output = { _outputType : "eflowCaloObjects01" } - - def configure(self): - - mlog = logging.getLogger( 'eflowPreparationGetter:configure :' ) - mlog.info("Output="+self.outputKey() ) # prints an info message - - from eflowRec.eflowCaloSetup import setup_eflowCaloObjectCreator - return setup_eflowCaloObjectCreator(self, "EM", mlog) - - def outputKey(self): - return self._output[self._outputType] - - def outputType(self): - return self._outputType - - def eflowPreparationHandle(self): - return self._eflowPreparationHandle diff --git a/Reconstruction/eflowRec/python/eflowPreparationGetter_LC.py b/Reconstruction/eflowRec/python/eflowPreparationGetter_LC.py deleted file mode 100644 index 0ada9e9708371a75f83b160fed01e74dcc01c864..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowPreparationGetter_LC.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -from RecExConfig.Configured import Configured # import base class - -class eflowPreparationGetter_LC ( Configured ) : # python way to define inheritance - - _outputType = "eflowCaloObjectContainer" - _output = { _outputType : "eflowCaloObjects_LC" } - - def configure(self): - - mlog = logging.getLogger( 'eflowPreparationGetter_LC:configure :' ) - mlog.info("Output="+self.outputKey() ) # prints an info message - - from eflowRec.eflowCaloSetup import setup_eflowCaloObjectCreator - return setup_eflowCaloObjectCreator(self, "LC", mlog) - - def outputKey(self): - return self._output[self._outputType] - - def outputType(self): - return self._outputType - - def eflowPreparationHandle(self): - return self._eflowPreparationHandle diff --git a/Reconstruction/eflowRec/python/eflowRecoverSplitShowersSetup.py b/Reconstruction/eflowRec/python/eflowRecoverSplitShowersSetup.py deleted file mode 100644 index 234349e30d196d28ef96051a4bebcc89400150ee..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowRecoverSplitShowersSetup.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -import traceback # to allow printout of trace back -from RecExConfig.Configured import Configured # import base class - -def setup_eflowRecoverSplitShowers(Configured, nameModifier,mlog): - - if nameModifier != "EM" and nameModifier != "LC": - mlog.error("Invalid calorimeter scale was specified : should be LC or EM, but was "+nameModifier) - return False - - if "EM" == nameModifier: - - try: - from eflowRec.eflowRecConf import eflowCellEOverPTool_mc12_JetETMiss - CellEOverPTool=eflowCellEOverPTool_mc12_JetETMiss() - except: - mlog.error("could not import eflowRec.eflowCellEOverPTool_mc12") - print traceback.format_exc() - return False - - Configured.eflowCellEOverPTool=CellEOverPTool - - elif "LC" == nameModifier: - try: - from eflowRec.eflowRecConf import eflowCellEOverPTool_mc12_LC - CellEOverPTool=eflowCellEOverPTool_mc12_LC() - except: - mlog.error("could not import eflowRec.eflowCellEOverPTool_mc12_LC") - print traceback.format_exc() - return False - - Configured.eflowCellEOverPTool=CellEOverPTool - - - from eflowRec.eflowRecFlags import jobproperties - - if jobproperties.eflowRecFlags.recoverIsolatedTracks == True: - Configured.RecoverIsolatedTracks = True - - if jobproperties.eflowRecFlags.useUpdated2015ChargedShowerSubtraction == False: - Configured.useUpdated2015ChargedShowerSubtraction = False - - try: - from eflowRec.eflowRecConf import PFTrackClusterMatchingTool - MatchingTool = PFTrackClusterMatchingTool() - except: - mlog.error("could not import eflowRec.PFTrackClusterMatchingTool") - print traceback.format_exc() - return False - MatchingTool.TrackPositionType = 'EM2EtaPhi' # str - MatchingTool.ClusterPositionType = 'PlainEtaPhi' # str - MatchingTool.DistanceType = 'EtaPhiSquareDistance' # str - MatchingTool.MatchCut = 0.2*0.2 # float - Configured.PFTrackClusterMatchingTool = MatchingTool - - return True diff --git a/Reconstruction/eflowRec/python/eflowRecoverSplitShowersToolDefault.py b/Reconstruction/eflowRec/python/eflowRecoverSplitShowersToolDefault.py deleted file mode 100644 index a611afb6baf4d9968c4fde28f428155a5fb86712..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowRecoverSplitShowersToolDefault.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -from AthenaCommon.JobProperties import jobproperties - -from eflowRec.eflowRecConf import eflowRecoverSplitShowersTool - -class eflowRecoverSplitShowersToolDefault ( eflowRecoverSplitShowersTool ) : # python way to define inheritance - - def __init__(self,name="eflowRecoverSplitShowersToolDefault"): - - eflowRecoverSplitShowersTool.__init__(self,name) - - mlog = logging.getLogger( 'eflowRecoverSplitShowersToolDefault::__init__ ' ) - mlog.info("entering") - - from eflowRec.eflowRecoverSplitShowersSetup import setup_eflowRecoverSplitShowers - return setup_eflowRecoverSplitShowers(self,"EM",mlog) diff --git a/Reconstruction/eflowRec/python/eflowRecoverSplitShowersToolDefault_LC.py b/Reconstruction/eflowRec/python/eflowRecoverSplitShowersToolDefault_LC.py deleted file mode 100644 index a1668de6e4264801a8656233f0c81df3034e92d4..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowRecoverSplitShowersToolDefault_LC.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging # loads logger -from AthenaCommon.JobProperties import jobproperties - -from eflowRec.eflowRecConf import eflowRecoverSplitShowersTool - -class eflowRecoverSplitShowersToolDefault_LC ( eflowRecoverSplitShowersTool ) : # python way to define inheritance - - def __init__(self,name="eflowRecoverSplitShowersToolDefault_LC"): - - eflowRecoverSplitShowersTool.__init__(self,name) - - mlog = logging.getLogger( 'eflowRecoverSplitShowersToolDefault::__init__ ' ) - mlog.info("entering") - - from eflowRec.eflowRecoverSplitShowersSetup import setup_eflowRecoverSplitShowers - return setup_eflowRecoverSplitShowers(self,"LC",mlog) diff --git a/Reconstruction/eflowRec/python/eflowSetupParticleCreator.py b/Reconstruction/eflowRec/python/eflowSetupParticleCreator.py deleted file mode 100644 index 04d067f77bcf2a76be14927f72556962617506d1..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/python/eflowSetupParticleCreator.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging -import traceback - -class eflowSetupParticleCreator: - - def setup(self): - - mlog = logging.getLogger( 'eflowSetupParticleCreator::setup' ) - - try: - from AthenaCommon.AppMgr import ToolSvc - except: - mlog.error("could not import ToolSvc") - print traceback.format_exc() - return False - - try: - from TrkExTools.AtlasExtrapolator import AtlasExtrapolator - eflowExtrapolator = AtlasExtrapolator(name = "eflowExtrapolator") - except: - mlog.error("could not import AtlasExtrapolator from TrkExTools.AtlasExtrapolator") - print traceback.format_exc() - return False - - ToolSvc+=eflowExtrapolator - - try: - from TrkTrackSummaryTool.AtlasTrackSummaryTool import AtlasTrackSummaryTool - eflowTrackSummaryTool = AtlasTrackSummaryTool(name = "eflowTrackSummaryTool") - except: - mlog.error("could not import AtlasTrackSummaryTool from TrkTrackSummaryTool.AtlasTrackSummaryTool") - print traceback.format_exc() - return False - - ToolSvc+=eflowTrackSummaryTool - - try: - from TrkParticleCreator.TrkParticleCreatorConf import Trk__TrackParticleCreatorTool - eflowParticleCreatorTool = Trk__TrackParticleCreatorTool(name = "eflowParticleCreatorTool",Extrapolator = eflowExtrapolator, TrackSummaryTool = eflowTrackSummaryTool) - except: - mlog.error("could not import Trk__TrackParticleCreatorTool from TrkParticleCreator.TrkParticleCreatorConf") - print traceback.format_exc() - return False - - - - ToolSvc += eflowParticleCreatorTool - - return eflowParticleCreatorTool diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py index 23ec2f8d586b6e7c444cd9462ad83a1ef434c029..9b0867375cbe9dc18b87c792832ed7d13d5d7c99 100644 --- a/Reconstruction/eflowRec/share/PFlowMTConfig.py +++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py @@ -159,12 +159,12 @@ PFAlgorithm.BaseToolList = [PFMomentCalculatorTool] from eflowRec.eflowRecConf import PFLCCalibTool PFLCCalibTool = PFLCCalibTool("PFLCCalibTool") -from eflowRec.eflowLocalHadCal import eflowLocalHadCal -LocalHadCal = eflowLocalHadCal() -Calib = LocalHadCal.eflowCaloClusterLocalCalib("PFLCCalibTool") -CalibOO = LocalHadCal.eflowCaloClusterLocalCalibOO("PFLCCalibTool") -CalibOOPi0 = LocalHadCal.eflowCaloClusterLocalCalibOOPi0("PFLCCalibTool") -CalibDM = LocalHadCal.eflowCaloClusterLocalCalibDM("PFLCCalibTool") +from eflowRec.PFLocalHadCal import PFLocalHadCal +LocalHadCal = PFLocalHadCal() +Calib = LocalHadCal.PFCaloClusterLocalCalib("PFLCCalibTool") +CalibOO = LocalHadCal.PFCaloClusterLocalCalibOO("PFLCCalibTool") +CalibOOPi0 = LocalHadCal.PFCaloClusterLocalCalibOOPi0("PFLCCalibTool") +CalibDM = LocalHadCal.PFCaloClusterLocalCalibDM("PFLCCalibTool") from CaloRec.CaloTopoClusterFlags import jobproperties if not (jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib()): diff --git a/Reconstruction/eflowRec/share/eflowJetMode_example_myAlgs.py b/Reconstruction/eflowRec/share/eflowJetMode_example_myAlgs.py deleted file mode 100644 index 3260f276b2c5136e30515aac0feac348087c7caf..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/share/eflowJetMode_example_myAlgs.py +++ /dev/null @@ -1,35 +0,0 @@ - -# if you want calibration hit info in your d3pd and have the right packages checked out you can uncomment the block below -#from MakeCellInfo.MakeCellInfoConf import MakeCalCellInfo -#calCellInfo = MakeCalCellInfo() -#calCellInfo.EflowObjectsName="eflowObjects_FullMode" -#topSequence+=calCellInfo - -OutputFile='tmp.d3pd.root' - -from AthenaCommon.AlgSequence import AlgSequence -theJob = AlgSequence() - -import D3PDMakerCoreComps -d3pdalg = D3PDMakerCoreComps.MakerAlg( "test", theJob, file = OutputFile, D3PDSvc = "D3PD::RootD3PDSvc" ) - -from eflowD3PDMaker.eflowD3PD import eflowD3PD -eflowD3PD(d3pdalg) - -#eflowRec -from eflowD3PDMaker.eflowD3PDObject import * -from D3PDMakerCoreComps.D3PDObject import D3PDObject -eflowD3PDObject = D3PDObject (makeeflowD3PDObject, 'eflow_') -eflowD3PDObject.defineBlock(0, 'eflow', eflowD3PDMakerConf.D3PD__eflowFillerTool)#,sgkey = "eflowObjects_FullMode") -# you need to change the mode used in mhodgkin/eflowD3PDMaker/python/eflowD3PDObject.py to use eflowObjects_FullMode - -d3pdalg += eflowD3PDObject(10) - -# if you want calibration hit info in your d3pd and have the right packages checked out you can uncomment the block below -#from calCellInfoD3PDMaker.calCellInfoD3PDObject import * -#calCellInfoD3PDObject = D3PDObject(makecalCellInfoD3PDObject,'CalCellInfo_') -#calCellInfoD3PDObject.defineBlock(0,'CallCellInfo',calCellInfoD3PDMakerConf.D3PD__calCellInfoFillerTool) -#d3pdalg += calCellInfoD3PDObject(10) - -from CaloD3PDMaker.ClusterD3PDObject import ClusterD3PDObject -d3pdalg += ClusterD3PDObject( 1 ) diff --git a/Reconstruction/eflowRec/share/eflowRec_config_MC15_JetETMiss.py b/Reconstruction/eflowRec/share/eflowRec_config_MC15_JetETMiss.py deleted file mode 100644 index 8423b170443c92c3fb4d5cadf2dd4160be70e8aa..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/share/eflowRec_config_MC15_JetETMiss.py +++ /dev/null @@ -1,24 +0,0 @@ -from eflowRec.eflowRecFlags import jobproperties - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -#Jet/MET algorithms - EM input and LC output - -from eflowRec.eflowPreparationGetter import eflowPreparationGetter -CaloObjectBuilderGetter = eflowPreparationGetter() - -from eflowRec.eflowCaloObjectBuilderGetter import eflowCaloObjectBuilderGetter -ObjectBuilderToolsGetter = eflowCaloObjectBuilderGetter() - -from eflowRec.eflowObjectBuilderGetter import eflowObjectBuilderGetter -ObjectBuilderGetter = eflowObjectBuilderGetter() - -if not jobproperties.eflowRecFlags.eflowAlgType == "EOverP": - from eflowRec.eflowRecConf import eflowVertexInformationSetter - eflowVertexInformationSetter = eflowVertexInformationSetter("eflowVertextInformationSetter_EM") - topSequence += eflowVertexInformationSetter - - from eflowRec.eflowRecConf import eflowOverlapRemoval - eflowOverlapRemoval = eflowOverlapRemoval("eflowOverlapRemoval_EM") - topSequence += eflowOverlapRemoval diff --git a/Reconstruction/eflowRec/share/eflowRec_jobOptions.py b/Reconstruction/eflowRec/share/eflowRec_jobOptions.py index 24dd3f452210b1820504daf05a52532f6f6178b5..abe527dbf3460e8f732e0397acf0becc952d394b 100644 --- a/Reconstruction/eflowRec/share/eflowRec_jobOptions.py +++ b/Reconstruction/eflowRec/share/eflowRec_jobOptions.py @@ -1,4 +1,3 @@ -#include("eflowRec/PFlowMTConfig.py") -include("eflowRec/eflowRec_config_MC15_JetETMiss.py") +include("eflowRec/PFlowMTConfig.py") from eflowRec import ScheduleCHSPFlowMods diff --git a/Reconstruction/eflowRec/share/run_ESDSerial.py b/Reconstruction/eflowRec/share/run_ESDSerial.py deleted file mode 100644 index 3d253ac9e1bf5ee0c53f013ba71054842d2d134e..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/share/run_ESDSerial.py +++ /dev/null @@ -1,58 +0,0 @@ -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput=["/data/hodgkinson/scratchFiles/mc15_13TeV.361022.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ2W.recon.ESD.e3668_s2832_r7968/ESD.08355655._001904.pool.root.1"] - -doDumpProperties=True - -from RecExConfig.RecAlgsFlags import recAlgs -recAlgs.doEFlow.set_Value_and_Lock(True) - -from RecExConfig.RecFlags import rec -rec.doEgamma.set_Value_and_Lock(False) -rec.doMuon.set_Value_and_Lock(False) - -#change some calo flags -from CaloRec.CaloRecFlags import jobproperties -jobproperties.CaloRecFlags.Enabled.set_Value_and_Lock(True) -jobproperties.CaloRecFlags.doCaloCluster.set_Value_and_Lock(True) -jobproperties.CaloRecFlags.doEmCluster.set_Value_and_Lock(False) -jobproperties.CaloRecFlags.doCaloTopoCluster.set_Value_and_Lock(True) - -#this turns off CaloCluster2xAOD -rec.doWritexAOD.set_Value_and_Lock(False) -#nothing to say on these -rec.doWriteTAG.set_Value_and_Lock(False) -rec.doTruth.set_Value_and_Lock(False) -rec.doAODCaloCells.set_Value_and_Lock(False) -rec.doTrigger.set_Value_and_Lock(False) -#Turns off xAODRingSetConfWriter -rec.doCaloRinger.set_Value_and_Lock(False) - -#disables VertexCnvAlg -from InDetRecExample.InDetJobProperties import jobproperties -jobproperties.InDetJobProperties.doxAOD.set_Value_and_Lock(False) -#Disables AllExecutedEvents -rec.doFileMetaData.set_Value_and_Lock(False) - -athenaCommonFlags.EvtMax=1 -include ("RecExCommon/RecExCommon_topOptions.py") -topSequence.CaloTopoCluster.ClustersOutputName="CaloCalTopoClusterV2" -topSequence.eflowEMCaloObjectBuilder.CalClustersName="CaloCalTopoClusterV2" -#topSequence.eflowObjectBuilder_EM.OutputLevel=DEBUG -#topSequence.eflowCaloObjectBuilder_EM.OutputLevel=DEBUG -#topSequence.eflowEMCaloObjectBuilder.OutputLevel=DEBUG -eflowObjectCreatorTool_update = topSequence.eflowObjectBuilder_EM.PrivateToolList[2] -eflowObjectCreatorTool_update.PFOOutputName="JetETMissV2" -topSequence.eflowVertextInformationSetter_EM.PFOInputName="JetETMissV2NeutralParticleFlowObjects" -topSequence.eflowOverlapRemoval_EM.PFOInputName="JetETMissV2NeutralParticleFlowObjects" - -import AthenaCommon.PropertiesManip as manip -manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissChargedParticleFlowObjects') -manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissChargedParticleFlowObjectsAux.') -manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissNeutralParticleFlowObjects') -manip.removeItemsFromList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissNeutralParticleFlowObjectsAux.') -manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissV2ChargedParticleFlowObjects') -manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissV2ChargedParticleFlowObjectsAux.') -manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOContainer#JetETMissV2NeutralParticleFlowObjects') -manip.appendItemsToList(StreamAOD,'ItemList','xAOD::PFOAuxContainer#JetETMissV2NeutralParticleFlowObjectsAux.') - -#ServiceMgr.MessageSvc.debugLimit = 1000000 diff --git a/Reconstruction/eflowRec/share/run_eflowJetMode_example.py b/Reconstruction/eflowRec/share/run_eflowJetMode_example.py deleted file mode 100644 index f74f301ab41f8f6d25798c002f4f8693fcbbbf4e..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/share/run_eflowJetMode_example.py +++ /dev/null @@ -1,83 +0,0 @@ -# example joboption for running eflowRec in jet mode -# this should run in rel: 17.2.8.9 with some eflowRec tag added -# this needs eflowJetMode_example_myAlgs.py in your run dir to run - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput=["/afs/cern.ch/user/j/jboyd/gencomm/DESDM/mc12_8TeV.147911.Pythia8_AU2CT10_jetjet_JZ1W.recon.DESDM_ALLCELLS.e1126_s1479_s1470_r3578.root"] -#/afs/cern.ch/user/j/jboyd/gencomm/DESDM/mc12_8TeV.147911.Pythia8_AU2CT10_jetjet_JZ1W.recon.DESDM_ALLCELLS.e1126_s1479_s1470_r4534.root"] -#/afs/cern.ch/user/j/jboyd/gencomm/DESDM/mc12_8TeV.147911.Pythia8_AU2CT10_jetjet_JZ1W.recon.DESDM_ALLCELLS.e1126_s1479_s1470_r4535.root"] - -doTrigger=False -doTAG=False - -#Based on r3553 - -beamType='collisions' -fastPoolMerge='False' - -from LArROD.LArRODFlags import larRODFlags -larRODFlags.doOFCPileupOptimization.set_Value_and_Lock(True) -larRODFlags.NumberOfCollisions.set_Value_and_Lock(20) -larRODFlags.UseDelta.set_Value_and_Lock(3) - -from CaloRec.CaloCellFlags import jobproperties -jobproperties.CaloCellFlags.doLArCellEmMisCalib.set_Value_and_Lock(False) - -autoConfiguration='everything' -ignoreerrors='True' - -from RecExConfig.RecFlags import rec,Rec -rec.doApplyAODFix.set_Value_and_Lock(False) -from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags -D3PDMakerFlags.TruthWriteHadrons=True -rec.doCBNT.set_Value_and_Lock(False) -#rec.doWriteESD.set_Value_and_Lock(False) -rec.doWriteAOD.set_Value_and_Lock(False) -rec.doWriteTAG.set_Value_and_Lock(False) -##rec.doJetMissingETTag.set_Value_and_Lock(True) -rec.doESD.set_Value_and_Lock(False) -rec.doTrigger=False -rec.doTruth.set_Value_and_Lock( True ) - -#Benedict uses this....but UserAlgs are ignored if we set this, so cannot do that -#rec.Commissioning.set_Value_and_Lock(True) -rec.AutoConfiguration = [ "everything" ] - -from AthenaCommon.JobProperties import jobproperties -jobproperties.Beam.energy.set_Value_and_Lock(4000*Units.GeV) -jobproperties.Beam.bunchSpacing.set_Value_and_Lock(50) -jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(20.0) - -from TriggerJobOpts.TriggerFlags import TriggerFlags -TriggerFlags.AODEDMSet="AODSLIM" - -from MuonRecExample.MuonRecFlags import muonRecFlags -muonRecFlags.writeSDOs=True - -from RecExConfig.RecAlgsFlags import recAlgs -recAlgs.doEFlow.set_Value_and_Lock(True) - -#change some more calo flags - -from CaloRec.CaloRecFlags import jobproperties -jobproperties.CaloRecFlags.Enabled.set_Value_and_Lock(True) -jobproperties.CaloRecFlags.doCaloCluster.set_Value_and_Lock(True) -jobproperties.CaloRecFlags.doCaloTopoCluster.set_Value_and_Lock(True) - -from CaloTools.CaloNoiseFlags import jobproperties -jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(5.44) #2012? -> no its 5.44 -#jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(1.45) #2011 -#jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(0.) #2010 - -from eflowRec.eflowRecFlags import jobproperties -jobproperties.eflowRecFlags.runTauMode.set_Value_and_Lock(False) -jobproperties.eflowRecFlags.useSplitShowers.set_Value_and_Lock(True) - - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.EvtMax=10 -UserAlgs = ["eflowJetMode_example_myAlgs.py"] -include("RecExCommon/RecExCommon_topOptions.py") - -import AthenaCommon.PropertiesManip as manip - diff --git a/Reconstruction/eflowRec/src/PFTrackSelector.cxx b/Reconstruction/eflowRec/src/PFTrackSelector.cxx index 04d417ac9ff43331ff92162df3648b916f38e099..8078fbb509bcdb95fa3f652effd60a392033316b 100644 --- a/Reconstruction/eflowRec/src/PFTrackSelector.cxx +++ b/Reconstruction/eflowRec/src/PFTrackSelector.cxx @@ -1,6 +1,5 @@ #include "eflowRec/eflowTrackExtrapolatorBaseAlgTool.h" #include "eflowRec/PFTrackSelector.h" -#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" #include "xAODEgamma/ElectronxAODHelpers.h" diff --git a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx index 80b6931d5fec22dac3d0c7560c6b98b06c7e7155..b9e1a7587fcb3847b9884dbd6d068326b415f20c 100644 --- a/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx +++ b/Reconstruction/eflowRec/src/components/eflowRec_entries.cxx @@ -1,20 +1,9 @@ -#include "eflowRec/eflowBuilder.h" -#include "eflowRec/eflowPreparation.h" -#include "eflowRec/eflowCaloObjectBuilder.h" -#include "eflowRec/eflowObjectBuilder.h" -#include "eflowRec/eflowCellLevelSubtractionTool.h" -#include "eflowRec/eflowRecoverSplitShowersTool.h" -#include "eflowRec/eflowLCCalibTool.h" -#include "eflowRec/eflowMomentCalculatorTool.h" -#include "eflowRec/eflowClusterCollectionTool.h" #include "eflowRec/eflowTrackCaloExtensionTool.h" #include "eflowRec/eflowTrackCaloDummyExtensionTool.h" #include "eflowRec/PFTrackClusterMatchingTool.h" #include "eflowRec/eflowCellEOverPTool_mc12_JetETMiss.h" #include "eflowRec/eflowCellEOverPTool_mc12_LC.h" -#include "eflowRec/eflowObjectCreatorTool.h" #include "eflowRec/eflowOverlapRemoval.h" -#include "eflowRec/eflowVertexInformationSetter.h" #include "eflowRec/PFLeptonSelector.h" #include "eflowRec/PFTrackSelector.h" #include "eflowRec/PFClusterSelector.h" @@ -28,12 +17,7 @@ #include "eflowRec/PFONeutralCreatorAlgorithm.h" #include "GaudiKernel/DeclareFactoryEntries.h" -DECLARE_ALGORITHM_FACTORY( eflowBuilder ) -DECLARE_ALGORITHM_FACTORY( eflowPreparation ) -DECLARE_ALGORITHM_FACTORY( eflowCaloObjectBuilder ) -DECLARE_ALGORITHM_FACTORY( eflowObjectBuilder ) DECLARE_ALGORITHM_FACTORY( eflowOverlapRemoval ) -DECLARE_ALGORITHM_FACTORY( eflowVertexInformationSetter ) DECLARE_ALGORITHM_FACTORY( PFLeptonSelector ) DECLARE_ALGORITHM_FACTORY( PFClusterSelector ) DECLARE_ALGORITHM_FACTORY( PFTrackSelector ) @@ -45,25 +29,14 @@ DECLARE_TOOL_FACTORY( PFRecoverSplitShowersTool ) DECLARE_TOOL_FACTORY( PFMomentCalculatorTool ) DECLARE_TOOL_FACTORY( PFClusterCollectionTool ) DECLARE_TOOL_FACTORY( PFLCCalibTool ) -DECLARE_TOOL_FACTORY( eflowRecoverSplitShowersTool ) -DECLARE_TOOL_FACTORY( eflowCellLevelSubtractionTool ) -DECLARE_TOOL_FACTORY( eflowLCCalibTool ) -DECLARE_TOOL_FACTORY( eflowMomentCalculatorTool ) -DECLARE_TOOL_FACTORY( eflowClusterCollectionTool ) DECLARE_TOOL_FACTORY( eflowTrackCaloExtensionTool ) DECLARE_TOOL_FACTORY( eflowTrackCaloDummyExtensionTool ) DECLARE_TOOL_FACTORY( PFTrackClusterMatchingTool ) DECLARE_TOOL_FACTORY( eflowCellEOverPTool_mc12_JetETMiss) DECLARE_TOOL_FACTORY( eflowCellEOverPTool_mc12_LC) -DECLARE_TOOL_FACTORY( eflowObjectCreatorTool ) DECLARE_FACTORY_ENTRIES(eflowRec) { - DECLARE_ALGORITHM( eflowBuilder ) - DECLARE_ALGORITHM( eflowPreparation ) - DECLARE_ALGORITHM( eflowCaloObjectBuilder ) - DECLARE_ALGORITHM( eflowObjectBuilder ) DECLARE_ALGORITHM (eflowOverlapRemoval ) - DECLARE_ALGORITHM ( eflowVertexInformationSetter ) DECLARE_ALGORITHM( PFLeptonSelector ) DECLARE_ALGORITHM( PFClusterSelector ) DECLARE_ALGORITHM( PFTrackSelector ) @@ -75,15 +48,9 @@ DECLARE_FACTORY_ENTRIES(eflowRec) { DECLARE_TOOL( PFMomentCalculatorTool ) DECLARE_TOOL( PFClusterCollectionTool ) DECLARE_TOOL( PFLCCalibTool ) - DECLARE_TOOL ( eflowRecoverSplitShowersTool ) - DECLARE_TOOL ( eflowCellLevelSubtractionTool ) - DECLARE_TOOL ( eflowMomentCalculatorTool ) - DECLARE_TOOL ( eflowClusterCollectionTool ) - DECLARE_TOOL ( eflowLCCalibTool ) DECLARE_TOOL ( eflowTrackCaloExtensionTool ) DECLARE_TOOL ( eflowTrackCaloDummyExtensionTool ) DECLARE_TOOL ( PFTrackClusterMatchingTool ) DECLARE_TOOL (eflowCellEOverPTool_mc12_JetETMiss) DECLARE_TOOL ( eflowCellEOverPTool_mc12_LC) - DECLARE_TOOL (eflowObjectCreatorTool ) } diff --git a/Reconstruction/eflowRec/src/eflowBuilder.cxx b/Reconstruction/eflowRec/src/eflowBuilder.cxx deleted file mode 100644 index 7ccdd1e8e85eb7840f3746d6f147e100e9d40604..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowBuilder.cxx +++ /dev/null @@ -1,172 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/******************************************************************** - -NAME: eflowBuilder.cxx -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: D.R. Tovey -CREATED: 8th November, 2001 - -PURPOSE: Loop over tracks and clusters to build calo objects, then - loop over tracks and clusters within calo objects to build - eflow objects. - -********************************************************************/ - -// INCLUDE HEADER FILES: - -#include "eflowRec/eflowBuilder.h" - -// INCLUDE GAUDI HEADER FILES: - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/Property.h" -#include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/ListItem.h" - -#include <algorithm> -#include <math.h> - -// END OF HEADER FILES INCLUDE - -// CONSTRUCTOR: - -eflowBuilder::eflowBuilder(const std::string& name, - ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator), - m_eflowPreparationAlgName("eflowPreparation/caloObjectBuilderAlg"), - m_eflowObjectBuilderAlgName("eflowObjectBuilder/objectBuilderAlg"), - m_eflowQuantitiesAlgName("eflowQuantities/quantAlg") -{ - -// The following properties can be specified at run-time -// (declared in jobOptions file) - - // Names of various sub-algorithms: - declareProperty("eflowPreparationAlgName", - m_eflowPreparationAlgName); - declareProperty("eflowObjectBuilderAlgName", m_eflowObjectBuilderAlgName); - declareProperty("eflowQuantitiesAlgName", m_eflowQuantitiesAlgName); - m_eflowPreparationAlg = nullptr; - m_eflowObjectBuilderAlg = nullptr; - m_eflowQuantitiesAlg = nullptr; -} - -eflowBuilder::~eflowBuilder() -{ } - -StatusCode eflowBuilder::initialize() -{ - - Algorithm* pAlg; - StatusCode sc; - - // Get pointer to StoreGateSvc and cache: - - ////////////////////////////////////////////////////////////////// - // Create the eflowPreparation Algorithm: - - std::string type, name; - - ListItem caloObjectBuilderAlg(m_eflowPreparationAlgName); - sc = createSubAlgorithm(caloObjectBuilderAlg.type(), - caloObjectBuilderAlg.name(), pAlg); - - if( sc.isFailure() ) - { - ATH_MSG_DEBUG( "Unable to create " << m_eflowPreparationAlgName ); - m_eflowPreparationAlg = nullptr; - } - else - { - m_eflowPreparationAlg = dynamic_cast<AthAlgorithm*>(pAlg); - } - - ////////////////////////////////////////////////////////////////// - // Create the eflowObjectBuilder sub-algorithm: - - ListItem objectBuilderAlg(m_eflowObjectBuilderAlgName); - sc = createSubAlgorithm(objectBuilderAlg.type(), - objectBuilderAlg.name(), pAlg); - if( sc.isFailure() ) - { - ATH_MSG_DEBUG( "Unable to create " << m_eflowObjectBuilderAlgName ); - m_eflowObjectBuilderAlg = nullptr; - } - else - { - m_eflowObjectBuilderAlg = dynamic_cast<AthAlgorithm*>(pAlg); - } - - ////////////////////////////////////////////////////////////////// - // Create the eflowQuantities sub-algorithm: - - ListItem quantAlg(m_eflowQuantitiesAlgName); - sc = createSubAlgorithm(quantAlg.type(), quantAlg.name(), pAlg); - if( sc.isFailure() ) - { - ATH_MSG_DEBUG( "Unable to create " << m_eflowQuantitiesAlgName ); - m_eflowQuantitiesAlg = nullptr; - } - else - { - m_eflowQuantitiesAlg = dynamic_cast<AthAlgorithm*>(pAlg); - } - -///////////////////////////////////////////////////////////////// - - ATH_MSG_VERBOSE( "Using the Algorithms:" ); - ATH_MSG_VERBOSE( m_eflowPreparationAlgName ); - ATH_MSG_VERBOSE( m_eflowObjectBuilderAlgName ); - ATH_MSG_VERBOSE( m_eflowQuantitiesAlgName ); - - - return sc; -} - - -///////////////////////////////////////////////////////////////// - -StatusCode eflowBuilder::finalize() -{ - return StatusCode::SUCCESS; -} - -///////////////////////////////////////////////////////////////// - -// ATHENA EXECUTE METHOD: - -StatusCode eflowBuilder::execute() -{ - - StatusCode sc; - - ATH_MSG_DEBUG( "Executing eflowBuilder" ); - - // Build Calorimeter Objects - - if (m_eflowPreparationAlg) - { - sc = m_eflowPreparationAlg->execute(); - } - - // Build Energy Flow Objects - - if (sc.isSuccess() && m_eflowObjectBuilderAlg) - { - sc = m_eflowObjectBuilderAlg->execute(); - } - - // Calculate parameters - - if (sc.isSuccess() && m_eflowQuantitiesAlg) - { - sc = m_eflowQuantitiesAlg->execute(); - } - - return StatusCode::SUCCESS; - -} diff --git a/Reconstruction/eflowRec/src/eflowCaloObjectBuilder.cxx b/Reconstruction/eflowRec/src/eflowCaloObjectBuilder.cxx deleted file mode 100644 index 4302f2e57dd0420fd6fb0c6d326641e086f02a0b..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowCaloObjectBuilder.cxx +++ /dev/null @@ -1,159 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/******************************************************************** - -NAME: eflowCaloObjectBuilder.cxx -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: M.Hodgkinson -CREATED: 24th January, 2005 - -********************************************************************/ - -#include "eflowRec/eflowCaloObjectBuilder.h" -#include "eflowRec/eflowCaloObject.h" -#include "eflowRec/eflowRecCluster.h" -#include "eflowRec/eflowRecTrack.h" -#include "eflowRec/eflowTrackClusterLink.h" -#include "eflowRec/eflowISubtractionAlgTool.h" -#include "eflowRec/eflowRecoverSplitShowersTool.h" -#include "eflowRec/eflowLCCalibTool.h" -#include "eflowRec/eflowObjectCreatorTool.h" - -#include "FourMomUtils/P4DescendingSorters.h" - -#include "StoreGate/StoreGateSvc.h" - -#include "GaudiKernel/ListItem.h" - -#include <iostream> -using namespace std; - - -eflowCaloObjectBuilder::eflowCaloObjectBuilder(const std::string& name, ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator), - m_eflowClustersOutputName("PFOClusters_JetETMiss"), - m_eflowCaloObjectsName("eflowCaloObjects01"), - m_eflowRecTracksName("eflowRecTracks01"), - m_eflowRecClustersName("eflowRecClusters01"), - m_storeGate(nullptr), - m_tools(this) -{ - /* The following properties can be specified at run-time (declared in jobOptions file) */ - /* Tool configuration */ - declareProperty( "PrivateToolList", m_tools, "List of Private AlgTools" ); - /* Name if eflow cluster container to be created */ - declareProperty("EflowClustersOutputName",m_eflowClustersOutputName); - /* Name of eflow Calo Object to be retrieved */ - declareProperty("EflowCaloObjectsName",m_eflowCaloObjectsName); - /* Name of eflow Rec Track to be retrieved */ - declareProperty("EflowRecTracksName",m_eflowRecTracksName); - /* Name of eflow Rec Cluster to be retrieved */ - declareProperty("EflowRecClustersName",m_eflowRecClustersName); -} - -eflowCaloObjectBuilder::~eflowCaloObjectBuilder() { } - -StatusCode eflowCaloObjectBuilder::initialize() { - - msg(MSG::DEBUG) << "Initialising eflowCaloObjectBuilder " << endmsg; - - if (service("StoreGateSvc", m_storeGate).isFailure()) { - msg(MSG::WARNING) << "Unable to retrieve pointer to StoreGateSvc" << endmsg; - return StatusCode::SUCCESS; - } - - /* Tool service */ - IToolSvc* myToolSvc; - if ( service("ToolSvc",myToolSvc).isFailure() ) { - msg(MSG::WARNING) << " Tool Service Not Found" << endmsg; - return StatusCode::SUCCESS; - } - - if ( m_tools.retrieve().isFailure() ) { - msg(MSG::WARNING) << "Failed to retrieve " << m_tools << endmsg; - return StatusCode::SUCCESS; - } else { - msg(MSG::VERBOSE) << "Retrieved " << m_tools << endmsg; - } - - // print the list of tools - taken from JetRec/JetAlgorithm.cxx - printTools(); - - return StatusCode::SUCCESS; -} - -StatusCode eflowCaloObjectBuilder::execute(){ - - msg(MSG::DEBUG) << "Executing eflowCaloObjectBuilder" << endmsg; - StatusCode sc; - - /* Retrieve the eflowCaloObject container, return if not existing */ - const eflowCaloObjectContainer* caloObjectContainer; - sc = m_storeGate->retrieve(caloObjectContainer,m_eflowCaloObjectsName); - if(sc.isFailure() || !caloObjectContainer ){ - msg(MSG::WARNING) <<" no eflow calo object container" <<endmsg; - return StatusCode::SUCCESS; - } - - /* Retrieve the eflowRecTrack container, return if not existing */ - const eflowRecTrackContainer* recTrackContainer; - sc = m_storeGate->retrieve(recTrackContainer,m_eflowRecTracksName); - if(sc.isFailure() || !recTrackContainer ){ - msg(MSG::WARNING) <<" no eflow rec track container" <<endmsg; - return StatusCode::SUCCESS; - } - - /* Retrieve the eflowRecCluster container, return if not existing */ - const eflowRecClusterContainer* recClusterContainer; - sc = m_storeGate->retrieve(recClusterContainer,m_eflowRecClustersName); - if(sc.isFailure() || !recClusterContainer ){ - msg(MSG::WARNING) <<" no eflow rec cluster container" <<endmsg; - return StatusCode::SUCCESS; - } - - /* Run the AlgTools - * --> CellLevelSubtractionTool, RecoverSplitShowersTool */ - ToolHandleArray< eflowISubtractionAlgTool >::iterator itAlgTool = m_tools.begin(); - ToolHandleArray< eflowISubtractionAlgTool >::iterator lastAlgTool = m_tools.end(); - for (; itAlgTool != lastAlgTool; ++itAlgTool) { - (*itAlgTool)->execute(const_cast<eflowCaloObjectContainer*>(caloObjectContainer), - const_cast<eflowRecTrackContainer*>(recTrackContainer), - const_cast<eflowRecClusterContainer*>(recClusterContainer)); - } - - for (auto thisEFTrack : *recTrackContainer){ - ATH_MSG_DEBUG("This efRecTrack has E,pt,eta and phi of " << thisEFTrack->getTrack()->e() << ", " << thisEFTrack->getTrack()->pt() << ", " << thisEFTrack->getTrack()->eta() << " and " << thisEFTrack->getTrack()->phi()); - } - - for (auto thisEFCluster : *recClusterContainer){ - ATH_MSG_DEBUG("This efRecCluster has E,pt,eta and phi of " << thisEFCluster->getCluster()->e() << "," << thisEFCluster->getCluster()->pt() << ", " << thisEFCluster->getCluster()->eta() << " and " << thisEFCluster->getCluster()->phi()); - } - - return StatusCode::SUCCESS; - -} - -StatusCode eflowCaloObjectBuilder::finalize() { return StatusCode::SUCCESS; } - -void eflowCaloObjectBuilder::printTools() { - // print the list of tools - taken from JetRec/JetAlgorithm.cxx - ATH_MSG_VERBOSE(" "); - ATH_MSG_VERBOSE("List of tools in execution sequence of eflowCaloObjectBuilder:"); - ATH_MSG_VERBOSE("------------------------------------"); - ATH_MSG_VERBOSE(" "); - ToolHandleArray<eflowISubtractionAlgTool>::iterator itTool = m_tools.begin(); - ToolHandleArray<eflowISubtractionAlgTool>::iterator lastTool = m_tools.end(); - unsigned int toolCtr = 0; - for (; itTool != lastTool; itTool++) { - toolCtr++; - ATH_MSG_VERBOSE(std::setw(2) << std::setiosflags(std::ios_base::right) << toolCtr << ".) " - << std::resetiosflags(std::ios_base::right) << std::setw(36) << std::setfill('.') - << std::setiosflags(std::ios_base::left) << (*itTool)->type() << std::setfill('.') - << (*itTool)->name() << std::setfill(' ')); - } - ATH_MSG_VERBOSE(" "); - ATH_MSG_VERBOSE("------------------------------------"); -} diff --git a/Reconstruction/eflowRec/src/eflowCellLevelSubtractionTool.cxx b/Reconstruction/eflowRec/src/eflowCellLevelSubtractionTool.cxx deleted file mode 100644 index d2caad4a287f1311b5cbe0e3d41012958ab9ee63..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowCellLevelSubtractionTool.cxx +++ /dev/null @@ -1,486 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - -/******************************************************************** - -NAME: eflowCellLevelSubtractionTool.h -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: M.Hodgkinson -CREATED: 25th January, 2005 - -AUTHOR: A.Hostiuc -UPDATED: May 29th, 2017 - -********************************************************************/ - -#include "eflowRec/eflowCellLevelSubtractionTool.h" - -#include "eflowRec/eflowRecCluster.h" -#include "eflowRec/eflowRecTrack.h" -#include "eflowRec/eflowTrackClusterLink.h" -#include "eflowRec/eflowDatabase.h" -#include "eflowRec/eflowDepthCalculator.h" -#include "eflowRec/eflowTrackCaloPoints.h" -#include "eflowRec/IEFlowCellEOverPTool.h" -#include "eflowRec/eflowEEtaBinnedParameters.h" -#include "eflowRec/eflowLayerIntegrator.h" -#include "eflowRec/PFTrackClusterMatchingTool.h" -#include "eflowRec/cycle.h" -#include "eflowRec/eflowRingSubtractionManager.h" -#include "eflowRec/eflowCellSubtractionFacilitator.h" -#include "eflowRec/eflowSubtractor.h" -#include "eflowRec/eflowRingThicknesses.h" - -#include "CaloEvent/CaloCluster.h" - -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterKineHelper.h" - -#include "xAODPFlow/PFO.h" - -#include "eflowRec/eflowCaloObject.h" -#include "eflowRec/eflowCaloObjectMaker.h" -#include "GaudiKernel/MsgStream.h" - -#include "GaudiKernel/ListItem.h" - -#include <algorithm> -#include <iostream> -#include <cmath> -#include <vector> - - -using namespace eflowSubtract; - -eflowCellLevelSubtractionTool::eflowCellLevelSubtractionTool(const std::string& type,const std::string& name,const IInterface* parent) : - AthAlgTool( type, name, parent), - m_eflowCaloObjectContainer(nullptr), - m_eflowTrackContainer(nullptr), - m_eflowClusterContainer(nullptr), - m_matchingTool("PFTrackClusterMatchingTool/CalObjBldMatchingTool", this), - m_matchingToolForPull_015("PFTrackClusterMatchingTool/PFPullMatchingTool_015", this), - m_matchingToolForPull_02("PFTrackClusterMatchingTool/PFPullMatchingTool_02", this), - m_binnedParameters(nullptr), - m_integrator(nullptr), - m_theEOverPTool("eflowCellEOverPTool",this), - //m_rCell(0.75), - m_subtractionSigmaCut(1.5), - m_consistencySigmaCut(1.0), - m_calcEOverP(false), - m_goldenModeString(""), - m_nMatchesInCellLevelSubtraction(1), - m_useUpdated2015ChargedShowerSubtraction(true) - -{ - declareProperty("PFTrackClusterMatchingTool", m_matchingTool, "The track-cluster matching tool"); - declareProperty("PFTrackClusterMatchingTool_015", m_matchingToolForPull_015, "The 0.15 track-cluster matching tool to calculate the pull"); - declareProperty("PFTrackClusterMatchingTool_02", m_matchingToolForPull_02, "The 0.2 track-cluster matching tool to calculate the pull"); - declareProperty("eflowCellEOverPTool", m_theEOverPTool, "Energy Flow E/P Values and Shower Paremeters Tool"); - declareProperty("SubtractionSigmaCut",m_subtractionSigmaCut); - declareProperty("ConsistencySigmaCut",m_consistencySigmaCut); - declareProperty("CalcEOverP",m_calcEOverP,"Whether to disable energy flow"); - declareProperty("goldenModeString",m_goldenModeString,"run in golden match mode only?"); - declareProperty("nMatchesInCellLevelSubtraction",m_nMatchesInCellLevelSubtraction,"Number of clusters to match"); - declareProperty("useUpdated2015ChargedShowerSubtraction",m_useUpdated2015ChargedShowerSubtraction,"Toggle whether to use updated 2015 charged shower subtraction, which disables the shower subtraction in high calorimeter energy density region"); -} - -eflowCellLevelSubtractionTool::~eflowCellLevelSubtractionTool() { -} - -StatusCode eflowCellLevelSubtractionTool::initialize(){ - StatusCode sc; - - /* tool service */ - IToolSvc* myToolSvc; - sc = service("ToolSvc", myToolSvc); - - if (m_matchingTool.retrieve().isFailure()) { - msg(MSG::WARNING) << "Cannot find PFTrackClusterMatchingTool" << endmsg; - } - - if (m_matchingToolForPull_015.retrieve().isFailure()) { - msg(MSG::WARNING) << "Cannot find PFTrackClusterMatchingTool_2" << endmsg; - } - - if (m_matchingToolForPull_02.retrieve().isFailure()) { - msg(MSG::WARNING) << "Cannot find PFTrackClusterMatchingTool_2" << endmsg; - } - - m_integrator = std::make_unique<eflowLayerIntegrator>(0.032, 1.0e-3, 3.0); - m_binnedParameters = std::make_unique<eflowEEtaBinnedParameters>(); - - sc = m_theEOverPTool->execute(m_binnedParameters.get()); - - if (sc.isFailure()) { - msg(MSG::WARNING) << "Could not execute eflowCellEOverPTool " << endmsg; - return StatusCode::SUCCESS; - } - - return StatusCode::SUCCESS; - -} - -void eflowCellLevelSubtractionTool::execute(eflowCaloObjectContainer* theEflowCaloObjectContainer, eflowRecTrackContainer* recTrackContainer, eflowRecClusterContainer* recClusterContainer) { - - ATH_MSG_VERBOSE("Executing eflowCellLevelSubtractionTool"); - - m_eflowCaloObjectContainer = theEflowCaloObjectContainer; - m_eflowTrackContainer = recTrackContainer; - m_eflowClusterContainer = recClusterContainer; - - - /* Add each track to its best matching cluster's eflowCaloObject */ - matchAndCreateEflowCaloObj(m_nMatchesInCellLevelSubtraction); - - if (msgLvl(MSG::DEBUG)) printAllClusters(recClusterContainer); - - - /* Check e/p mode - only perform subtraction if not in this mode */ - if (!m_calcEOverP) {performSubtraction();} - - - /* Check e/p mode - only perform radial profiles calculations if in this mode */ - if (m_calcEOverP) {calculateRadialEnergyProfiles();} - - -} - -int eflowCellLevelSubtractionTool::matchAndCreateEflowCaloObj(int n) { - int nMatches(0); - - /* Create eflowTrackClusterLink after matching */ - unsigned int nTrack = m_eflowTrackContainer->size(); - for (unsigned int iTrack=0; iTrack<nTrack; ++iTrack) { - eflowRecTrack *thisEfRecTrack = static_cast<eflowRecTrack*>(m_eflowTrackContainer->at(iTrack)); - - /* Add cluster matches needed for pull calculation*/ - std::vector<eflowRecCluster*> bestClusters_015 = m_matchingToolForPull_015->doMatches(thisEfRecTrack, m_eflowClusterContainer, -1); - std::vector<eflowRecCluster*> bestClusters_02 = m_matchingToolForPull_02->doMatches(thisEfRecTrack, m_eflowClusterContainer, -1); - - for (unsigned int imatch=0; imatch < bestClusters_015.size(); ++imatch) { - eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, bestClusters_015.at(imatch)); - thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink,"cone_015"); - } - - for (unsigned int imatch=0; imatch < bestClusters_02.size(); ++imatch) { - eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, bestClusters_02.at(imatch)); - thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink,"cone_02"); - } - - std::vector<eflowRecCluster*> bestClusters = m_matchingTool->doMatches(thisEfRecTrack, m_eflowClusterContainer, n); - if (bestClusters.empty()) { continue; } - - /* Matched cluster: create TrackClusterLink and add it to both the track and the cluster (eflowCaloObject will be created later) */ - nMatches++; - for (unsigned int imatch=0; imatch < bestClusters.size(); ++imatch) { - eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, bestClusters.at(imatch)); - thisEfRecTrack->addClusterMatch(trackClusterLink); - bestClusters.at(imatch)->addTrackMatch(trackClusterLink); - - } - - } - - /* Create 3 types eflowCaloObjects: track-only, cluster-only, track-cluster-link */ - eflowCaloObjectMaker makeCaloObject; - int nCaloObjects = makeCaloObject.makeTrkCluCaloObjects(m_eflowTrackContainer, m_eflowClusterContainer, m_eflowCaloObjectContainer); - msg(MSG::DEBUG) << "eflowCellLevelSubtractionTool created total " << nCaloObjects << " CaloObjects." << endmsg; - - /* integrate cells; determine FLI; eoverp */ - for (unsigned int iCalo=0; iCalo<m_eflowCaloObjectContainer->size(); ++iCalo) { - eflowCaloObject *thisEflowCaloObject = static_cast<eflowCaloObject*>(m_eflowCaloObjectContainer->at(iCalo)); - - thisEflowCaloObject->simulateShower(m_integrator.get(), m_binnedParameters.get(), m_useUpdated2015ChargedShowerSubtraction); - } - - return nMatches; -} - -void eflowCellLevelSubtractionTool::calculateRadialEnergyProfiles(){ - - msg(MSG::DEBUG) << "Accessed radial energy profile function" << std::endl; - - unsigned int nEFCaloObs = m_eflowCaloObjectContainer->size(); - - for (unsigned int iEFCalOb = 0; iEFCalOb < nEFCaloObs; ++iEFCalOb) { - - eflowCaloObject* thisEflowCaloObject = m_eflowCaloObjectContainer->at(iEFCalOb); - - unsigned int nClusters = thisEflowCaloObject->nClusters(); - - if (nClusters < 1) { - continue; - } - - const std::vector<eflowTrackClusterLink*>& matchedTrackList = thisEflowCaloObject->efRecLink(); - - int nTrackMatches = thisEflowCaloObject->nTracks(); - - for (int iTrack = 0; iTrack < nTrackMatches; ++iTrack) { - - eflowRecTrack* efRecTrack = matchedTrackList[iTrack]->getTrack(); - - std::vector<eflowRecCluster*> matchedClusters; - matchedClusters.clear(); - std::vector<eflowTrackClusterLink*> links = efRecTrack->getClusterMatches(); - std::vector<eflowTrackClusterLink*>::iterator itLink = links.begin(); - std::vector<eflowTrackClusterLink*>::iterator endLink = links.end(); - - for (; itLink != endLink; ++itLink) { - matchedClusters.push_back((*itLink)->getCluster()); - } - - std::vector<xAOD::CaloCluster*> clusterSubtractionList; - std::vector<eflowRecCluster*>::const_iterator itCluster = matchedClusters.begin(); - std::vector<eflowRecCluster*>::const_iterator endCluster = matchedClusters.end(); - for (; itCluster != endCluster; ++itCluster) { - clusterSubtractionList.push_back((*itCluster)->getClusterForModification(eflowCaloObject::getClusterContainerPtr())); - } - - eflowCellList calorimeterCellList; - Subtractor::makeOrderedCellList(efRecTrack->getTrackCaloPoints(),clusterSubtractionList,calorimeterCellList); - - eflowRingThicknesses ringThicknessGenerator; - - std::vector<int> layerToStoreVector; - std::vector<float> radiusToStoreVector; - std::vector<float> avgEdensityToStoreVector; - - for (int i=0; i < eflowCalo::nRegions ;i++){ - - eflowCaloENUM layer = (eflowCaloENUM)i; - msg(MSG::DEBUG) <<"layer is "<<layer<<std::endl; - double ringThickness = ringThicknessGenerator.ringThickness((eflowCaloENUM)i); - msg(MSG::DEBUG) <<"ring thickness is "<<ringThickness<<std::endl; - - double eta_extr = calorimeterCellList.etaFF(layer); - msg(MSG::DEBUG) <<"extrapolated eta ["<<layer<<"] is "<<eta_extr<<std::endl; - double phi_extr = calorimeterCellList.phiFF(layer); - msg(MSG::DEBUG) <<"extrapolated phi ["<<layer<<"] is "<<phi_extr<<std::endl; - - if (eta_extr == -999.0){ - continue; - } - - int indexofRing = 0; - int layerToStore = -999; - - double radiusToStore = 0; - double totalEnergyPerCell = 0; - - double energyDensityPerCell = -666; - double totalEnergyPerRing = 0; - - double cellVolume = 0; - int totalCells = 0; - - int n; - /* 100 is chosen as a number higher than the number of cells found in a normal list */ - for (n=1; n<100; n++){ - - CellIt beginRing = calorimeterCellList.getLowerBound((eflowCaloENUM)i, ringThickness*(n-1)); - - if(beginRing == calorimeterCellList.end()){ - break; - } - - indexofRing += 1; - std::vector<std::pair<CaloCell*,int> > tempVector = (*beginRing).second; - std::vector<std::pair<CaloCell*,int> >::iterator firstPair = tempVector.begin(); - std::vector<std::pair<CaloCell*,int> >::iterator lastPair = tempVector.end(); - - int totalCellsinRing = 0; - double energyDensityPerRing = 0; - double averageEnergyDensityPerRing = 0; - - for (; firstPair != lastPair; ++firstPair) { - const CaloDetDescrElement* DDE = ((*firstPair).first)->caloDDE(); - CaloCell_ID::CaloSample sampling = DDE->getSampling(); - - msg(MSG::DEBUG) << " cell eta and phi are " << ((*firstPair).first)->eta() << " and " << ((*firstPair).first)->phi() << " with index " << (*firstPair).second << " and sampling of " << sampling << std::endl; - msg(MSG::DEBUG) << " cell energy is " << ((*firstPair).first)->energy()<<std::endl; - - totalCells += 1; - totalCellsinRing += 1; - - totalEnergyPerRing += ((*firstPair).first)->energy(); - totalEnergyPerCell = ((*firstPair).first)->energy(); - msg(MSG::DEBUG) << " Total E per Cell is " << totalEnergyPerCell<<std::endl; - msg(MSG::DEBUG) << " Total E per Ring is " << totalEnergyPerRing<<std::endl; - - cellVolume = DDE->volume(); - msg(MSG::DEBUG) << " cell volume is " << cellVolume/1000.<<std::endl; - - energyDensityPerCell = totalEnergyPerCell/(cellVolume/1000.); - msg(MSG::DEBUG) << " E density per Cell is " << energyDensityPerCell<<std::endl; - msg(MSG::DEBUG) << " Initial added E density per Cell is " << energyDensityPerRing<<std::endl; - energyDensityPerRing += energyDensityPerCell; - msg(MSG::DEBUG) << " Final added E density per Cell is " << energyDensityPerRing<<std::endl; - averageEnergyDensityPerRing = energyDensityPerRing/((totalCellsinRing)*(efRecTrack->getTrack()->e()/1000.)); - } - - msg(MSG::DEBUG) << " track E is " << efRecTrack->getTrack()->e()/1000.; - msg(MSG::DEBUG) << " Average E density per Ring is " << averageEnergyDensityPerRing<<std::endl; - - if (averageEnergyDensityPerRing != 0){ - avgEdensityToStoreVector.push_back(averageEnergyDensityPerRing); - layerToStore = (eflowCaloENUM)i; - msg(MSG::DEBUG) <<"layerToStore is "<< layerToStore << std::endl; - layerToStoreVector.push_back(layerToStore); - radiusToStore = (indexofRing)*ringThickness; - msg(MSG::DEBUG) <<"radiusToStore is "<< radiusToStore << std::endl; - radiusToStoreVector.push_back(radiusToStore); - } - else {msg(MSG::DEBUG) <<"averageEnergyDensityPerRing = 0"<<std::endl;} - }//loop on 100 cells - }//loop on calo regions - - efRecTrack->setLayerCellOrderVector(layerToStoreVector); - efRecTrack->setRadiusCellOrderVector(radiusToStoreVector); - efRecTrack->setAvgEDensityCellOrderVector(avgEdensityToStoreVector); - - layerToStoreVector.clear(); - radiusToStoreVector.clear(); - avgEdensityToStoreVector.clear(); - }//loop on track matches - }//loop on eflowCaloObjects -} - -void eflowCellLevelSubtractionTool::performSubtraction() { - - unsigned int nEFCaloObs = m_eflowCaloObjectContainer->size(); - for (unsigned int iEFCalOb = 0; iEFCalOb < nEFCaloObs; ++iEFCalOb) { - eflowCaloObject* thisEflowCaloObject = m_eflowCaloObjectContainer->at(iEFCalOb); - - unsigned int nClusters = thisEflowCaloObject->nClusters(); - if (nClusters < 1) { - continue; - } - - /* Get matched cluster via Links */ - - double expectedEnergy = thisEflowCaloObject->getExpectedEnergy(); - double clusterEnergy = thisEflowCaloObject->getClusterEnergy(); - double expectedSigma = sqrt(thisEflowCaloObject->getExpectedVariance()); - - /* Check e/p */ - if (isEOverPFail(expectedEnergy, expectedSigma, clusterEnergy, m_consistencySigmaCut, - runInGoldenMode()) - || (runInGoldenMode() && thisEflowCaloObject->nTracks() > 1)) { - continue; - } - - /* Do subtraction */ - - int nTrackMatches = thisEflowCaloObject->nTracks(); - if (nTrackMatches == 0 || runInGoldenMode()) { - continue; - } - - /* Subtract the track from all matched clusters */ - const std::vector<eflowTrackClusterLink*>& matchedTrackList = thisEflowCaloObject->efRecLink(); - - for (int iTrack = 0; iTrack < nTrackMatches; ++iTrack) { - eflowRecTrack* efRecTrack = matchedTrackList[iTrack]->getTrack(); - - /* Can't subtract without e/p */ - if (!efRecTrack->hasBin()) { - continue; - } - - if (efRecTrack->isInDenseEnvironment()) continue; - - std::vector<eflowRecCluster*> matchedClusters; - matchedClusters.clear(); - std::vector<eflowTrackClusterLink*> links = efRecTrack->getClusterMatches(); - std::vector<eflowTrackClusterLink*>::iterator itLink = links.begin(); - std::vector<eflowTrackClusterLink*>::iterator endLink = links.end(); - for (; itLink != endLink; ++itLink) { - matchedClusters.push_back((*itLink)->getCluster()); - } - std::vector<xAOD::CaloCluster*> clusterSubtractionList; - std::vector<eflowRecCluster*>::const_iterator itCluster = matchedClusters.begin(); - std::vector<eflowRecCluster*>::const_iterator endCluster = matchedClusters.end(); - for (; itCluster != endCluster; ++itCluster) { - clusterSubtractionList.push_back((*itCluster)->getClusterForModification(eflowCaloObject::getClusterContainerPtr())); - } - - Subtractor::subtractTracksFromClusters(efRecTrack, clusterSubtractionList); - - /* Annihilate the cluster(s) if the remnant is small (i.e. below k*sigma) */ - if (canAnnihilated(0, expectedSigma, clusterEnergy)) { - Subtractor::annihilateClusters(clusterSubtractionList); - } - } - - if (canAnnihilated(expectedEnergy, expectedSigma, clusterEnergy)) { - /* Check if we can annihilate right away */ - std::vector<xAOD::CaloCluster*> clusterList; - unsigned nCluster = thisEflowCaloObject->nClusters(); - for (unsigned iCluster = 0; iCluster < nCluster; ++iCluster) { - clusterList.push_back( - thisEflowCaloObject->efRecCluster(iCluster)->getClusterForModification( - eflowCaloObject::getClusterContainerPtr())); - } - Subtractor::annihilateClusters(clusterList); - } - - /* Flag tracks as subtracted */ - for (unsigned int iTrack = 0; iTrack < thisEflowCaloObject->nTracks(); ++iTrack) { - if (!thisEflowCaloObject->efRecTrack(iTrack)->isInDenseEnvironment()) thisEflowCaloObject->efRecTrack(iTrack)->setSubtracted(); - } - } -} - -StatusCode eflowCellLevelSubtractionTool::finalize(){ - - return StatusCode::SUCCESS; -} - - -bool eflowCellLevelSubtractionTool::isEOverPFail(double expectedEnergy, double sigma, double clusterEnergy, bool consistencySigmaCut, bool useGoldenMode) { - if ((expectedEnergy == 0) && (clusterEnergy > 0)) { - return false; - } - - bool result = useGoldenMode ? fabs(clusterEnergy - expectedEnergy) > consistencySigmaCut*sigma - : clusterEnergy < expectedEnergy - consistencySigmaCut*sigma; - return result; -} - -bool eflowCellLevelSubtractionTool::canAnnihilated(double expectedEnergy, double sigma, double clusterEnergy) { - return clusterEnergy - expectedEnergy < m_subtractionSigmaCut * sigma; -} - -std::string eflowCellLevelSubtractionTool::printTrack(const xAOD::TrackParticle* track) { - std::stringstream result; - result << " track with E, eta and phi "<< track->e() << ", " << track->eta() << " and " << track->phi(); - return result.str(); -} - -std::string eflowCellLevelSubtractionTool::printCluster(const xAOD::CaloCluster* cluster) { - std::stringstream result; - result << " cluster with E, eta and phi of " << cluster->e() << ", " << cluster->eta() << " and " << cluster->phi(); - return result.str(); -} - -void eflowCellLevelSubtractionTool::printAllClusters(eflowRecClusterContainer* recClusterContainer) { - unsigned int nClusters = recClusterContainer->size(); - for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) { - /* Create the eflowCaloObject and put it in the container */ - eflowRecCluster* thisEFRecCluster = recClusterContainer->at(iCluster); - if (thisEFRecCluster->getTrackMatches().empty()) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Isolated" << printCluster(thisEFRecCluster->getCluster()) << endmsg; - } else { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Matched" << printCluster(thisEFRecCluster->getCluster()) << endmsg; - int nTrackMatches = thisEFRecCluster->getNTracks(); - std::vector<eflowTrackClusterLink*> theTrackLinks = thisEFRecCluster->getTrackMatches(); - for (int iTrackMatch = 0; iTrackMatch < nTrackMatches; ++iTrackMatch) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Matched" << printTrack(theTrackLinks[iTrackMatch]->getTrack()->getTrack()) << endmsg; - } - } - } -} diff --git a/Reconstruction/eflowRec/src/eflowClusterCollectionTool.cxx b/Reconstruction/eflowRec/src/eflowClusterCollectionTool.cxx deleted file mode 100644 index 74ab175e8b29433beec00d43a723d4a057420497..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowClusterCollectionTool.cxx +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "eflowRec/eflowClusterCollectionTool.h" -#include "eflowRec/eflowCaloObject.h" -#include "eflowRec/eflowRecCluster.h" - -eflowClusterCollectionTool::eflowClusterCollectionTool(const std::string& type,const std::string& name,const IInterface* parent) : - AthAlgTool( type, name, parent) -{ - declareInterface<IEFlowClusterCollectionTool>(this); -} - -StatusCode eflowClusterCollectionTool::initialize(){ - return StatusCode::SUCCESS; -} - -std::unique_ptr<eflowRecClusterContainer> eflowClusterCollectionTool::retrieve(eflowCaloObjectContainer* theEflowCaloObjectContainer, bool useNonModifiedClusters) { - - std::unique_ptr<eflowRecClusterContainer> result = std::make_unique<eflowRecClusterContainer>(); - - /* Loop over all eflowCaloObjects */ - eflowCaloObjectContainer::iterator itEFCaloObject = theEflowCaloObjectContainer->begin(); - eflowCaloObjectContainer::iterator endEFCaloObject = theEflowCaloObjectContainer->end(); - for (; itEFCaloObject != endEFCaloObject; ++itEFCaloObject) { - - eflowCaloObject* thisEflowCaloObject = *itEFCaloObject; - - /* Add all clusters on the eflowCaloObject to the container */ - unsigned int nClusters = thisEflowCaloObject->nClusters(); - for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) { - eflowRecCluster* thisEfRecCluster = thisEflowCaloObject->efRecCluster(iCluster); - - /* Only add clusters if should run calibration tools or if touchable (i.e. we modified them */ - if (!useNonModifiedClusters && !thisEfRecCluster->isTouchable() ) { - continue; - } - - result->push_back(thisEfRecCluster); - } -} - return result; -} - - -std::unique_ptr<xAOD::CaloClusterContainer> eflowClusterCollectionTool::execute(eflowCaloObjectContainer* theEflowCaloObjectContainer, bool useNonModifiedClusters) { - - std::unique_ptr<xAOD::CaloClusterContainer> result = std::make_unique<xAOD::CaloClusterContainer>(SG::VIEW_ELEMENTS); - - /* Loop over all eflowCaloObjects */ - eflowCaloObjectContainer::iterator itEFCaloObject = theEflowCaloObjectContainer->begin(); - eflowCaloObjectContainer::iterator endEFCaloObject = theEflowCaloObjectContainer->end(); - for (; itEFCaloObject != endEFCaloObject; ++itEFCaloObject) { - - eflowCaloObject* thisEflowCaloObject = *itEFCaloObject; - - /* Add all clusters on the eflowCaloObject to the container */ - unsigned int nClusters = thisEflowCaloObject->nClusters(); - for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) { - eflowRecCluster* thisEfRecCluster = thisEflowCaloObject->efRecCluster(iCluster); - - /* Only add clusters if should run calibration tools or if touchable (i.e. we modified them */ - if (!useNonModifiedClusters && !thisEfRecCluster->isTouchable() ) { - continue; - } - - xAOD::CaloCluster* thisCluster = thisEfRecCluster->getClusterForModification(eflowCaloObject::getClusterContainerPtr()); - result->push_back(thisCluster); - - msg(MSG::DEBUG) << "Adding cluster with E, eta and phi to moments maker " - << thisCluster->e() << ", " << thisCluster->eta() << " and " << thisCluster->phi() << endmsg; - } - } - return result; -} - -StatusCode eflowClusterCollectionTool::finalize(){ - return StatusCode::SUCCESS; -} diff --git a/Reconstruction/eflowRec/src/eflowLCCalibTool.cxx b/Reconstruction/eflowRec/src/eflowLCCalibTool.cxx deleted file mode 100644 index bbdeeb7ff0d3f11c5b86bc43ef803afdc2ce2028..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowLCCalibTool.cxx +++ /dev/null @@ -1,131 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "eflowRec/eflowLCCalibTool.h" -#include "eflowRec/eflowCaloObject.h" -#include "eflowRec/eflowRecCluster.h" - -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "xAODCaloEvent/CaloClusterKineHelper.h" -#include "CaloRec/CaloClusterProcessor.h" - -#include "CaloDetDescr/CaloDetDescrManager.h" -#include "CaloIdentifier/CaloCell_ID.h" -#include "CaloUtils/CaloClusterStoreHelper.h" - -eflowLCCalibTool::eflowLCCalibTool(const std::string& type, const std::string& name, const IInterface* parent) : - AthAlgTool(type, name, parent), - m_clusterCollectionTool("eflowRecClusterCollectionTool", this), - m_clusterLocalCalibTool("CaloClusterLocalCalib", this), - m_clusterLocalCalibOOCCTool("CaloClusterLocalCalib", this), - m_clusterLocalCalibOOCCPi0Tool("CaloClusterLocalCalib", this), - m_clusterLocalCalibDMTool("CaloClusterLocalCalib", this), - m_useLocalWeight(false) { - declareInterface<eflowLCCalibTool>(this); - declareProperty("eflowRecClusterCollectionTool", m_clusterCollectionTool, "Tool to choose clusters to use"); - declareProperty("CaloClusterLocalCalib", m_clusterLocalCalibTool, "Cluster Calibration for EFlowRec"); - declareProperty("CaloClusterLocalCalibOOCC", m_clusterLocalCalibOOCCTool, "Cluster CalibrationOOCC for EFlowRec"); - declareProperty("CaloClusterLocalCalibOOCCPi0", m_clusterLocalCalibOOCCPi0Tool, "Cluster CalibrationOOCCPi0 for EFlowRec"); - declareProperty("CaloClusterLocalCalibDM", m_clusterLocalCalibDMTool, "Cluster CalibrationDM for EFlowRec"); - declareProperty("UseLocalWeight", m_useLocalWeight, "Use weight before subtraction"); -} - -StatusCode eflowLCCalibTool::initialize() { - - /* Retrieve the cluster collection tool */ - ATH_CHECK(m_clusterCollectionTool.retrieve()); - - /* Retrieve basic local-hadron calibration tool */ - ATH_CHECK(m_clusterLocalCalibTool.retrieve()); - - /* Retrieve tools for out-of-cluster corrections */ - ATH_CHECK(m_clusterLocalCalibOOCCTool.retrieve()); - - ATH_CHECK(m_clusterLocalCalibOOCCPi0Tool.retrieve()); - - /* Retrieve tool for DM corrections */ - ATH_CHECK(m_clusterLocalCalibDMTool.retrieve()); - - return StatusCode::SUCCESS; - -} - -void eflowLCCalibTool::execute(eflowCaloObjectContainer* theEflowCaloObjectContainer) { - - if (m_useLocalWeight) { - std::unique_ptr<eflowRecClusterContainer> theEFRecCluster = m_clusterCollectionTool->retrieve(theEflowCaloObjectContainer, true); - /* Calibrate each cluster */ - eflowRecClusterContainer::iterator itCluster = theEFRecCluster->begin(); - eflowRecClusterContainer::iterator endCluster = theEFRecCluster->end(); - for (; itCluster != endCluster; ++itCluster) { - eflowRecCluster* cluster = (*itCluster); - applyLocalWeight(cluster); - } - } else { - /* Collect all the clusters in a temporary container (with VIEW_ELEMENTS!) */ - std::unique_ptr<xAOD::CaloClusterContainer> tempClusterContainer = m_clusterCollectionTool->execute( - theEflowCaloObjectContainer, true); - - /* Calibrate each cluster */ - xAOD::CaloClusterContainer::iterator itCluster = tempClusterContainer->begin(); - xAOD::CaloClusterContainer::iterator endCluster = tempClusterContainer->end(); - for (; itCluster != endCluster; ++itCluster) { - xAOD::CaloCluster* cluster = (*itCluster); - /* Subsequently apply all ClusterLocalCalibTools, print debug output at each stage, if DEBUG it set */ - - apply(m_clusterLocalCalibTool, cluster); - - apply(m_clusterLocalCalibOOCCTool, cluster); - - apply(m_clusterLocalCalibOOCCPi0Tool, cluster); - - apply(m_clusterLocalCalibDMTool, cluster); - - } - - } -} - -StatusCode eflowLCCalibTool::finalize() { - return StatusCode::SUCCESS; -} - - -void eflowLCCalibTool::apply(ToolHandle<CaloClusterCollectionProcessor>& calibTool, xAOD::CaloCluster* cluster) { - - assert(!m_useLocalWeight); - CaloClusterCollectionProcessor* myCollectionProcessor = &(*calibTool); - CaloClusterProcessor* myCalibProcessor = dynamic_cast<CaloClusterProcessor*>(myCollectionProcessor); - if (myCalibProcessor) { - if (myCalibProcessor->execute(cluster).isFailure()) { - if (msgLvl(MSG::WARNING)) - msg(MSG::WARNING) << "Could not execute " << calibTool.name() << endmsg; - } - } else if (msgLvl(MSG::WARNING)) - msg(MSG::WARNING) << " dynamic_cast provided NULL pointer to CaloClusterProcessor " << endmsg; -} - -void eflowLCCalibTool::applyLocalWeight(eflowRecCluster* theEFRecClusters) { - xAOD::CaloCluster* theCluster = theEFRecClusters->getClusterForModification( - eflowCaloObject::getClusterContainerPtr()); - - /* Iterate over cells of old cluster and replicate them with energy weighted by -1 if negative and add it to the new cluster */ - const std::map<IdentifierHash, double> weightMap = theEFRecClusters->getCellsWeight(); - const CaloCell_ID* calo_id = CaloDetDescrManager::instance()->getCaloCell_ID(); - xAOD::CaloCluster::cell_iterator cellIter = theCluster->cell_begin(); - - for (int cellIndex = 0; cellIter != theCluster->cell_end(); cellIter++) { - const CaloCell* pCell = *cellIter; - IdentifierHash myHashId = calo_id->calo_cell_hash(pCell->ID()); - double weight = weightMap.find(myHashId)->second; - theCluster->reweightCell(cellIter, weight); - cellIndex++; - } - - CaloClusterKineHelper::calculateKine(theCluster, true, false); - - theCluster->recoStatus().setStatus(CaloRecoStatus::CALIBRATEDLHC); - -} diff --git a/Reconstruction/eflowRec/src/eflowMomentCalculatorTool.cxx b/Reconstruction/eflowRec/src/eflowMomentCalculatorTool.cxx deleted file mode 100644 index 08797cd550440cc29e2c32660ef896ff5803ab6b..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowMomentCalculatorTool.cxx +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "eflowRec/eflowMomentCalculatorTool.h" -#include "eflowRec/eflowCaloObject.h" -#include "eflowRec/eflowRecCluster.h" - -#include "xAODCaloEvent/CaloClusterKineHelper.h" - -eflowMomentCalculatorTool::eflowMomentCalculatorTool(const std::string& type,const std::string& name,const IInterface* parent) : - AthAlgTool( type, name, parent), - m_clusterCollectionTool("eflowRecClusterCollectionTool",this), - m_clusterMomentsMaker("CaloClusterMomentsMaker",this), - m_LCMode(false) -{ - declareInterface<eflowMomentCalculatorTool>(this); - declareProperty("eflowRecClusterCollectionTool", m_clusterCollectionTool, "Tool to choose clusters to use"); - declareProperty("CaloClusterMomentsMaker", m_clusterMomentsMaker, "Tool to Calculate Cluster Moments"); - declareProperty("LCMode", m_LCMode, "Toggle whether we are in LC mode or not"); -} - -StatusCode eflowMomentCalculatorTool::initialize(){ - - /* Retrieve the cluster collection tool */ - ATH_CHECK(m_clusterCollectionTool.retrieve()); - - /* Retrieve the cluster moments maker */ - if ( m_clusterMomentsMaker.retrieve().isFailure() ) { - msg(MSG::WARNING) << "Cannot find CaloClusterMomentsMaker Tool "<< endmsg; - return StatusCode::SUCCESS; - } - return StatusCode::SUCCESS; -} - -void eflowMomentCalculatorTool::execute(eflowCaloObjectContainer* theEflowCaloObjectContainer) { - - /* Collect all the clusters in a temporary container (with VIEW_ELEMENTS!) */ - bool useNonModifiedClusters = true; - if (true == m_LCMode) useNonModifiedClusters = false; - std::unique_ptr<xAOD::CaloClusterContainer> tempClusterContainer = m_clusterCollectionTool->execute(theEflowCaloObjectContainer, useNonModifiedClusters); - - /* Set the layer energies */ - /* This must be set before the cluster moment calculations, which use the layer energies */ - for (auto cluster : *tempClusterContainer) CaloClusterKineHelper::calculateKine(cluster, true, true); - - /* Remake the cluster moments */ - - if (m_clusterMomentsMaker->execute(tempClusterContainer.get()).isFailure()) { - msg(MSG::WARNING) << "Could not execute ClusterMomentsMaker " << endmsg; - } - -} - -StatusCode eflowMomentCalculatorTool::finalize(){ return StatusCode::SUCCESS; } - - diff --git a/Reconstruction/eflowRec/src/eflowObjectBuilder.cxx b/Reconstruction/eflowRec/src/eflowObjectBuilder.cxx deleted file mode 100644 index 422856e57d69201955f8344d1bcf73a081a285f5..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowObjectBuilder.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/* - * eflowObjectBuilder.cxx - * - * Created on: Mar 2, 2015 - * Author: zhangrui - */ - -#include "eflowRec/eflowObjectBuilder.h" -#include "eflowRec/eflowCaloObject.h" -#include "eflowRec/eflowTrackClusterLink.h" -#include "eflowRec/eflowBaseAlgTool.h" -#include "eflowRec/eflowLCCalibTool.h" -#include "eflowRec/eflowObjectCreatorTool.h" - -#include "FourMomUtils/P4DescendingSorters.h" - -#include "StoreGate/StoreGateSvc.h" - -#include "GaudiKernel/ListItem.h" - -#include <iostream> -using namespace std; - - -eflowObjectBuilder::eflowObjectBuilder(const std::string& name, ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator), - m_eflowClustersOutputName("PFOClusters_JetETMiss"), - m_eflowCaloObjectsName("eflowCaloObjects01"), - m_storeGate(nullptr), - m_tools(this) -{ - /* The following properties can be specified at run-time (declared in jobOptions file) */ - /* Tool configuration */ - declareProperty( "PrivateToolList", m_tools, "List of Private AlgTools" ); - /* Name if eflow cluster container to be created */ - declareProperty("EflowClustersOutputName",m_eflowClustersOutputName); - /* Name of eflow Calo Object to be retrieved */ - declareProperty("EflowCaloObjectsName",m_eflowCaloObjectsName); -} - -eflowObjectBuilder::~eflowObjectBuilder() { } - -StatusCode eflowObjectBuilder::initialize() { - - ATH_MSG_DEBUG("Initialising eflowObjectBuilder "); - - if (service("StoreGateSvc", m_storeGate).isFailure()) { - ATH_MSG_WARNING("Unable to retrieve pointer to StoreGateSvc"); - return StatusCode::SUCCESS; - } - - /* Tool service */ - IToolSvc* myToolSvc; - if ( service("ToolSvc",myToolSvc).isFailure() ) { - ATH_MSG_WARNING(" Tool Service Not Found"); - return StatusCode::SUCCESS; - } - - if ( m_tools.retrieve().isFailure() ) { - ATH_MSG_WARNING("Failed to retrieve " << m_tools); - return StatusCode::SUCCESS; - } else { - ATH_MSG_VERBOSE("Retrieved " << m_tools); - } - - // print the list of tools - taken from JetRec/JetAlgorithm.cxx - printTools(); - - return StatusCode::SUCCESS; -} - -StatusCode eflowObjectBuilder::execute(){ - - msg(MSG::DEBUG) << "Executing eflowObjectBuilder" << endmsg; - StatusCode sc; - - /* Retrieve the eflowCaloObject container, return if not existing */ - const eflowCaloObjectContainer* caloObjectContainer; - sc = m_storeGate->retrieve(caloObjectContainer,m_eflowCaloObjectsName); - if(sc.isFailure() || !caloObjectContainer ){ - msg(MSG::WARNING) <<" no eflow calo object container" <<endmsg; - return StatusCode::SUCCESS; - } - - xAOD::CaloClusterContainer* newCaloClusterContainer = eflowCaloObject::getClusterContainerPtr(); - CHECK( evtStore()->record( newCaloClusterContainer, m_eflowClustersOutputName ) ); - - xAOD::CaloClusterAuxContainer* newCaloClusterAuxContainer = eflowCaloObject::getClusterAuxContainerPtr(); - CHECK( evtStore()->record( newCaloClusterAuxContainer, m_eflowClustersOutputName + "Aux." ) ); - - /* Run the AlgTools - * --> MomentCalculator, LCCalibTool, ObjectCreatorTool */ - ToolHandleArray< eflowBaseAlgTool >::iterator itAlgTool = m_tools.begin(); - ToolHandleArray< eflowBaseAlgTool >::iterator lastAlgTool = m_tools.end(); - for (; itAlgTool != lastAlgTool; ++itAlgTool) { - (*itAlgTool)->execute(const_cast<eflowCaloObjectContainer*>(caloObjectContainer)); - } - - return StatusCode::SUCCESS; - -} - -StatusCode eflowObjectBuilder::finalize() { return StatusCode::SUCCESS; } - -void eflowObjectBuilder::printTools() { - // print the list of tools - taken from JetRec/JetAlgorithm.cxx - ATH_MSG_VERBOSE(" "); - ATH_MSG_VERBOSE("List of tools in execution sequence of eflowObjectBuilder:"); - ATH_MSG_VERBOSE("------------------------------------"); - ATH_MSG_VERBOSE(" "); - ToolHandleArray<eflowBaseAlgTool>::iterator itTool = m_tools.begin(); - ToolHandleArray<eflowBaseAlgTool>::iterator lastTool = m_tools.end(); - unsigned int toolCtr = 0; - for (; itTool != lastTool; itTool++) { - toolCtr++; - ATH_MSG_VERBOSE(std::setw(2) << std::setiosflags(std::ios_base::right) << toolCtr << ".) " - << std::resetiosflags(std::ios_base::right) << std::setw(36) << std::setfill('.') - << std::setiosflags(std::ios_base::left) << (*itTool)->type() << std::setfill('.') - << (*itTool)->name() << std::setfill(' ')); - } - ATH_MSG_VERBOSE(" "); - ATH_MSG_VERBOSE("------------------------------------"); -} diff --git a/Reconstruction/eflowRec/src/eflowObjectCreatorTool.cxx b/Reconstruction/eflowRec/src/eflowObjectCreatorTool.cxx deleted file mode 100644 index 87ca935ae7954424d3f3596cf6327b08e55b3c52..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowObjectCreatorTool.cxx +++ /dev/null @@ -1,501 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/******************************************************************** - -NAME: eflowObjectCreatorTool.h -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: M.Hodgkinson (based on eflowObjectBuilder class written by D.Tovey) -CREATED: 15th August, 2005 - -********************************************************************/ - -#include "eflowRec/eflowObjectCreatorTool.h" -#include "eflowRec/eflowRecTrack.h" -#include "eflowRec/eflowRecCluster.h" -#include "eflowRec/eflowTrackClusterLink.h" -#include "eflowRec/eflowCaloObject.h" - -#include "FourMomUtils/P4DescendingSorters.h" -#include "xAODPFlow/PFO.h" -#include "xAODPFlow/PFOContainer.h" -#include "xAODPFlow/PFOAuxContainer.h" -#include "xAODPFlow/versions/PFOAttributesAccessor_v1.h" - -#include <vector> -#include <iostream> -using namespace std; - -namespace EFlow_Fn{ - // comparison, order by Et - - class gtpt_eflow{ - public: - inline gtpt_eflow() {}; - inline bool operator () (const xAOD::PFO& pf1, const xAOD::PFO& pf2){ - return (pf1.e()/cosh(pf1.eta())) > (pf2.e()/cosh(pf2.eta())); - } - }; - -} - -eflowObjectCreatorTool::eflowObjectCreatorTool(const std::string& type, const std::string& name, const IInterface* parent) : - AthAlgTool(type, name, parent), - m_PFOOutputName("JetETMiss"), - m_chargedPFOContainer(nullptr), - m_neutralPFOContainer(nullptr), - m_neutralPFOContainer_nonModified(nullptr), - m_eOverPMode(false), - m_goldenModeString(""), - m_LCMode(false), - m_trackVertexAssociationTool(""), - m_vertexContainerName("PrimaryVertices"), - m_useAODReductionMomentList(false) -{ - declareInterface<eflowObjectCreatorTool>(this); - /* Name of eflow Container to be created */ - declareProperty("PFOOutputName",m_PFOOutputName); - declareProperty("EOverPMode", m_eOverPMode); - declareProperty("goldenModeString",m_goldenModeString,"run in golden match mode only?"); - declareProperty("LCMode", m_LCMode, "Whether we are in LC or EM mode"); - declareProperty("TrackVertexAssociationTool", m_trackVertexAssociationTool); - declareProperty("UseAODReductionMomentList",m_useAODReductionMomentList); -} - -StatusCode eflowObjectCreatorTool::initialize(){ - - /* tool service */ - IToolSvc* myToolSvc; - if ( service("ToolSvc",myToolSvc).isFailure() ) { - msg(MSG::WARNING) << " Tool Service Not Found" << endmsg; - return StatusCode::SUCCESS; - } - - if(! m_trackVertexAssociationTool.empty() ) { - ATH_MSG_VERBOSE("Intialized using ITrackVertexAssociationTool"); - return m_trackVertexAssociationTool.retrieve(); - } - - return StatusCode::SUCCESS; -} - -StatusCode eflowObjectCreatorTool::execute(eflowCaloObject *energyFlowCaloObject){ - - msg(MSG::DEBUG) << "Executing eflowObjectCreatorTool " << endmsg; - - if (m_eOverPMode){ - /* Loop over charged efos (in practice nClusters currently is either 0 or 1) */ - createChargedEflowObjects(energyFlowCaloObject, true); - createNeutralEflowObjects(energyFlowCaloObject); - } else { - createChargedEflowObjects(energyFlowCaloObject); - createNeutralEflowObjects(energyFlowCaloObject); - } - - const xAOD::VertexContainer* vertexContainer = nullptr; - StatusCode vertexRetrieved = evtStore()->retrieve(vertexContainer,m_vertexContainerName); - if ( vertexRetrieved.isFailure() || vertexContainer==nullptr) { - ATH_MSG_WARNING("Could not retrieve the VertexContainer from evtStore: " << m_vertexContainerName); - } - else{ - addVertexLinksToChargedEflowObjects(vertexContainer); - } - - return StatusCode::SUCCESS; - -} - -void eflowObjectCreatorTool::execute(eflowCaloObjectContainer* theEflowCaloObjectContainer) { - msg(MSG::DEBUG) << "Running eflowObjectCreatorTool on the eflowCaloObjectContainer " << endmsg; - - /* Create PFO containers and register them */ - if( setupPFOContainers().isFailure() ){ - msg(MSG::WARNING) << "Couldn't setup PFO containers. " << endmsg; - return; - } - - /* Create PFOs from all eflowCaloObjects */ - unsigned int nEFCaloObs = theEflowCaloObjectContainer->size(); - for (unsigned int iEFCalOb = 0; iEFCalOb < nEFCaloObs; ++iEFCalOb){ - eflowCaloObject* thisEflowCaloObject = theEflowCaloObjectContainer->at(iEFCalOb); - if (execute(thisEflowCaloObject).isFailure()){ - msg(MSG::WARNING) << "Execute failed for one eflowCaloObject. " << endmsg; - continue; - } - } - - /* Sort clusters and efos by pt TODO: this should be done in eflowObjectCreatorTool */ - //Do we need to sort the objects at all? - //std::sort(theEflowObjectContainer->begin(),theEflowObjectContainer->end(),EFlow_Fn::gtpt_PFO()); -} - -StatusCode eflowObjectCreatorTool::finalize(){ return StatusCode::SUCCESS; } - -StatusCode eflowObjectCreatorTool::setupPFOContainers() { - m_chargedPFOContainer = new xAOD::PFOContainer(); - - xAOD::PFOAuxContainer* chargedPFOAuxContainer = new xAOD::PFOAuxContainer(); - - if (evtStore()->contains<xAOD::PFOContainer>(m_PFOOutputName + "ChargedParticleFlowObjects")){ - CHECK( evtStore()->overwrite( m_chargedPFOContainer, m_PFOOutputName + "ChargedParticleFlowObjects" ) ); - CHECK( evtStore()->overwrite( chargedPFOAuxContainer, m_PFOOutputName + "ChargedParticleFlowObjectsAux." ) ); - } - else{ - CHECK( evtStore()->record( m_chargedPFOContainer, m_PFOOutputName + "ChargedParticleFlowObjects" ) ); - CHECK( evtStore()->record( chargedPFOAuxContainer, m_PFOOutputName + "ChargedParticleFlowObjectsAux." ) ); - } - m_chargedPFOContainer->setStore(chargedPFOAuxContainer); - - m_neutralPFOContainer = new xAOD::PFOContainer(); - xAOD::PFOAuxContainer* neutralPFOAuxContainer = new xAOD::PFOAuxContainer(); - - if (evtStore()->contains<xAOD::PFOContainer>(m_PFOOutputName + "NeutralParticleFlowObjects")){ - CHECK( evtStore()->overwrite( m_neutralPFOContainer, m_PFOOutputName + "NeutralParticleFlowObjects" ) ); - CHECK( evtStore()->overwrite( neutralPFOAuxContainer, m_PFOOutputName + "NeutralParticleFlowObjectsAux." ) ); - } - else{ - CHECK( evtStore()->record( m_neutralPFOContainer, m_PFOOutputName + "NeutralParticleFlowObjects" ) ); - CHECK( evtStore()->record( neutralPFOAuxContainer, m_PFOOutputName + "NeutralParticleFlowObjectsAux." ) ); - } - m_neutralPFOContainer->setStore(neutralPFOAuxContainer); - - if (true == m_LCMode){ - m_neutralPFOContainer_nonModified = new xAOD::PFOContainer(); - xAOD::PFOAuxContainer* neutralPFOAuxContainer_nonModified = new xAOD::PFOAuxContainer(); - if (evtStore()->contains<xAOD::PFOContainer>(m_PFOOutputName + "NonModifiedNeutralParticleFlowObjects" )){ - CHECK( evtStore()->overwrite( m_neutralPFOContainer_nonModified, m_PFOOutputName + "NonModifiedNeutralPFO" ) ); - CHECK( evtStore()->overwrite( neutralPFOAuxContainer_nonModified, m_PFOOutputName + "NonModifiedNeutralParticleFlowObjectsAux." ) ); - } - else{ - CHECK( evtStore()->record( m_neutralPFOContainer_nonModified, m_PFOOutputName + "NonModifiedNeutralParticleFlowObjects" ) ); - CHECK( evtStore()->record( neutralPFOAuxContainer_nonModified, m_PFOOutputName + "NonModifiedNeutralParticleFlowObjectsAux." ) ); - } - m_neutralPFOContainer_nonModified->setStore(neutralPFOAuxContainer_nonModified); - } - return StatusCode::SUCCESS; -} - -void eflowObjectCreatorTool::addVertexLinksToChargedEflowObjects(const xAOD::VertexContainer* theVertexContainer){ - - if (theVertexContainer){ - //This is a loop on all xAOD::PFO with non-zero charge - for (auto theChargedPFO : *m_chargedPFOContainer){ - const xAOD::TrackParticle* theTrack = theChargedPFO->track(0); - if (theTrack){ - ElementLink< xAOD::VertexContainer> theVertexLink = m_trackVertexAssociationTool->getUniqueMatchVertexLink(*theTrack,*theVertexContainer); - bool haveSetLink = theChargedPFO->setVertexLink(theVertexLink); - if (!haveSetLink) msg(MSG::WARNING) << " Could not set vertex link on charged PFO " << endmsg; - }//if valid pointer to xAOD::TrackParticle - } - } - -} - -void eflowObjectCreatorTool::createChargedEflowObjects(eflowCaloObject* energyFlowCaloObject, bool addClusters){ - - /* Loop over all tracks in the eflowCaloObject */ - int nTracks = energyFlowCaloObject->nTracks(); - for (int iTrack = 0; iTrack < nTracks; ++iTrack) { - - eflowRecTrack* efRecTrack = energyFlowCaloObject->efRecTrack(iTrack); - - /* Skip tracks that haven't been subtracted */ - if (false == m_eOverPMode){ - if (!efRecTrack->isSubtracted()){ continue; } - } - - /* Create new xAOD::PFO */ - xAOD::PFO* myEflowObject = new xAOD::PFO(); - m_chargedPFOContainer->push_back(myEflowObject); - - /* Get the track elementLink and add it to the xAOD:PFO */ - ElementLink<xAOD::TrackParticleContainer> theTrackLink = efRecTrack->getTrackElemLink(); - bool isSet = myEflowObject->setTrackLink(theTrackLink); - if (!isSet) { msg(MSG::WARNING) << "Could not set Track B in PFO " << endmsg; } - myEflowObject->setCharge(efRecTrack->getTrack()->charge()); - - std::pair<double,double> etaPhi(0.0,0.0); - - if (m_eOverPMode){ - /* In EOverPMode want charged eflowObjects to have extrapolated eta,phi as coordinates - * (needed for analysis of EOverP Data) */ - etaPhi = efRecTrack->getTrackCaloPoints().getEM2etaPhi(); - - /*add information to xAOD*/ - xAOD::PFODetails::PFOAttributes myAttribute_layerHED = xAOD::PFODetails::PFOAttributes::eflowRec_layerHED; - myEflowObject->setAttribute<int>(myAttribute_layerHED,efRecTrack->getLayerHED() ); - - xAOD::PFODetails::PFOAttributes myAttribute_layerVectorCellOrdering = xAOD::PFODetails::PFOAttributes::eflowRec_layerVectorCellOrdering; - myEflowObject->setAttribute<std::vector<int> >(myAttribute_layerVectorCellOrdering,efRecTrack->getLayerCellOrderVector() ); - - xAOD::PFODetails::PFOAttributes myAttribute_radiusVectorCellOrdering = xAOD::PFODetails::PFOAttributes::eflowRec_radiusVectorCellOrdering; - myEflowObject->setAttribute<std::vector<float> >(myAttribute_radiusVectorCellOrdering,efRecTrack->getRadiusCellOrderVector() ); - - xAOD::PFODetails::PFOAttributes myAttribute_avgEdensityVectorCellOrdering = xAOD::PFODetails::PFOAttributes::eflowRec_avgEdensityVectorCellOrdering; - myEflowObject->setAttribute<std::vector<float> >(myAttribute_avgEdensityVectorCellOrdering,efRecTrack->getAvgEDensityCellOrderVector() ); - } else { - /* In normal mode we want te track eta,phi at the perigee */ - etaPhi.first = efRecTrack->getTrack()->eta(); - etaPhi.second = efRecTrack->getTrack()->phi(); - } - /* Set the 4-vector of the xAOD::PFO */ - myEflowObject->setP4(efRecTrack->getTrack()->pt(), etaPhi.first, etaPhi.second, efRecTrack->getTrack()->m()); - - ATH_MSG_DEBUG("Created charged PFO with E, pt, eta and phi of " << myEflowObject->e() << ", " << myEflowObject->pt() << ", " << myEflowObject->eta() << " and " << myEflowObject->phi()); - - /* Add the amount of energy the track was expected to deposit in the calorimeter - this is needed to calculate the charged weight in the jet finding */ - xAOD::PFODetails::PFOAttributes myAttribute_tracksExpectedEnergyDeposit = xAOD::PFODetails::PFOAttributes::eflowRec_tracksExpectedEnergyDeposit; - myEflowObject->setAttribute<float>(myAttribute_tracksExpectedEnergyDeposit,efRecTrack->getEExpect() ); - - /* Flag if this track was in a dense environment for later checking */ - xAOD::PFODetails::PFOAttributes myAttribute_isInDenseEnvironment = xAOD::PFODetails::PFOAttributes::eflowRec_isInDenseEnvironment; - //There is some issue using bools - when written to disk they convert to chars. So lets store the bool as an int. - myEflowObject->setAttribute<int>(myAttribute_isInDenseEnvironment, (efRecTrack->isInDenseEnvironment())); - - /* Optionally we add the links to clusters to the xAOD::PFO */ - if (true == addClusters){ - unsigned int nClusters = energyFlowCaloObject->nClusters(); - for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster){ - eflowRecCluster* thisEfRecCluster = energyFlowCaloObject->efRecCluster(iCluster); - ElementLink<xAOD::CaloClusterContainer> theClusLink = thisEfRecCluster->getClusElementLink(); - bool isSet = myEflowObject->addClusterLink(theClusLink); - if (!isSet) msg(MSG::WARNING) << "Could not set Cluster in PFO " << endmsg; - }//cluster loop - }//addClusters is set to true - so we added the clusters to the xAOD::PFO - - }//loop over the tracks on the - -} - -void eflowObjectCreatorTool::createNeutralEflowObjects(eflowCaloObject* energyFlowCaloObject) { - unsigned int nClusters = energyFlowCaloObject->nClusters(); - for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster){ - eflowRecCluster* thisEfRecCluster = energyFlowCaloObject->efRecCluster(iCluster); - - /* Skip empty clusters (presumably subtraction remnants) */ - const CaloClusterCellLink* theCellLink = energyFlowCaloObject->efRecCluster(iCluster)->getCluster()->getCellLinks(); - CaloClusterCellLink::const_iterator it=theCellLink->begin(); - CaloClusterCellLink::const_iterator it_e=theCellLink->end(); - if (it == it_e) { - continue; - } - //this vetoes rare examples where only two cells are left, and they have equal and opposite energy - if (0.0 == energyFlowCaloObject->efRecCluster(iCluster)->getCluster()->e() ) continue; - - /* Create the efo, add the cluster and set the four-momentum, charge and type */ - - xAOD::PFO* thisEflowObject = new xAOD::PFO(); - if (m_LCMode) { - if (thisEfRecCluster->isTouchable()) { - m_neutralPFOContainer->push_back(thisEflowObject); - } else { - m_neutralPFOContainer_nonModified->push_back(thisEflowObject); - } - } else { - m_neutralPFOContainer->push_back(thisEflowObject); - } - - ElementLink<xAOD::CaloClusterContainer> theClusterLink = thisEfRecCluster->getClusElementLink(); - bool isSet = thisEflowObject->setClusterLink(theClusterLink); - if (!isSet) { msg(MSG::WARNING) << "Could not set Cluster in PFO " << endmsg; } - - const xAOD::CaloCluster* cluster = thisEfRecCluster->getCluster(); - //be careful here - cluster p4 methods do not store sign. Thus -ve energy clusters have +ve pt and hence +ve energy - if (!m_LCMode) { - //in EM->EM/LC mode we use eta,phi at EM scale for both 4-vectors - thisEflowObject->setP4(cluster->pt(), cluster->rawEta(), cluster->rawPhi(), cluster->m()); - thisEflowObject->setP4EM(cluster->rawE()/cosh(cluster->rawEta()), cluster->rawEta(),cluster->rawPhi(),cluster->rawM()); - } - else{ - //in LC-> mode we use the LC 4-vector for the LC scale - thisEflowObject->setP4(cluster->pt(), cluster->eta(), cluster->phi(), cluster->m()); - //we cannot access geometric weights for LC clusters, so we make an approximation of the EM energy by looping over the calocells - //Then the EM 4-vector uses the energy/pt at this EM scale + eta,phi from LC 4-vector - const CaloClusterCellLink* theCellLink = cluster->getCellLinks(); - auto theFirstCell = theCellLink->begin(); - auto theLastCell = theCellLink->end(); - float emPt = 0.0; - for (; theFirstCell != theLastCell; ++theFirstCell){ - const CaloCell* thisCell = *theFirstCell; - emPt += thisCell->e()/cosh(thisCell->eta()); - } - thisEflowObject->setP4EM(emPt,cluster->eta(),cluster->phi(),0.0);//mass is always zero at EM scale - - } - - ATH_MSG_DEBUG("Created neutral PFO with E, pt, eta and phi of " << thisEflowObject->e() << ", " << thisEflowObject->pt() << ", " << thisEflowObject->eta() << " and " << thisEflowObject->phi()); - - thisEflowObject->setCharge(0); - - //now set the moments for touchable clusters (i.e. ones we modify) in LC mode or all clusters in EM mode - if ( (m_LCMode && thisEfRecCluster->isTouchable()) || !m_LCMode) { - this->addMoment(xAOD::CaloCluster::SECOND_R,xAOD::PFODetails::PFOAttributes::eflowRec_SECOND_R,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::CENTER_LAMBDA,xAOD::PFODetails::PFOAttributes::eflowRec_CENTER_LAMBDA,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::ENG_BAD_CELLS,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_BAD_CELLS,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::N_BAD_CELLS,xAOD::PFODetails::PFOAttributes::eflowRec_N_BAD_CELLS,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::BADLARQ_FRAC,xAOD::PFODetails::PFOAttributes::eflowRec_BADLARQ_FRAC,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::ENG_POS,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_POS,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::AVG_LAR_Q,xAOD::PFODetails::PFOAttributes::eflowRec_AVG_LAR_Q,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::AVG_TILE_Q,xAOD::PFODetails::PFOAttributes::eflowRec_AVG_TILE_Q,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::ISOLATION,xAOD::PFODetails::PFOAttributes::eflowRec_ISOLATION,cluster, thisEflowObject); - - if (false == m_useAODReductionMomentList){ - this->addMoment(xAOD::CaloCluster::LATERAL,xAOD::PFODetails::PFOAttributes::eflowRec_LATERAL,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::LONGITUDINAL,xAOD::PFODetails::PFOAttributes::eflowRec_LONGITUDINAL,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::FIRST_ENG_DENS,xAOD::PFODetails::PFOAttributes::eflowRec_FIRST_ENG_DENS,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::ENG_FRAC_MAX,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_FRAC_MAX,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::SIGNIFICANCE,xAOD::PFODetails::PFOAttributes::eflowRec_SIGNIFICANCE,cluster, thisEflowObject); - } - if (true == m_useAODReductionMomentList){ - this->addMoment(xAOD::CaloCluster::SECOND_LAMBDA,xAOD::PFODetails::PFOAttributes::eflowRec_SECOND_LAMBDA,cluster, thisEflowObject); - this->addMoment(xAOD::CaloCluster::EM_PROBABILITY,xAOD::PFODetails::PFOAttributes::eflowRec_EM_PROBABILITY,cluster, thisEflowObject); - } - - } - - //First set all the layer energies - float layerEnergy_preSamplerB = cluster->eSample(xAOD::CaloCluster::CaloSample::PreSamplerB); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_PreSamplerB = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_PreSamplerB; - thisEflowObject->setAttribute( myAttribute_layerEnergy_PreSamplerB, layerEnergy_preSamplerB); - - float layerEnergy_EMB1 = cluster->eSample(xAOD::CaloCluster::CaloSample::EMB1); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EMB1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EMB1; - thisEflowObject->setAttribute( myAttribute_layerEnergy_EMB1, layerEnergy_EMB1); - - float layerEnergy_EMB2 = cluster->eSample(xAOD::CaloCluster::CaloSample::EMB2); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EMB2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EMB2; - thisEflowObject->setAttribute( myAttribute_layerEnergy_EMB2, layerEnergy_EMB2); - - float layerEnergy_EMB3 = cluster->eSample(xAOD::CaloCluster::CaloSample::EMB3); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EMB3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EMB3; - thisEflowObject->setAttribute( myAttribute_layerEnergy_EMB3, layerEnergy_EMB3); - - float layerEnergy_preSamplerE = cluster->eSample(xAOD::CaloCluster::CaloSample::PreSamplerE); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_PreSamplerE = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_PreSamplerE; - thisEflowObject->setAttribute( myAttribute_layerEnergy_PreSamplerE, layerEnergy_preSamplerE); - - float layerEnergy_EME1 = cluster->eSample(xAOD::CaloCluster::CaloSample::EME1); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EME1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EME1; - thisEflowObject->setAttribute( myAttribute_layerEnergy_EME1, layerEnergy_EME1); - - float layerEnergy_EME2 = cluster->eSample(xAOD::CaloCluster::CaloSample::EME2); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EME2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EME2; - thisEflowObject->setAttribute( myAttribute_layerEnergy_EME2, layerEnergy_EME2); - - float layerEnergy_EME3 = cluster->eSample(xAOD::CaloCluster::CaloSample::EME3); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EME3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EME3; - thisEflowObject->setAttribute( myAttribute_layerEnergy_EME3, layerEnergy_EME3); - - float layerEnergy_HEC0 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC0); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC0; - thisEflowObject->setAttribute( myAttribute_layerEnergy_HEC0, layerEnergy_HEC0); - - float layerEnergy_HEC1 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC1); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC1; - thisEflowObject->setAttribute( myAttribute_layerEnergy_HEC1, layerEnergy_HEC1); - - float layerEnergy_HEC2 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC2); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC2; - thisEflowObject->setAttribute( myAttribute_layerEnergy_HEC2, layerEnergy_HEC2); - - float layerEnergy_HEC3 = cluster->eSample(xAOD::CaloCluster::CaloSample::HEC3); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC3; - thisEflowObject->setAttribute( myAttribute_layerEnergy_HEC3, layerEnergy_HEC3); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileBar0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileBar0; - thisEflowObject->setAttribute( myAttribute_layerEnergy_TileBar0, cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar0)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileBar1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileBar1; - thisEflowObject->setAttribute( myAttribute_layerEnergy_TileBar1, cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar1)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileBar2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileBar2; - thisEflowObject->setAttribute( myAttribute_layerEnergy_TileBar2, cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar2)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileGap1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileGap1; - thisEflowObject->setAttribute( myAttribute_layerEnergy_TileGap1, cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap1)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileGap2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileGap2; - thisEflowObject->setAttribute( myAttribute_layerEnergy_TileGap2, cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap2)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileGap3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileGap3; - thisEflowObject->setAttribute( myAttribute_layerEnergy_TileGap3, cluster->eSample(xAOD::CaloCluster::CaloSample::TileGap3)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileExt0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileExt0; - thisEflowObject->setAttribute( myAttribute_layerEnergy_TileExt0, cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt0)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileExt1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileExt1; - thisEflowObject->setAttribute( myAttribute_layerEnergy_TileExt1, cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt1)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_TileExt2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_TileExt2; - thisEflowObject->setAttribute( myAttribute_layerEnergy_TileExt2, cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt2)); - - float layerEnergy_FCAL0 = cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL0); - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_FCAL0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_FCAL0; - thisEflowObject->setAttribute( myAttribute_layerEnergy_FCAL0, layerEnergy_FCAL0); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_FCAL1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_FCAL1; - thisEflowObject->setAttribute( myAttribute_layerEnergy_FCAL1, cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL1)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_FCAL2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_FCAL2; - thisEflowObject->setAttribute( myAttribute_layerEnergy_FCAL2, cluster->eSample(xAOD::CaloCluster::CaloSample::FCAL2)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL0; - thisEflowObject->setAttribute( myAttribute_layerEnergy_MINIFCAL0, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL0)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL1 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL1; - thisEflowObject->setAttribute( myAttribute_layerEnergy_MINIFCAL1, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL1)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL2 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL2; - thisEflowObject->setAttribute( myAttribute_layerEnergy_MINIFCAL2, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL2)); - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_MINIFCAL3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_MINIFCAL3; - thisEflowObject->setAttribute( myAttribute_layerEnergy_MINIFCAL3, cluster->eSample(xAOD::CaloCluster::CaloSample::MINIFCAL3)); - - //now set the layer energies for EMB3 and Tile0 - these are needed if we want to run a GSC style jet calibration, which is binned in EMB3 and Tile0 layer energies - - float layerEnergy_EM3 = layerEnergy_EMB3 + layerEnergy_EME3; - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EM3 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EM3; - thisEflowObject->setAttribute( myAttribute_layerEnergy_EM3, layerEnergy_EM3); - - float layerEnergy_TileBar0 = cluster->eSample(xAOD::CaloCluster::CaloSample::TileBar0); - float layerEnergy_TileExt0 = cluster->eSample(xAOD::CaloCluster::CaloSample::TileExt0); - float layerEnergy_Tile0 = layerEnergy_TileBar0 + layerEnergy_TileExt0; - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_Tile0 = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_Tile0; - thisEflowObject->setAttribute(myAttribute_layerEnergy_Tile0, layerEnergy_Tile0); - - //now set properties that are required for jet cleaning - float layerEnergy_HEC = layerEnergy_HEC0 + layerEnergy_HEC1 + layerEnergy_HEC2 + layerEnergy_HEC3; - - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_HEC = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_HEC; - thisEflowObject->setAttribute(myAttribute_layerEnergy_HEC, layerEnergy_HEC); - - float layerEnergy_EM = layerEnergy_preSamplerB + layerEnergy_preSamplerE + layerEnergy_EMB1 + layerEnergy_EMB2 + layerEnergy_EMB3 + layerEnergy_EME1 + layerEnergy_EME2 + layerEnergy_EME3 + layerEnergy_FCAL0; - xAOD::PFODetails::PFOAttributes myAttribute_layerEnergy_EM = xAOD::PFODetails::PFOAttributes::eflowRec_LAYERENERGY_EM; - thisEflowObject->setAttribute(myAttribute_layerEnergy_EM, layerEnergy_EM); - - float clusterTiming = cluster->time(); - - xAOD::PFODetails::PFOAttributes myAttribute_TIMING = xAOD::PFODetails::PFOAttributes::eflowRec_TIMING; - thisEflowObject->setAttribute(myAttribute_TIMING, clusterTiming); - - //if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Created neutral EFO with E, eta and phi of " << thisEflowObject->e() << ", " << thisEflowObject->eta() << " and " << thisEflowObject->phi() << std::endl; - - } -} - -void eflowObjectCreatorTool::addMoment(xAOD::CaloCluster::MomentType momentType, xAOD::PFODetails::PFOAttributes pfoAttribute, const xAOD::CaloCluster* theCluster, xAOD::PFO* thePFO){ - - double moment = 0.0; - bool isRetrieved = theCluster->retrieveMoment(momentType, moment); - if (true == isRetrieved) { - xAOD::PFODetails::PFOAttributes myAttribute = pfoAttribute; - float float_moment = static_cast<float>(moment); - thePFO->setAttribute(myAttribute, float_moment); - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Could not retrieve moment from the CaloCluster " << endmsg; - -} diff --git a/Reconstruction/eflowRec/src/eflowPreparation.cxx b/Reconstruction/eflowRec/src/eflowPreparation.cxx deleted file mode 100644 index db545541a3d3aae6bccd94ace30743006be946f4..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowPreparation.cxx +++ /dev/null @@ -1,559 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/******************************************************************** - -NAME: eflowPreparation.cxx -PACKAGE: offline/Reconstruction/eflowRec - -AUTHORS: D.R. Tovey -CREATED: 8th November, 2001 - -********************************************************************/ - -#include "eflowRec/eflowUtil.h" - -// INCLUDE HEADER FILES: - -#include "eflowRec/eflowPreparation.h" -#include "eflowRec/eflowRecTrack.h" -#include "eflowRec/eflowRecCluster.h" -#include "eflowRec/eflowTrackClusterLink.h" -#include "eflowRec/eflowTrackCaloPoints.h" -#include "eflowRec/eflowRingSubtractionManager.h" -#include "eflowRec/eflowEEtaBinnedParameters.h" -#include "eflowRec/eflowLayerIntegrator.h" -#include "eflowRec/PFTrackClusterMatchingTool.h" - -#include "eflowRec/eflowCaloObject.h" -#include "eflowRec/eflowTrackExtrapolatorBaseAlgTool.h" - -#include "CaloEvent/CaloClusterContainer.h" -#include "CaloEvent/CaloCluster.h" -#include "CaloEvent/CaloCellLink.h" -#include "CaloDetDescr/CaloDetDescrManager.h" -#include "CaloIdentifier/CaloCell_ID.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "xAODCaloEvent/CaloClusterAuxContainer.h" - -#include "Particle/TrackParticle.h" -#include "xAODMuon/Muon.h" -#include "xAODEgamma/ElectronxAODHelpers.h" - -// INCLUDE GAUDI HEADER FILES: -#include "GaudiKernel/SystemOfUnits.h" -#include "GaudiKernel/Property.h" -#include "GaudiKernel/ListItem.h" - -#include <algorithm> -#include <math.h> -#include <map> -#include <iostream> - -// END OF HEADER FILES INCLUDE - -// CONSTRUCTOR: - -eflowPreparation::eflowPreparation(const std::string& name, ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator), - m_caloClusterReadHandle("CaloTopoCluster"), - m_caloCalClusterReadHandle("CaloCalTopoCluster"), - m_trackReadHandle("InDetTrackParticles"), - m_electronReadHandle("Electrons"), - m_muonReadHandle("Muons"), - m_eflowCaloObjectContainerWriteHandle("eflowCaloObjects01"), - m_eflowRecTrackContainerWriteHandle("eflowRecTracks01"), - m_eflowRecClusterContainerWriteHandle("eflowRecClusters01"), - m_theTrackExtrapolatorTool("Trk::ParticleCaloExtensionTool",this), - m_matchingTool("PFTrackClusterMatchingTool/CalObjBldMatchingTool", this), - m_eflowMode("FullMode"), - m_selectedElectronsWriteHandle("eflowRec_selectedElectrons_EM"), - m_leptonCaloCellContainerWriteHandle("eflowRec_leptonCellContainer_EM"), - m_useLeptons(true), - m_storeLeptonCells(false), - m_nMatches(0), - m_upperTrackPtCut(100.0) -{ -// The following properties can be specified at run-time -// (declared in jobOptions file) - declareProperty("ClustersName",m_caloClusterReadHandle ); - declareProperty("CalClustersName",m_caloCalClusterReadHandle ); - declareProperty("TracksName", m_trackReadHandle); - declareProperty("EflowCaloObjectsOutputName", m_eflowCaloObjectContainerWriteHandle ); - declareProperty("EflowRecTracksOutputName", m_eflowRecTrackContainerWriteHandle); - declareProperty("EflowRecClustersOutputName", m_eflowRecClusterContainerWriteHandle); - declareProperty("PFTrackClusterMatchingTool", m_matchingTool, "The track-cluster matching tool"); - declareProperty("TrackExtrapolatorTool", m_theTrackExtrapolatorTool, "AlgTool to use for track extrapolation"); - declareProperty("EFlowMode", m_eflowMode); - declareProperty("electronsName", m_electronReadHandle); - declareProperty("muonsName", m_muonReadHandle); - declareProperty("useLeptons", m_useLeptons); - declareProperty("storeLeptonCells", m_storeLeptonCells); - declareProperty("eflowElectronsName", m_selectedElectronsWriteHandle); - declareProperty("eflowLeptonCellsName", m_leptonCaloCellContainerWriteHandle); - declareProperty("TrackSelectionTool", m_selTool); - declareProperty("UpperTrackPtCut",m_upperTrackPtCut); -} - -eflowPreparation::~eflowPreparation() { } - -StatusCode eflowPreparation::initialize() { - - StatusCode sc; - - // tool service - IToolSvc* myToolSvc; - sc = service("ToolSvc", myToolSvc); - - if (sc.isFailure()) { - msg(MSG::WARNING) << " Tool Service Not Found" << endmsg; - return StatusCode::SUCCESS; - } - - if (m_matchingTool.retrieve().isFailure()) { - msg(MSG::WARNING) << "Cannot find PFTrackClusterMatchingTool" << endmsg; - } - - sc = m_theTrackExtrapolatorTool.retrieve(); - - if (sc.isFailure()) { - msg(MSG::WARNING) << "Cannot find eflowTrackToCaloExtrapolatroTool " << endmsg; - return StatusCode::SUCCESS; - } - - if (m_useLeptons) m_selectedMuons = std::make_unique<xAOD::MuonContainer>(SG::VIEW_ELEMENTS); - - ATH_CHECK(m_selTool.retrieve()); - - return sc; -} - -StatusCode eflowPreparation::finalize() { - - ATH_MSG_INFO("Produced " << m_nMatches << " track-cluster matches."); - - return StatusCode::SUCCESS; - -} - -StatusCode eflowPreparation::execute() { - - if (m_useLeptons) this->clearContainers(); - - StatusCode sc; - - /* Create the eflowCaloObjectContainer and register it */ - - - sc = m_eflowCaloObjectContainerWriteHandle.record(std::make_unique<eflowCaloObjectContainer>()); - - if (sc.isFailure()) { - if (msgLvl(MSG::WARNING)) { - msg(MSG::WARNING) << "Could not record eflowCaloObjectContainer in TDS" << endmsg; - } - return StatusCode::SUCCESS; - } - - /* Create the eflowRecTrackContainer and register it */ - sc = m_eflowRecTrackContainerWriteHandle.record(std::make_unique<eflowRecTrackContainer>()); - - if (sc.isFailure()) { - if (msgLvl(MSG::WARNING)) { - msg(MSG::WARNING) << "Could not record eflowRecTrackContainer in TDS" << endmsg; - } - return StatusCode::SUCCESS; - } - - /* Create the eflowRecClusterContainer and register it */ - - sc = m_eflowRecClusterContainerWriteHandle.record(std::make_unique<eflowRecClusterContainer>()); - - if (sc.isFailure()) { - if (msgLvl(MSG::WARNING)) { - msg(MSG::WARNING) << "Could not record eflowRecClusterContainer in TDS" << endmsg; - } - return StatusCode::SUCCESS; - } - - if (m_useLeptons) { - - /* Put electron container and list of lepton cells into Storegate - By contrast muons do NOT go into storegate, because they are not needed downstream */ - if (recordLeptonContainers().isFailure()) { - return StatusCode::SUCCESS; - } - - /* Select some electrons */ - sc = this->selectElectrons(); - if (sc.isFailure()) { - //won't mask out the tracks, but issue WARNING - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Did not select any electrons " << endmsg; - } - - /* Select some muons */ - sc = this->selectMuons(); - if (sc.isFailure()) { - //won't mask out the tracks, but issue WARNING - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Did not select any muons " << endmsg; - } - } - - /* Create eflowCaloObject static calo cluster container */ - eflowCaloObject::setClusterContainerPtr(new xAOD::CaloClusterContainer(), new xAOD::CaloClusterAuxContainer()); - - /* Collect all calo clusters from all cluster containers to m_eflowRecClusterContainerWriteHandle */ - if (makeClusterContainer().isFailure()) { - return StatusCode::SUCCESS; - } - - /* Apply the track selection, extrapolate, and collect selected tracks to m_eflowRecTrackContainerWriteHandle */ - if (makeTrackContainer().isFailure()) { - return StatusCode::SUCCESS; - } - - return StatusCode::SUCCESS; -} - -///////////////////////////////////////////////////////////////// -void eflowPreparation::retrieveLCCalCellWeight(double energy, unsigned index, std::map<IdentifierHash,double>& cellsWeight) { - - /* match CaloCluster with CaloCalCluster to obtain cell weight */ - /* first try the position at 'index'. If we are lucky, the loop can be avoided. */ - /* Note the read handle has been tested to be valid prior to the call of this function */ - const xAOD::CaloCluster* matchedCalCluster = m_caloCalClusterReadHandle->at(index); - if (!(fabs(energy - matchedCalCluster->rawE()) < 0.001)) { - matchedCalCluster = nullptr; - for (unsigned iCalCalCluster = 0; iCalCalCluster < m_caloCalClusterReadHandle->size(); - ++iCalCalCluster) { - matchedCalCluster = m_caloCalClusterReadHandle->at(iCalCalCluster); - if (fabs(energy - matchedCalCluster->rawE()) < 0.001) { - break; - } - } - } - assert (matchedCalCluster); - - /* obtain cell index and cell weight */ - const CaloDetDescrManager* calo_dd_man = CaloDetDescrManager::instance(); - const CaloCell_ID* calo_id = calo_dd_man->getCaloCell_ID(); - xAOD::CaloCluster::const_cell_iterator itCell = matchedCalCluster->cell_begin(); - xAOD::CaloCluster::const_cell_iterator endCell = matchedCalCluster->cell_end(); - for (; itCell != endCell; ++itCell) { - const CaloCell* pCell = *itCell; - Identifier myId = pCell->ID(); - IdentifierHash myHashId = calo_id->calo_cell_hash(myId); - cellsWeight[myHashId] = itCell.weight(); - } - - return ; -} - -StatusCode eflowPreparation::makeClusterContainer() { - - /* Verify the read handle has a valid pointer, and if not return */ - if (!m_caloClusterReadHandle.isValid()){ - msg(MSG::WARNING) << " Can not retrieve xAOD::CaloClusterContainer with name: " << m_caloClusterReadHandle.key() << endmsg; - return StatusCode::SUCCESS; - } - - /* Fill the vector of eflowRecClusters */ - unsigned int nClusters = m_caloClusterReadHandle->size(); - for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) { - /* Create the eflowRecCluster and put it in the container */ - std::unique_ptr<eflowRecCluster> thisEFRecCluster = std::make_unique<eflowRecCluster>(ElementLink<xAOD::CaloClusterContainer>(*m_caloClusterReadHandle, iCluster)); - - if (m_caloCalClusterReadHandle.isValid()){ - std::map<IdentifierHash,double> cellsWeightMap; - retrieveLCCalCellWeight(m_caloClusterReadHandle->at(iCluster)->e(), iCluster, cellsWeightMap); - - if (msgLvl(MSG::DEBUG)) { - //zhangr - std::map<IdentifierHash, double>::iterator it = cellsWeightMap.begin(); - for (; it != cellsWeightMap.end(); ++it) { - msg(MSG::DEBUG) << "zhangrui eflowPreparation " << iCluster << "/" << nClusters << ": e=" - << m_caloClusterReadHandle->at(iCluster)->e() << " (" << it->first << " " - << it->second << ")" << endmsg; - } - } - - thisEFRecCluster->setCellsWeight(cellsWeightMap); - } - thisEFRecCluster->setClusterId(iCluster); - m_eflowRecClusterContainerWriteHandle->push_back(std::move(thisEFRecCluster)); - - if (msgLvl(MSG::DEBUG)) { - const xAOD::CaloCluster* thisCluster = m_caloClusterReadHandle->at(iCluster); - msg(MSG::DEBUG) << "eflowPreparation clus = " << thisCluster->eta() << " " - << thisCluster->phi() << " " << thisCluster->e()/cosh(thisCluster->eta()) << " " << endmsg; - } - } - - return StatusCode::SUCCESS; -} - -StatusCode eflowPreparation::makeTrackContainer() { - - /* Verify the read handle has a valid pointer, and if not return */ - if (!m_trackReadHandle.isValid()){ - if (msgLvl(MSG::WARNING)) { msg(MSG::WARNING) << "Can not retrieve xAOD::TrackParticleContainer with name: " << m_trackReadHandle.key() << endmsg; } - return StatusCode::FAILURE; - } - - /* Do the track selection for tracks to be used in all of the following steps: */ - /* TODO (tuning): Check if resize(0) might be faster than clear() */ - xAOD::TrackParticleContainer::const_iterator itTrackParticle = m_trackReadHandle->begin(); - int trackIndex = 0; - for (; itTrackParticle != m_trackReadHandle->end(); ++itTrackParticle, ++trackIndex) { - const xAOD::TrackParticle* track = (*itTrackParticle); - if (!track) continue; // TODO: Print a WARNING here! - - ATH_MSG_DEBUG("Have track with E, pt, eta and phi of " << track->e() << ", " << track->pt() << ", " << track->eta() << " and " << track->phi()); - - bool rejectTrack((m_eflowMode == "FullMode") && !selectTrack(track)); - - if (m_useLeptons) { - bool isElectron = this->isElectron(track); - bool isMuon = this->isMuon(track); - ATH_MSG_DEBUG("isElectron is " << isElectron << " and isMuon is " << isMuon); - if (true == isElectron || true == isMuon) rejectTrack = true; - } - - ATH_MSG_DEBUG("rejectTrack is " << rejectTrack); - - if (!rejectTrack) { - /* Create the eflowRecCluster and put it in the container */ - std::unique_ptr<eflowRecTrack> thisEFRecTrack = std::make_unique<eflowRecTrack>(ElementLink<xAOD::TrackParticleContainer>(*m_trackReadHandle, trackIndex), m_theTrackExtrapolatorTool); - thisEFRecTrack->setTrackId(trackIndex); - m_eflowRecTrackContainerWriteHandle->push_back(std::move(thisEFRecTrack)); - } - } - - std::sort(m_eflowRecTrackContainerWriteHandle->begin(), m_eflowRecTrackContainerWriteHandle->end(), eflowRecTrack::SortDescendingPt()); - - return StatusCode::SUCCESS; -} - -bool eflowPreparation::selectTrack(const xAOD::TrackParticle* track) { - if (track->pt()*0.001 < m_upperTrackPtCut) return m_selTool->accept(*track, track->vertex()); - else return false; -} - - -StatusCode eflowPreparation::recordLeptonContainers(){ - - StatusCode sc = m_selectedElectronsWriteHandle.record(std::make_unique<xAOD::ElectronContainer>(SG::VIEW_ELEMENTS)); - - if (sc.isFailure()) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) - << "Could not record egammaContainer in TDS" - << endmsg; - return sc; - } - - if (true == m_storeLeptonCells) { - - //record the cell container - sc = m_leptonCaloCellContainerWriteHandle.record(std::make_unique<ConstDataVector<CaloCellContainer> >(SG::VIEW_ELEMENTS)); - - if (sc.isFailure()) { - if (msgLvl(MSG::WARNING)) - msg(MSG::WARNING) << "Could not record eflowRec LeptonCellContainer in TDS" << endmsg; - return sc; - } - } - - return StatusCode::SUCCESS; - -} - -StatusCode eflowPreparation::selectMuons() { - - const xAOD::MuonContainer* muonContainer = m_muonReadHandle.cptr(); - - if (!muonContainer) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " No xAOD Muon container found in TDS with the name " << m_muonReadHandle.key() << endmsg; - return StatusCode::FAILURE; - } - - xAOD::MuonContainer::const_iterator firstMuon = muonContainer->begin(); - xAOD::MuonContainer::const_iterator lastMuon = muonContainer->end(); - - for (; firstMuon != lastMuon; ++firstMuon) { - const xAOD::Muon* theMuon = *firstMuon; - - //Details of medium muons are here: - //https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionTool - //No need to ask for combined muon, by construction other muons will not have ID track - we just ask for medium muons - - xAOD::Muon::Quality muonQuality = theMuon->quality(); - if( muonQuality <= xAOD::Muon::Medium) { - if (nullptr != m_selectedMuons.get()){ - m_selectedMuons->push_back(const_cast<xAOD::Muon*>(theMuon)); - } else if (msgLvl(MSG::WARNING)) { - msg(MSG::WARNING) << " Invalid pointer to m_selectedMuons in selectMuons " << std::endl; - } - if (true == m_storeLeptonCells) this->storeMuonCells(theMuon); - }//Medium muons - } //muon loop - - return StatusCode::SUCCESS; -} - -bool eflowPreparation::isMuon(const xAOD::TrackParticle* track){ - - if (m_selectedMuons){ - - xAOD::MuonContainer::const_iterator firstMuon = m_selectedMuons->begin(); - xAOD::MuonContainer::const_iterator lastMuon = m_selectedMuons->end(); - - for (; firstMuon != lastMuon ; ++firstMuon){ - const xAOD::Muon* theMuon = *firstMuon; - if (theMuon){ - ATH_MSG_DEBUG("Considering muon in isMuon with e,pt, eta and phi of " << theMuon->e() << ", " << theMuon->pt() << ", " << theMuon->eta() << " and " << theMuon->phi()); - const ElementLink< xAOD::TrackParticleContainer > theLink = theMuon->inDetTrackParticleLink(); - if (theLink.isValid()){ - const xAOD::TrackParticle* ID_track = *theLink; - if (ID_track){ - if (track == ID_track) return true; - return false; - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "This muon has a NULL pointer to the track " << endmsg; - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "This muon has an invalid link to the track " << endmsg; - }//if muon pointer is valid - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "This muon is a NULL pointer " << endmsg; - }//muon loop - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Invalid pointer to m_selectedMuons in isMuon " << std::endl; - - return false; -} - - -void eflowPreparation::storeMuonCells(const xAOD::Muon* muon){ - - const ElementLink<xAOD::CaloClusterContainer> theLink = muon->clusterLink(); - if (theLink.isValid()){ - const xAOD::CaloCluster* muonCluster = *theLink; - if (muonCluster){ - this->storeLeptonCells(muonCluster); - const CaloClusterCellLink* theCellLink = muonCluster->getCellLinks(); - CaloClusterCellLink::const_iterator firstCell = theCellLink->begin(); - CaloClusterCellLink::const_iterator lastCell = theCellLink->end(); - - for (; firstCell != lastCell; ++firstCell){ - }//cell loop - - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "This muon has an invalid pointer to its cluster " << endmsg; - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "This muon has an invalid element link to its cluster " << endmsg; - -} - - -StatusCode eflowPreparation::selectElectrons(){ - - - const xAOD::ElectronContainer* egammaContainer = m_electronReadHandle.cptr(); - if (!egammaContainer){ - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " No Electron container found in TDS" << endmsg; - return StatusCode::FAILURE; - } - - xAOD::ElectronContainer::const_iterator firstElectron = egammaContainer->begin(); - xAOD::ElectronContainer::const_iterator lastElectron = egammaContainer->end(); - - for (; firstElectron != lastElectron; ++firstElectron){ - - const xAOD::Electron* theElectron = *firstElectron; - if (theElectron){ - if (theElectron->pt() > 10000){ - bool val_med = false; - bool gotID = theElectron->passSelection(val_med, "LHMedium"); - if (!gotID) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Could not get Electron ID " << endmsg; - continue; - } - if (true == val_med){ - if (m_selectedElectronsWriteHandle.isValid()) m_selectedElectronsWriteHandle->push_back(const_cast<xAOD::Electron*>(theElectron)); - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Do not have valid WriteHandle for ElectronContainer with name: " << m_selectedElectronsWriteHandle.key() << endmsg; - if (true == m_storeLeptonCells) this->storeElectronCells(theElectron); - }//mediumPP - }//10GeV pt cut - }//valid egamma pointer - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "This electron is a NULL pointer " << endmsg; - - }//electron loop - - return StatusCode::SUCCESS; - -} - -bool eflowPreparation::isElectron(const xAOD::TrackParticle* track){ - - if (m_selectedElectronsWriteHandle.isValid()){ - - xAOD::ElectronContainer::iterator firstElectron = m_selectedElectronsWriteHandle->begin(); - xAOD::ElectronContainer::iterator lastElectron = m_selectedElectronsWriteHandle->end(); - - for (; firstElectron != lastElectron; ++firstElectron){ - const xAOD::Electron* this_egamma = *firstElectron; - if (this_egamma){ - unsigned int nTrack = this_egamma->nTrackParticles(); - - if (0 != nTrack){ - - const xAOD::TrackParticle* origTrack = xAOD::EgammaHelpers::getOriginalTrackParticle(this_egamma); - - if (origTrack){ - if (track == origTrack) { - return true; - } - }//if valid track pointer - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Electron object map has NULL pointer to original TrackParticle " << endmsg; - }//if has a track - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Electron object has " << nTrack << " tracks " << endmsg; - }//if valid pointer - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Electron is a NULL pointer " << endmsg; - }//electron loop - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Invalid pointer to m_selectedElectrons in isElectron " << endmsg; - - return false; - -} - -void eflowPreparation::storeElectronCells(const xAOD::Egamma* electron){ - - const xAOD::CaloCluster* electronCluster = electron->caloCluster(); - if (electronCluster){ - this->storeLeptonCells(electronCluster); - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "This electron has an invalid pointer to its cluster " << endmsg; - -} - -void eflowPreparation::storeLeptonCells(const xAOD::CaloCluster* theCluster){ - - const CaloClusterCellLink* theCellLink = theCluster->getCellLinks(); - - if (theCellLink){ - - CaloClusterCellLink::const_iterator firstCell = theCellLink->begin(); - CaloClusterCellLink::const_iterator lastCell = theCellLink->end(); - - for (; firstCell != lastCell; ++firstCell){ - if (m_leptonCaloCellContainerWriteHandle.isValid()) m_leptonCaloCellContainerWriteHandle->push_back(*firstCell); - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Invalid pointer to m_leptonCellContainer in storeLeptonCells" << endmsg; - }//cell loop - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "This cluster has an invalid pointer to its cells, in storeLeptonCells " << endmsg; - -} - -void eflowPreparation::clearContainers(){ - if (m_useLeptons && m_selectedMuons) m_selectedMuons->clear(); -} diff --git a/Reconstruction/eflowRec/src/eflowRecoverSplitShowersTool.cxx b/Reconstruction/eflowRec/src/eflowRecoverSplitShowersTool.cxx deleted file mode 100644 index 64c8ae81d46dd4167cf4e9737fffc484cfb3e6f6..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowRecoverSplitShowersTool.cxx +++ /dev/null @@ -1,302 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/******************************************************************** - -NAME: eflowRecoverSplitShowersTool.cxx -PACKAGE: offline/Reconstruction/eflowRec - -AUTHOR: Thomas Velz, Mark Hodgkinson -CREATED: 16 January 2014 - -********************************************************************/ - -#include "eflowRec/eflowRecoverSplitShowersTool.h" -#include "eflowRec/eflowUtil.h" - -#include "eflowRec/eflowRecCluster.h" -#include "eflowRec/eflowRecTrack.h" -#include "eflowRec/eflowTrackClusterLink.h" -#include "eflowRec/eflowCaloObject.h" -#include "eflowRec/eflowCaloObjectMaker.h" -#include "eflowRec/eflowTrackCaloPoints.h" -#include "eflowRec/eflowCellList.h" -#include "eflowRec/IEFlowCellEOverPTool.h" -#include "eflowRec/PFTrackClusterMatchingTool.h" -#include "eflowRec/eflowEEtaBinnedParameters.h" -#include "eflowRec/eflowLayerIntegrator.h" -#include "eflowRec/eflowRingSubtractionManager.h" -#include "eflowRec/eflowCellSubtractionFacilitator.h" -#include "eflowRec/eflowSubtractor.h" - -#include "CaloEvent/CaloClusterContainer.h" -#include "xAODCaloEvent/CaloClusterKineHelper.h" - -using namespace eflowSubtract; - -eflowRecoverSplitShowersTool::eflowRecoverSplitShowersTool(const std::string& type,const std::string& name,const IInterface* parent): -AthAlgTool(type, name, parent), -m_eflowCaloObjectContainer(0), -m_rCell(0.75), -m_windowRms(0.032), -m_theEOverPTool("eflowCellEOverPTool",this), -m_matchingTool("PFTrackClusterMatchingTool/RcvrSpltMatchingTool", this), -m_binnedParameters(std::make_unique<eflowEEtaBinnedParameters>()), -m_integrator(std::make_unique<eflowLayerIntegrator>(m_windowRms, 1.0e-3, 3.0)), -m_subtractionSigmaCut(1.5), -m_recoverIsolatedTracks(false), -m_nTrackClusterMatches(0), -m_useUpdated2015ChargedShowerSubtraction(true) -{ - declareInterface<eflowRecoverSplitShowersTool>(this); - declareProperty("SubtractionSigmaCut",m_subtractionSigmaCut); - declareProperty("eflowCellEOverPTool", m_theEOverPTool,"Energy Flow E/P Values and Shower Parameters Tool"); - declareProperty("PFTrackClusterMatchingTool", m_matchingTool, "The track-cluster matching tool"); - declareProperty("RecoverIsolatedTracks",m_recoverIsolatedTracks,"Whether to recover isolated tracks also"); - declareProperty("useUpdated2015ChargedShowerSubtraction",m_useUpdated2015ChargedShowerSubtraction,"Toggle whether to use updated 2015 charged shower subtraction, which disables the shower subtraction in high calorimeter energy density region"); - eflowRingSubtractionManager::setRMaxAndWeightRange(m_rCell, 1.0e6); -} - -eflowRecoverSplitShowersTool::~eflowRecoverSplitShowersTool() {} - -StatusCode eflowRecoverSplitShowersTool::initialize(){ - - // tool service - IToolSvc* myToolSvc; - if ( service("ToolSvc",myToolSvc).isFailure() ) { - msg(MSG::WARNING) << " Tool Service Not Found" << endmsg; - return StatusCode::SUCCESS; - } - - if (m_matchingTool.retrieve().isFailure()){ - msg(MSG::WARNING) << "Couldn't retrieve PFTrackClusterMatchingTool." << endmsg; - return StatusCode::SUCCESS; - } - - if (m_theEOverPTool.retrieve().isFailure()){ - msg(MSG::WARNING) << "Cannot find eflowEOverPTool" << endmsg; - return StatusCode::SUCCESS; - } - - if (m_theEOverPTool->execute(m_binnedParameters.get()).isFailure()){ - msg(MSG::WARNING) << "Could not execute eflowCellEOverPTool " << endmsg; - return StatusCode::SUCCESS; - } - - return StatusCode::SUCCESS; -} - -void eflowRecoverSplitShowersTool::execute(eflowCaloObjectContainer* theEflowCaloObjectContainer, eflowRecTrackContainer*, eflowRecClusterContainer*){ - - msg(MSG::DEBUG) << "Executing eflowRecoverSplitShowersTool" << endmsg; - - m_eflowCaloObjectContainer = theEflowCaloObjectContainer; - - recycleTracksClusters(); - - /* Add each track to its matching cluster's eflowCaloObject */ - int const nOriginalObj = matchAndCreateEflowCaloObj(); - - /* Extrapolate tracks, match clusters, do shower simulation, run cell subtraction */ - performRecovery(nOriginalObj); - -} - -StatusCode eflowRecoverSplitShowersTool::finalize(){ - - ATH_MSG_INFO("Produced " << m_nTrackClusterMatches << " track-cluster matches."); - - return StatusCode::SUCCESS; - -} -void eflowRecoverSplitShowersTool::recycleTracksClusters() { - getTracksToRecover(); - getClustersToConsider(); - -} - -void eflowRecoverSplitShowersTool::getClustersToConsider() { - - m_clustersToConsider.clear(); - - eflowCaloObjectContainer::iterator itEFCalObject = m_eflowCaloObjectContainer->begin(); - eflowCaloObjectContainer::iterator endEFCalObject = m_eflowCaloObjectContainer->end(); - for (; itEFCalObject != endEFCalObject; ++itEFCalObject) { - eflowCaloObject* thisEflowCaloObject = *itEFCalObject; - - if (thisEflowCaloObject->nClusters() == 0) { continue; } - - for(unsigned i=0; i<thisEflowCaloObject->nClusters(); ++i){ - /* Skip empty clusters (subtraction remnants) */ - const CaloClusterCellLink* theCellLink = thisEflowCaloObject->efRecCluster(i)->getCluster()->getCellLinks(); - if (0 == (int)theCellLink->size()){ continue; } - - thisEflowCaloObject->efRecCluster(i)->clearTrackMatches(); - m_clustersToConsider.push_back(thisEflowCaloObject->efRecCluster(i)); - thisEflowCaloObject->clearClusters(); - thisEflowCaloObject->clearLinks(); - } - } - - std::sort(m_clustersToConsider.begin(),m_clustersToConsider.end(),eflowRecCluster::SortDescendingPt()); -} - -void eflowRecoverSplitShowersTool::getTracksToRecover() { - - m_tracksToRecover.clear(); int iEFCalOb=0; - eflowCaloObjectContainer::iterator itEFCalObject = m_eflowCaloObjectContainer->begin(); - eflowCaloObjectContainer::iterator endEFCalObject = m_eflowCaloObjectContainer->end(); - for (; itEFCalObject != endEFCalObject; ++itEFCalObject, ++iEFCalOb) { - eflowCaloObject* thisEflowCaloObject = *itEFCalObject; - - /* Skip isolated tracks if flag set */ - if (!m_recoverIsolatedTracks && thisEflowCaloObject->nClusters() == 0) { - unsigned int nTrk = thisEflowCaloObject->nTracks(); - /* But make sure we get eflowObjects from them - * TODO: replace this mechanism by something better */ - for (unsigned int iTrk = 0; iTrk < nTrk; ++iTrk) { - thisEflowCaloObject->efRecTrack(iTrk)->setSubtracted(); - } - continue; - } - - /* Add all tracks on the eflowCaloObject that haven't been subtracted yet*/ - std::vector<eflowRecTrack*> updatedTracks; updatedTracks.clear(); - unsigned int nTracks = thisEflowCaloObject->nTracks(); - - /* For cluster-only CaloObjects */ - if(nTracks == 0) continue; - - /* For track-only and track-cluster CaloObjects */ - for (unsigned int iTrack = 0; iTrack < nTracks; ++iTrack){ - eflowRecTrack* thisEfRecTrack = thisEflowCaloObject->efRecTrack(iTrack); - if (thisEfRecTrack->isSubtracted()){ - updatedTracks.push_back(thisEfRecTrack); - continue; - } - thisEfRecTrack->clearClusterMatches(); - m_tracksToRecover.push_back(thisEfRecTrack); - } - thisEflowCaloObject->clearTracks(); - if (!updatedTracks.empty()) { - thisEflowCaloObject->addTracks(updatedTracks); - updatedTracks.clear(); - } else { - thisEflowCaloObject->clearLinks(); - } - } - - std::sort(m_tracksToRecover.begin(),m_tracksToRecover.end(),eflowRecTrack::SortDescendingPt()); - -} - -int eflowRecoverSplitShowersTool::matchAndCreateEflowCaloObj() { - /* Cache the original number of eflowCaloObjects */ - const int nCaloObj = m_eflowCaloObjectContainer->size(); - - std::vector<eflowRecTrack*>::iterator endEfRecTrack = m_tracksToRecover.end(); - /* loop tracks in m_tracksToRecover and do matching */ - for (std::vector<eflowRecTrack*>::iterator itEfRecTrack = m_tracksToRecover.begin(); - itEfRecTrack != endEfRecTrack; ++itEfRecTrack) { - eflowRecTrack* thisEfRecTrack = *itEfRecTrack; - /* No point to do anything if bin does not exist */ - if (!thisEfRecTrack->hasBin()) { - std::unique_ptr<eflowCaloObject> thisEflowCaloObject = std::make_unique<eflowCaloObject>(); - thisEflowCaloObject->addTrack(thisEfRecTrack); - m_eflowCaloObjectContainer->push_back(std::move(thisEflowCaloObject)); - continue; - } - if (msgLvl(MSG::WARNING)){ - const xAOD::TrackParticle* track = thisEfRecTrack->getTrack(); - msg(MSG::DEBUG) << "Recovering charged EFO with e,eta and phi " << track->e() << ", " - << track->eta() << " and " << track->phi() << endmsg; - } - /* Get list of matched clusters */ - std::vector<eflowRecCluster*> matchedClusters = m_matchingTool->doMatches(thisEfRecTrack, m_clustersToConsider, -1); - if (matchedClusters.empty()) { continue; } - - m_nTrackClusterMatches += matchedClusters.size(); - /* Matched cluster: create TrackClusterLink and add it to both the track and the cluster (eflowCaloObject will be created later) */ - std::vector<eflowRecCluster*>::const_iterator itCluster = matchedClusters.begin(); - std::vector<eflowRecCluster*>::const_iterator endCluster = matchedClusters.end(); - for (; itCluster != endCluster; ++itCluster) { - eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, - (*itCluster)); - thisEfRecTrack->addClusterMatch(trackClusterLink); - (*itCluster)->addTrackMatch(trackClusterLink); - } - } - - /* Create all eflowCaloObjects that contain eflowRecCluster */ - eflowCaloObjectMaker makeCaloObject; - int nCaloObjects = makeCaloObject.makeTrkCluCaloObjects(m_tracksToRecover, m_clustersToConsider, - m_eflowCaloObjectContainer); - msg(MSG::DEBUG) << "eflowRecoverSplitShowersTool created " << nCaloObjects << " CaloObjects." << endmsg; - - /* integrate cells; determine FLI; eoverp */ - for (unsigned int iCalo = nCaloObj; iCalo < m_eflowCaloObjectContainer->size(); ++iCalo) { - eflowCaloObject* thisEflowCaloObject = m_eflowCaloObjectContainer->at(iCalo); - thisEflowCaloObject->simulateShower(m_integrator.get(), m_binnedParameters.get(), m_useUpdated2015ChargedShowerSubtraction); - } - return nCaloObj; -} - -void eflowRecoverSplitShowersTool::performSubtraction(eflowCaloObject* thisEflowCaloObject) { - for (unsigned iTrack = 0; iTrack < thisEflowCaloObject->nTracks(); ++iTrack) { - eflowRecTrack* thisEfRecTrack = thisEflowCaloObject->efRecTrack(iTrack); - /* Get matched cluster via Links */ - std::vector<eflowRecCluster*> matchedClusters; - matchedClusters.clear(); - std::vector<eflowTrackClusterLink*> links = thisEfRecTrack->getClusterMatches(); - std::vector<eflowTrackClusterLink*>::iterator itLink = links.begin(); - std::vector<eflowTrackClusterLink*>::iterator endLink = links.end(); - for (; itLink != endLink; ++itLink) { - matchedClusters.push_back((*itLink)->getCluster()); - } - /* Do subtraction */ - std::vector<xAOD::CaloCluster*> clusterSubtractionList; - std::vector<eflowRecCluster*>::const_iterator itCluster = matchedClusters.begin(); - std::vector<eflowRecCluster*>::const_iterator endCluster = matchedClusters.end(); - for (; itCluster != endCluster; ++itCluster) { - clusterSubtractionList.push_back( - (*itCluster)->getClusterForModification(eflowCaloObject::getClusterContainerPtr())); - } - if (getSumEnergy(clusterSubtractionList) - thisEfRecTrack->getEExpect() < m_subtractionSigmaCut - * sqrt(thisEfRecTrack->getVarEExpect())) { - /* Check if we can annihilate right away */ - Subtractor::annihilateClusters(clusterSubtractionList); - } else { - /* Subtract the track from all matched clusters */ - Subtractor::subtractTracksFromClusters(thisEfRecTrack, clusterSubtractionList); - /* Annihilate the cluster(s) if the remnant is small (i.e. below k*sigma) */ - if (getSumEnergy(clusterSubtractionList) < m_subtractionSigmaCut - * sqrt(thisEfRecTrack->getVarEExpect())) { - Subtractor::annihilateClusters(clusterSubtractionList); - } - } - /* Flag tracks as subtracted */ - thisEfRecTrack->setSubtracted(); - } -} - -void eflowRecoverSplitShowersTool::performRecovery(int const nOriginalObj) { - unsigned int nEFCaloObs = m_eflowCaloObjectContainer->size(); - for (unsigned int iCalo = nOriginalObj; iCalo < nEFCaloObs; ++iCalo) { - eflowCaloObject* thisEflowCaloObject = m_eflowCaloObjectContainer->at(iCalo); - - performSubtraction(thisEflowCaloObject); - } - -} - - -double eflowRecoverSplitShowersTool::getSumEnergy(const std::vector<xAOD::CaloCluster*>& clusters) { - double result = 0.0; - std::vector<xAOD::CaloCluster*>::const_iterator itCluster = clusters.begin(); - std::vector<xAOD::CaloCluster*>::const_iterator endCluster = clusters.end(); - for (; itCluster != endCluster; ++itCluster) { - result += (*itCluster)->e(); - } - return result; -} diff --git a/Reconstruction/eflowRec/src/eflowSubtractor.cxx b/Reconstruction/eflowRec/src/eflowSubtractor.cxx index e2ac9d881fe863f5a282f293f7a78af460233918..4befe49976a602f017d4cab92630ca8a507bccaa 100644 --- a/Reconstruction/eflowRec/src/eflowSubtractor.cxx +++ b/Reconstruction/eflowRec/src/eflowSubtractor.cxx @@ -12,7 +12,6 @@ #include "xAODCaloEvent/CaloCluster.h" #include "xAODCaloEvent/CaloCluster.h" #include "xAODCaloEvent/CaloClusterKineHelper.h" -#include "eflowRec/eflowCellLevelSubtractionTool.h" #include "eflowRec/eflowRecTrack.h" #include "eflowRec/eflowRecCluster.h" #include "eflowRec/eflowTrackClusterLink.h" diff --git a/Reconstruction/eflowRec/src/eflowVertexInformationSetter.cxx b/Reconstruction/eflowRec/src/eflowVertexInformationSetter.cxx deleted file mode 100644 index 4f0dd5363805338f6f4f4f090877c0965e2b960f..0000000000000000000000000000000000000000 --- a/Reconstruction/eflowRec/src/eflowVertexInformationSetter.cxx +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "eflowRec/eflowVertexInformationSetter.h" - -#include "xAODPFlow/PFOContainer.h" -#include "xAODPFlow/PFO.h" - -#include "xAODCaloEvent/CaloCluster.h" - -eflowVertexInformationSetter::eflowVertexInformationSetter(const std::string& name,ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator), m_PFOName("JetETMissNeutralParticleFlowObjects") { -declareProperty("PFOInputName",m_PFOName,"Name of container of PFO to use"); - m_storeGate = nullptr; -} - -eflowVertexInformationSetter::~eflowVertexInformationSetter() {} - -StatusCode eflowVertexInformationSetter::initialize(){ - - StatusCode sc = service("StoreGateSvc", m_storeGate); - if (sc.isFailure()) - { - msg(MSG::WARNING ) - << "Unable to retrieve pointer to StoreGateSvc" - << endmsg; - return StatusCode::SUCCESS; - } - - return StatusCode::SUCCESS; -} - -StatusCode eflowVertexInformationSetter::execute(){ - - const xAOD::PFOContainer* PFOContainer; - - StatusCode sc = m_storeGate->retrieve(PFOContainer,m_PFOName); - if(sc.isFailure() || ! PFOContainer) - { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) - <<" no PFO container" - <<endmsg; - return StatusCode::SUCCESS; - } - - xAOD::PFOContainer::const_iterator firstPFO = PFOContainer->begin(); - xAOD::PFOContainer::const_iterator lastPFO = PFOContainer->end(); - - for (; firstPFO != lastPFO; ++firstPFO){ - - const xAOD::PFO* thisPFO = *firstPFO; - - if (0 == thisPFO->charge()){ - - const xAOD::CaloCluster* thisClus = thisPFO->cluster(0); - - if (thisClus){ - - double center_mag = 0.0; - bool isRetrieved = thisClus->retrieveMoment(xAOD::CaloCluster::CENTER_MAG, center_mag ); - if (true == isRetrieved) { - xAOD::PFO* nonConstPFO = const_cast<xAOD::PFO*>(thisPFO); - nonConstPFO->setCenterMag(center_mag); - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Could not retrieved ENG_FRAC_CORE from the CaloCluster " << endmsg; - } - else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Got neutral PFO with invalid cluster pointer " << endmsg; - }//neutral - }//PFO loop - - - return StatusCode::SUCCESS; -} - -StatusCode eflowVertexInformationSetter::finalize(){ - return StatusCode::SUCCESS; -}