Skip to content
Snippets Groups Projects
Commit 08546ab4 authored by Kazuya Mochizuki's avatar Kazuya Mochizuki Committed by Frank Winklmeier
Browse files

Adding ChargeIDSelectorTool in Release 22 (ECIDS)

parent d812f0fe
No related branches found
No related tags found
No related merge requests found
...@@ -91,13 +91,13 @@ ToolSvc += ElectronLHSelectorLooseBL ...@@ -91,13 +91,13 @@ ToolSvc += ElectronLHSelectorLooseBL
# #
# Disabled as is missing in R22 # Disabled as is missing in R22
# #
'''
from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronChargeIDSelectorTool from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronChargeIDSelectorTool
ElectronChargeIDSelector = AsgElectronChargeIDSelectorTool("ElectronChargeIDSelectorLoose") ElectronChargeIDSelector = AsgElectronChargeIDSelectorTool("ElectronChargeIDSelectorLoose")
ElectronChargeIDSelector.primaryVertexContainer = "PrimaryVertices" ElectronChargeIDSelector.primaryVertexContainer = "PrimaryVertices"
ElectronChargeIDSelector.TrainingFile = "ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root" ElectronChargeIDSelector.TrainingFile = "ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root"
ToolSvc += ElectronChargeIDSelector ToolSvc += ElectronChargeIDSelector
'''
#==================================================================== #====================================================================
# FWD ELECTRON LH SELECTORS # FWD ELECTRON LH SELECTORS
...@@ -240,7 +240,7 @@ print(ElectronPassLHTight) ...@@ -240,7 +240,7 @@ print(ElectronPassLHTight)
# #
# Disabled as is missing in R22 # Disabled as is missing in R22
# #
'''
# decorate electrons with the output of ECIDS ---------------------------------------------------------------------- # decorate electrons with the output of ECIDS ----------------------------------------------------------------------
ElectronPassECIDS = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassECIDS", ElectronPassECIDS = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassECIDS",
EGammaElectronLikelihoodTool = ElectronChargeIDSelector, EGammaElectronLikelihoodTool = ElectronChargeIDSelector,
...@@ -251,7 +251,7 @@ ElectronPassECIDS = DerivationFramework__EGElectronLikelihoodToolWrapper( name = ...@@ -251,7 +251,7 @@ ElectronPassECIDS = DerivationFramework__EGElectronLikelihoodToolWrapper( name =
StoreTResult = True) StoreTResult = True)
ToolSvc += ElectronPassECIDS ToolSvc += ElectronPassECIDS
print (ElectronPassECIDS) print (ElectronPassECIDS)
'''
# decorate forward electrons with the output of LH loose # decorate forward electrons with the output of LH loose
ForwardElectronPassLHLoose = DerivationFramework__EGSelectionToolWrapper( name = "ForwardElectronPassLHLoose", ForwardElectronPassLHLoose = DerivationFramework__EGSelectionToolWrapper( name = "ForwardElectronPassLHLoose",
EGammaSelectionTool = ForwardElectronLHSelectorLoose, EGammaSelectionTool = ForwardElectronLHSelectorLoose,
...@@ -366,13 +366,13 @@ ElectronAmbiguity = DF_EGEAT(name = "ElectronAdditionnalAmbiguity" ...@@ -366,13 +366,13 @@ ElectronAmbiguity = DF_EGEAT(name = "ElectronAdditionnalAmbiguity"
ToolSvc += ElectronAmbiguity ToolSvc += ElectronAmbiguity
# #
# Commented ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, ElectronPassECIDS tools due to they are not available in R22 yet # Commented ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, tools due to they are not available in R22 yet
# #
# list of all the decorators so far # list of all the decorators so far
EGAugmentationTools = [DFCommonPhotonsDirection, EGAugmentationTools = [DFCommonPhotonsDirection,
ElectronPassLHVeryLoose, ElectronPassLHLoose, ElectronPassLHLooseBL, ElectronPassLHMedium, ElectronPassLHTight, ElectronPassLHVeryLoose, ElectronPassLHLoose, ElectronPassLHLooseBL, ElectronPassLHMedium, ElectronPassLHTight,
#ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, #ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight,
#ElectronPassECIDS, ElectronPassECIDS,
PhotonPassIsEMLoose, PhotonPassIsEMTight, PhotonPassIsEMLoose, PhotonPassIsEMTight,
PhotonPassIsEMTightPtIncl, PhotonPassIsEMTightPtIncl,
PhotonPassCleaning, PhotonPassCleaning,
......
...@@ -120,10 +120,9 @@ namespace DerivationFramework { ...@@ -120,10 +120,9 @@ namespace DerivationFramework {
unsigned int isEM = (unsigned int) theAccept.getCutResultInvertedBitSet().to_ulong(); // this should work for both the cut-based and the LH selectors unsigned int isEM = (unsigned int) theAccept.getCutResultInvertedBitSet().to_ulong(); // this should work for both the cut-based and the LH selectors
double result(0.); // initialise explicitly to avoid compilation warning. It will be overridden in the following block (result is used only if m_storeTResult is true) double result(0.); // initialise explicitly to avoid compilation warning. It will be overridden in the following block (result is used only if m_storeTResult is true)
// Lukas Heinrich: interface in master not yet available. if (m_storeTResult) {
// if (m_storeTResult) { result = double(m_tool->calculate(Gaudi::Hive::currentContext(),pCopy));
// result = double(m_tool->calculate(pCopy)); }
// }
// decorate the original object // decorate the original object
if(m_cut.empty()){ if(m_cut.empty()){
......
...@@ -11,7 +11,7 @@ atlas_add_library( ElectronPhotonSelectorToolsLib ...@@ -11,7 +11,7 @@ atlas_add_library( ElectronPhotonSelectorToolsLib
ElectronPhotonSelectorTools/*.h Root/*.cxx ElectronPhotonSelectorTools/*.h Root/*.cxx
PUBLIC_HEADERS ElectronPhotonSelectorTools PUBLIC_HEADERS ElectronPhotonSelectorTools
PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES EgammaAnalysisInterfacesLib AsgTools xAODEgamma xAODTracking LINK_LIBRARIES EgammaAnalysisInterfacesLib AsgTools xAODEgamma xAODTracking MVAUtils
xAODHIEvent PATCoreAcceptLib AsgDataHandlesLib xAODHIEvent PATCoreAcceptLib AsgDataHandlesLib
PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib FourMomUtils xAODCaloEvent PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib FourMomUtils xAODCaloEvent
xAODEventInfo PathResolver ) xAODEventInfo PathResolver )
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Dear emacs, this is -*-c++-*-
#ifndef __ASGELECTRONCHARGEIDSELECTORTOOL__
#define __ASGELECTRONCHARGEIDSELECTORTOOL__
// Atlas includes
#include "AsgTools/AsgTool.h"
#include "MVAUtils/BDT.h"
#include "EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h"
#include "ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h"
#include "PATCore/AcceptData.h"
#include "AsgDataHandles/ReadHandleKey.h"
#include <unordered_map>
class AsgElectronChargeIDSelectorTool : public asg::AsgTool,
virtual public IAsgElectronLikelihoodTool
{
ASG_TOOL_CLASS2(AsgElectronChargeIDSelectorTool, IAsgElectronLikelihoodTool, IAsgSelectionTool)
public:
/** Standard constructor */
AsgElectronChargeIDSelectorTool( const std::string& myname);
/** Standard destructor */
virtual ~AsgElectronChargeIDSelectorTool();
public:
/** Gaudi Service Interface method implementations */ // /** Gaudi Service Interface method implementations */
virtual StatusCode initialize() override; // virtual StatusCode finalize();
// Main methods for IAsgSelectorTool interface
/** Method to get the plain AcceptInfo.
This is needed so that one can already get the AcceptInfo
and query what cuts are defined before the first object
is passed to the tool. */
//virtual const asg::AcceptInfo& getAcceptInfo() const override; KM: inlined blow
/** The main accept method: using the generic interface */
asg::AcceptData accept( const xAOD::IParticle* part ) const override;
asg::AcceptData accept( const EventContext& ctx, const xAOD::IParticle* part ) const override;
/** The main accept method: the actual cuts are applied here */
asg::AcceptData accept( const xAOD::Electron* eg ) const {
return accept (eg, -99); // mu = -99 as input will force accept to grab the pileup variable from the xAOD object
}
asg::AcceptData accept( const EventContext& ctx, const xAOD::Electron* eg ) const override {
return accept (ctx, eg, -99); // mu = -99 as input will force accept to grab the pileup variable from the xAOD object
}
/** The main accept method: the actual cuts are applied here */
asg::AcceptData accept( const xAOD::Egamma* eg ) const {
return accept (eg, -99); // mu = -99 as input will force accept to grab the pileup variable from the xAOD object
}
asg::AcceptData accept(const EventContext& ctx, const xAOD::Egamma* eg ) const override{
return accept (ctx, eg, -99); // mu = -99 as input will force accept to grab the pileup variable from the xAOD object
}
/** The main accept method: in case mu not in EventInfo online */
asg::AcceptData accept( const xAOD::Electron* eg, double mu ) const;
asg::AcceptData accept( const EventContext& ctx, const xAOD::Electron* eg, double mu ) const override;
/** The main accept method: in case mu not in EventInfo online */
asg::AcceptData accept( const xAOD::Egamma* eg, double mu ) const;
asg::AcceptData accept( const EventContext& ctx, const xAOD::Egamma* eg, double mu ) const override;
// Main methods for IAsgCalculatorTool interface
public:
/** The main result method: the actual likelihood is calculated here */
double calculate( const xAOD::IParticle* part ) const;
double calculate( const EventContext& ctx, const xAOD::IParticle* part ) const override;
/** The main result method: the actual likelihood is calculated here */
double calculate( const xAOD::Electron* eg ) const {
return calculate (eg, -99); // mu = -99 as input will force accept to grab the pileup variable from the xAOD object
}
double calculate( const EventContext& ctx, const xAOD::Electron* eg ) const override {
return calculate (ctx, eg, -99); // mu = -99 as input will force accept to grab the pileup variable from the xAOD object
}
/** The main result method: the actual likelihood is calculated here */
double calculate( const xAOD::Egamma* eg ) const {
return calculate (eg, -99); // mu = -99 as input will force accept to grab the pileup variable from the xAOD object
}
double calculate( const EventContext &ctx, const xAOD::Egamma* eg ) const override {
return calculate (ctx, eg, -99); // mu = -99 as input will force accept to grab the pileup variable from the xAOD object
}
/** The main result method: the actual likelihood is calculated here */
double calculate( const xAOD::Electron* eg, double mu ) const;
double calculate( const EventContext &ctx, const xAOD::Electron* eg, double mu ) const override;
/** The main result method: the actual likelihood is calculated here */
double calculate( const xAOD::Egamma* eg, double mu ) const;
double calculate( const EventContext &ctx, const xAOD::Egamma* eg, double mu ) const override;
//=========================================================================================== same until here
inline virtual std::string getOperatingPointName( ) const override
{ return m_WorkingPoint; };
inline virtual const asg::AcceptInfo& getAcceptInfo() const override
{ return m_acceptInfo; };
asg::AcceptData accept() const { return asg::AcceptData(&m_acceptInfo); }
// Private methods
private:
/// Get the number of primary vertices
unsigned int getNPrimVertices(const EventContext& ctx) const;
//BDT instances for different ID operating points (Tight, Medium, Loose) and the vector corresponds to n-fold
std::vector<MVAUtils::BDT*> m_v_bdts;
TString m_pid_name;
float m_cutOnBDT;
int m_cutPosition_bdt;
asg::AcceptInfo m_acceptInfo;
// Private member variables
private:
/** Working Point */
std::string m_WorkingPoint;
/// Whether to use the PV (not available for trigger)
bool m_usePVCont;
/// defualt nPV (when not using PVCont)
unsigned int m_nPVdefault;
/// The primary vertex container name
SG::ReadHandleKey<xAOD::VertexContainer> m_primVtxContKey {
this, "primaryVertexContainer", "PrimaryVertices",
"The primary vertex container name"};
/// The input ROOT file name that holds the PDFs
std::string m_trainingFile;
// BDT input variables
std::vector<std::string> m_inputVars;
}; // End: class definition
#endif
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h" #include "ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h"
#include "ElectronPhotonSelectorTools/AsgForwardElectronIsEMSelector.h" #include "ElectronPhotonSelectorTools/AsgForwardElectronIsEMSelector.h"
#include "ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h" #include "ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h"
#include "ElectronPhotonSelectorTools/AsgElectronChargeIDSelectorTool.h"
#include "ElectronPhotonSelectorTools/EGammaAmbiguityTool.h" #include "ElectronPhotonSelectorTools/EGammaAmbiguityTool.h"
#include "ElectronPhotonSelectorTools/AsgDeadHVCellRemovalTool.h" #include "ElectronPhotonSelectorTools/AsgDeadHVCellRemovalTool.h"
#endif #endif
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h" #include "ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h"
#include "ElectronPhotonSelectorTools/AsgForwardElectronIsEMSelector.h" #include "ElectronPhotonSelectorTools/AsgForwardElectronIsEMSelector.h"
#include "ElectronPhotonSelectorTools/EGammaAmbiguityTool.h" #include "ElectronPhotonSelectorTools/EGammaAmbiguityTool.h"
#include "ElectronPhotonSelectorTools/AsgElectronChargeIDSelectorTool.h"
#include "ElectronPhotonSelectorTools/AsgDeadHVCellRemovalTool.h" #include "ElectronPhotonSelectorTools/AsgDeadHVCellRemovalTool.h"
DECLARE_COMPONENT( AsgElectronIsEMSelector ) DECLARE_COMPONENT( AsgElectronIsEMSelector )
...@@ -10,5 +11,6 @@ DECLARE_COMPONENT( AsgElectronLikelihoodTool ) ...@@ -10,5 +11,6 @@ DECLARE_COMPONENT( AsgElectronLikelihoodTool )
DECLARE_COMPONENT( AsgPhotonIsEMSelector ) DECLARE_COMPONENT( AsgPhotonIsEMSelector )
DECLARE_COMPONENT( AsgForwardElectronIsEMSelector ) DECLARE_COMPONENT( AsgForwardElectronIsEMSelector )
DECLARE_COMPONENT( EGammaAmbiguityTool ) DECLARE_COMPONENT( EGammaAmbiguityTool )
DECLARE_COMPONENT( AsgElectronChargeIDSelectorTool )
DECLARE_COMPONENT( AsgDeadHVCellRemovalTool ) DECLARE_COMPONENT( AsgDeadHVCellRemovalTool )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment