Commit a6f55821 authored by Lukas Ehrke's avatar Lukas Ehrke
Browse files

Add three new electron ID DNN working points and the outputs of the DNN to derivations

Adding three new electron ID working points based on a DNN to derivations. Additionally,
the single output nodes of the DNN are saved. The additional outputs are saved in the tool
using the TResult. The outputs are only saved for the Loose wp since all wps use the same
network and have the same outputs.
parent bd4e5955
......@@ -6,8 +6,8 @@
// EGLikelihoodToolWrapper.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Author: Giovanni Marchiori (giovanni.marchiori@cern.ch)
// Note: while EGSelectionToolWrapper permits to only store the boolean
// accept and the isEM-like mask (works for both isEM and likelihood selectors),
// Note: while EGSelectionToolWrapper permits to only store the boolean
// accept and the isEM-like mask (works for both isEM and likelihood selectors),
// this tool (EGElectronLikelihoodToolWrapper) allows also to store
// the double TResult output (i.e. the value of the likelihood or the ECIDS BDT)
// if StoreTResult is set to true. Otherwise one can simply use the other tool.
......@@ -28,7 +28,7 @@
namespace DerivationFramework {
class EGElectronLikelihoodToolWrapper : public AthAlgTool, public IAugmentationTool {
public:
public:
EGElectronLikelihoodToolWrapper(const std::string& t, const std::string& n, const IInterface* p);
StatusCode initialize();
......@@ -42,7 +42,8 @@ namespace DerivationFramework {
std::string m_sgName;
std::string m_containerName;
bool m_storeTResult;
};
std::vector<std::string> m_sgMultipleNames;
};
}
#endif // DERIVATIONFRAMEWORK_EGELECTRONLIKELIHOODTOOLWRAPPER_H
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
#********************************************************************
# EGammaCommon.py
# EGammaCommon.py
# Schedules all tools needed for e-gamma object selection and writes
# results into SG. These may then be accessed along the train
# results into SG. These may then be accessed along the train
#********************************************************************
from DerivationFrameworkCore.DerivationFrameworkMaster import *
......@@ -21,7 +21,7 @@ DFCommonPhotonsDirection = DerivationFramework__PhotonsDirectionTool(name = "DFC
ToolSvc += DFCommonPhotonsDirection
#====================================================================
# SHOWER SHAPE FUDGING IN MC
# SHOWER SHAPE FUDGING IN MC
# (PRESELECTION=22: FUDGE FACTORS RUN2 2015+2016 DATA, Rel 21)
#====================================================================
......@@ -33,17 +33,17 @@ isMC = 'IS_SIMULATION' in af.fileinfos['evt_type']
beam_energy = af.fileinfos['beam_energy']
conditions_tag = af.fileinfos['conditions_tag'] #useful for figuring out which mc production this is
isFullSim = False
if isMC:
if isMC:
simulationFlavour = af.fileinfos['metadata']['/Simulation/Parameters']['SimulationFlavour']
isFullSim = simulationFlavour in ('default', 'MC12G4', 'FullG4')
print "EGammaCommon: isMC = ", isMC
if isMC:
if isMC:
print "EGammaCommon: isFullSim = ", isFullSim
if isFullSim:
from ElectronPhotonShowerShapeFudgeTool.ElectronPhotonShowerShapeFudgeToolConf import ElectronPhotonShowerShapeFudgeTool
DF_ElectronPhotonShowerShapeFudgeTool = ElectronPhotonShowerShapeFudgeTool(Preselection=22)
DF_ElectronPhotonShowerShapeFudgeTool = ElectronPhotonShowerShapeFudgeTool(Preselection=22, ConfigFile="ElectronPhotonShowerShapeFudgeTool/May2016_ShiftsForMCBasedLHTuneUsing20pt7.conf")
ToolSvc += DF_ElectronPhotonShowerShapeFudgeTool
print DF_ElectronPhotonShowerShapeFudgeTool
......@@ -82,6 +82,20 @@ ElectronLHSelectorLooseBL = AsgElectronLikelihoodTool("ElectronLHSelectorLooseBL
ElectronLHSelectorLooseBL.primaryVertexContainer = "PrimaryVertices"
ToolSvc += ElectronLHSelectorLooseBL
from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronSelectorTool
ElectronDNNSelectorLoose = AsgElectronSelectorTool("ElectronDNNSelectorLoose",
WorkingPoint="LooseDNNElectron")
ToolSvc += ElectronDNNSelectorLoose
ElectronDNNSelectorMedium = AsgElectronSelectorTool("ElectronDNNSelectorMedium",
WorkingPoint="MediumDNNElectron")
ToolSvc += ElectronDNNSelectorMedium
ElectronDNNSelectorTight = AsgElectronSelectorTool("ElectronDNNSelectorTight",
WorkingPoint="TightDNNElectron")
ToolSvc += ElectronDNNSelectorTight
#====================================================================
# ELECTRON CHARGE SELECTION
#====================================================================
......@@ -97,13 +111,13 @@ ToolSvc += ElectronChargeIDSelector
from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgForwardElectronLikelihoodTool
ForwardElectronLHSelectorLoose = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorLoose", WorkingPoint="LooseLHForwardElectron")
ToolSvc += ForwardElectronLHSelectorLoose
ToolSvc += ForwardElectronLHSelectorLoose
ForwardElectronLHSelectorMedium = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorMedium", WorkingPoint="MediumLHForwardElectron")
ToolSvc += ForwardElectronLHSelectorMedium
ToolSvc += ForwardElectronLHSelectorMedium
ForwardElectronLHSelectorTight = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorTight", WorkingPoint="TightLHForwardElectron")
ToolSvc += ForwardElectronLHSelectorTight
ToolSvc += ForwardElectronLHSelectorTight
#====================================================================
......@@ -220,13 +234,53 @@ ElectronPassLHTight = DerivationFramework__EGSelectionToolWrapper( name = "Elect
ToolSvc += ElectronPassLHTight
print ElectronPassLHTight
# decorate electrons with the output of DNN ----------------------------------------------------------------------
ElectronPassDNNLoose = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassDNNLoose",
EGammaElectronLikelihoodTool = ElectronDNNSelectorLoose,
EGammaFudgeMCTool = DF_ElectronPhotonShowerShapeFudgeTool if isFullSim else "",
CutType = "",
StoreGateEntryName = "DFCommonElectronsDNNLoose",
ContainerName = "Electrons",
StoreTResult = True,
StoreGateEntryMultipleNames=["DFCommonElectronsDNN_pel",
"DFCommonElectronsDNN_pcf",
"DFCommonElectronsDNN_ppc",
"DFCommonElectronsDNN_phf",
"DFCommonElectronsDNN_ple",
"DFCommonElectronsDNN_plh"])
ToolSvc += ElectronPassDNNLoose
print ElectronPassDNNLoose
# decorate electrons with the output of DNN ----------------------------------------------------------------------
ElectronPassDNNMedium = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassDNNMedium",
EGammaElectronLikelihoodTool = ElectronDNNSelectorMedium,
EGammaFudgeMCTool = DF_ElectronPhotonShowerShapeFudgeTool if isFullSim else "",
CutType = "",
StoreGateEntryName = "DFCommonElectronsDNNMedium",
ContainerName = "Electrons",
StoreTResult = False)
ToolSvc += ElectronPassDNNMedium
print ElectronPassDNNMedium
# decorate electrons with the output of DNN ----------------------------------------------------------------------
ElectronPassDNNTight = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassDNNTight",
EGammaElectronLikelihoodTool = ElectronDNNSelectorTight,
EGammaFudgeMCTool = DF_ElectronPhotonShowerShapeFudgeTool if isFullSim else "",
CutType = "",
StoreGateEntryName = "DFCommonElectronsDNNTight",
ContainerName = "Electrons",
StoreTResult = False)
ToolSvc += ElectronPassDNNTight
print ElectronPassDNNTight
# decorate electrons with the output of ECIDS ----------------------------------------------------------------------
ElectronPassECIDS = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassECIDS",
EGammaElectronLikelihoodTool = ElectronChargeIDSelector,
EGammaFudgeMCTool = "",
CutType = "",
StoreGateEntryName = "DFCommonElectronsECIDS",
ContainerName = "Electrons",
StoreTResult = True)
ToolSvc += ElectronPassECIDS
......@@ -281,7 +335,7 @@ else:
ContainerName = "Photons")
ToolSvc += PhotonPassIsEMLoose
print PhotonPassIsEMLoose
# decorate photons with the output of IsEM tight
# on full-sim MC, fudge the shower shapes before computing the ID (but the original shower shapes are not overridden)
if isFullSim:
......@@ -349,23 +403,23 @@ ToolSvc += ElectronAmbiguity
EGAugmentationTools = [DFCommonPhotonsDirection,
ElectronPassLHVeryLoose, ElectronPassLHLoose, ElectronPassLHLooseBL, ElectronPassLHMedium, ElectronPassLHTight,
ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight,
ElectronPassECIDS,
PhotonPassIsEMLoose, PhotonPassIsEMTight,
PhotonPassIsEMTightPtIncl,
ElectronPassDNNLoose, ElectronPassDNNMedium, ElectronPassDNNTight, ElectronPassECIDS,
PhotonPassIsEMLoose, PhotonPassIsEMTight,
PhotonPassIsEMTightPtIncl,
PhotonPassCleaning,
PhotonPassCrackVeto,ElectronPassCrackVeto,
ElectronAmbiguity]
#==================================================
# Truth Related tools
# Truth Related tools
from RecExConfig.RecFlags import rec
if rec.doTruth():
if rec.doTruth():
# Decorate Electron with bkg electron type/origin
from MCTruthClassifier.MCTruthClassifierBase import MCTruthClassifier as BkgElectronMCTruthClassifier
from MCTruthClassifier.MCTruthClassifierBase import MCTruthClassifier as BkgElectronMCTruthClassifier
BkgElectronMCTruthClassifier.barcodeG4Shift=(DerivationFrameworkSimBarcodeOffset+1)
from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__BkgElectronClassification
from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__BkgElectronClassification
BkgElectronClassificationTool = DerivationFramework__BkgElectronClassification (name = "BkgElectronClassificationTool",
MCTruthClassifierTool = BkgElectronMCTruthClassifier,
barcodeCut=DerivationFrameworkSimBarcodeOffset)
......@@ -400,7 +454,7 @@ if rec.doTruth():
ToolSvc += TruthEgptIsolationTool
print TruthEgptIsolationTool
EGAugmentationTools.append(TruthEgptIsolationTool)
# Compute the truth-particle-level energy density in the central eta region
from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAthAlg
from JetRec.JetRecStandard import jtm
......@@ -409,7 +463,7 @@ if rec.doTruth():
AbsRapidityMax = 1.5,
OutputContainer = "TruthIsoCentralEventShape",
OutputLevel = 3,
)
)
ToolSvc += tc
# Compute the truth-particle-level energy density in the forward eta region
......@@ -419,7 +473,7 @@ if rec.doTruth():
AbsRapidityMax = 3.0,
OutputContainer = "TruthIsoForwardEventShape",
OutputLevel = 3,
)
)
ToolSvc += tf
# Schedule the two energy density tools for running
......@@ -430,7 +484,7 @@ if rec.doTruth():
#=======================================
# CREATE THE DERIVATION KERNEL ALGORITHM
# CREATE THE DERIVATION KERNEL ALGORITHM
#=======================================
from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation
......@@ -445,5 +499,3 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("EGamma
import IsolationAlgs.IsoUpdatedTrackCones as isoCones
if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"):
DerivationFrameworkJob += isoCones.GetUpdatedIsoTrackCones()
......@@ -2,7 +2,7 @@
ElectronsCPContent = [
"Electrons",
"ElectronsAux.trackParticleLinks.pt.eta.phi.m.charge.author.OQ.DFCommonElectronsLHVeryLoose.DFCommonElectronsLHLoose.DFCommonElectronsLHLooseBL.DFCommonElectronsLHMedium.DFCommonElectronsLHTight.DFCommonElectronsLHVeryLooseIsEMValue.DFCommonElectronsLHLooseIsEMValue.DFCommonElectronsLHLooseBLIsEMValue.DFCommonElectronsLHMediumIsEMValue.DFCommonElectronsLHTightIsEMValue.DFCommonElectronsECIDS.DFCommonElectronsECIDSResult.ptvarcone20.ptvarcone40_TightTTVALooseCone_pt1000.topoetcone20.topoetcone20ptCorrection.ptcone20_TightTTVALooseCone_pt500.ptcone20_TightTTVALooseCone_pt1000.ptvarcone20_TightTTVA_pt1000.ptvarcone30_TightTTVA_pt500.ptvarcone30_TightTTVA_pt1000.ptvarcone20_TightTTVALooseCone_pt1000.ptvarcone30_TightTTVALooseCone_pt500.ptvarcone30_TightTTVALooseCone_pt1000.neflowisol20.core57cellsEnergyCorrection.topoetconecoreConeSCEnergyCorrection.topoetconecoreConeEnergyCorrection.DFCommonCrackVetoCleaning.caloClusterLinks.ambiguityLink.truthParticleLink.truthOrigin.truthType.truthPdgId.firstEgMotherTruthType.firstEgMotherTruthOrigin.firstEgMotherTruthParticleLink.firstEgMotherPdgId.ambiguityType.DFCommonAddAmbiguity",
"ElectronsAux.trackParticleLinks.pt.eta.phi.m.charge.author.OQ.DFCommonElectronsLHVeryLoose.DFCommonElectronsLHLoose.DFCommonElectronsLHLooseBL.DFCommonElectronsLHMedium.DFCommonElectronsLHTight.DFCommonElectronsLHVeryLooseIsEMValue.DFCommonElectronsLHLooseIsEMValue.DFCommonElectronsLHLooseBLIsEMValue.DFCommonElectronsLHMediumIsEMValue.DFCommonElectronsLHTightIsEMValue.DFCommonElectronsECIDS.DFCommonElectronsECIDSResult.DFCommonElectronsDNNLoose.DFCommonElectronsDNNLooseIsEMValue.DFCommonElectronsDNNMedium.DFCommonElectronsDNNMediumIsEMValue.DFCommonElectronsDNNTight.DFCommonElectronsDNNTightIsEMValue.DFCommonElectronsDNN_pel.DFCommonElectronsDNN_ppc.DFCommonElectronsDNN_ppc.DFCommonElectronsDNN_phf.DFCommonElectronsDNN_ple.DFCommonElectronsDNN_plh.ptvarcone20.ptvarcone40_TightTTVALooseCone_pt1000.topoetcone20.topoetcone20ptCorrection.ptcone20_TightTTVALooseCone_pt500.ptcone20_TightTTVALooseCone_pt1000.ptvarcone20_TightTTVA_pt1000.ptvarcone30_TightTTVA_pt500.ptvarcone30_TightTTVA_pt1000.ptvarcone20_TightTTVALooseCone_pt1000.ptvarcone30_TightTTVALooseCone_pt500.ptvarcone30_TightTTVALooseCone_pt1000.neflowisol20.core57cellsEnergyCorrection.topoetconecoreConeSCEnergyCorrection.topoetconecoreConeEnergyCorrection.DFCommonCrackVetoCleaning.caloClusterLinks.ambiguityLink.truthParticleLink.truthOrigin.truthType.truthPdgId.firstEgMotherTruthType.firstEgMotherTruthOrigin.firstEgMotherTruthParticleLink.firstEgMotherPdgId.ambiguityType.DFCommonAddAmbiguity",
"GSFTrackParticles",
"GSFTrackParticlesAux.chiSquared.phi.d0.theta.qOverP.definingParametersCovMatrix.numberOfPixelHits.numberOfPixelOutliers.numberOfPixelDeadSensors.numberOfSCTHits.numberOfSCTOutliers.numberOfSCTDeadSensors.z0.vz.charge.vertexLink.numberOfInnermostPixelLayerHits.numberOfInnermostPixelLayerOutliers.numberOfNextToInnermostPixelLayerOutliers.expectInnermostPixelLayerHit.truthParticleLink.originalTrackParticle.numberOfNextToInnermostPixelLayerHits.expectNextToInnermostPixelLayerHit",
"GSFConversionVertices",
......
......@@ -19,12 +19,13 @@ namespace DerivationFramework {
EGElectronLikelihoodToolWrapper::EGElectronLikelihoodToolWrapper(const std::string& t,
const std::string& n,
const IInterface* p) :
const IInterface* p) :
AthAlgTool(t,n,p),
m_cut(""),
m_sgName(""),
m_containerName(""),
m_storeTResult(false)
m_storeTResult(false),
m_sgMultipleNames({})
{
declareInterface<DerivationFramework::IAugmentationTool>(this);
declareProperty("EGammaElectronLikelihoodTool", m_tool);
......@@ -33,6 +34,7 @@ namespace DerivationFramework {
declareProperty("StoreGateEntryName", m_sgName);
declareProperty("ContainerName", m_containerName);
declareProperty("StoreTResult", m_storeTResult);
declareProperty("StoreGateEntryMultipleNames", m_sgMultipleNames);
}
StatusCode EGElectronLikelihoodToolWrapper::initialize()
......@@ -84,7 +86,7 @@ namespace DerivationFramework {
ATH_MSG_ERROR ("addBranches(): Wrong particle type being passed to EGElectronLikelihoodToolWrapper");
return StatusCode::FAILURE;
}
xAOD::IParticle* pCopy = *pItr;
// this should be computed based on some property of the tool or the existence of the ElectronPhotonShowerShapeFudgeTool
......@@ -117,40 +119,60 @@ namespace DerivationFramework {
// compute the output of the selector
Root::TAccept theAccept(m_tool->accept(pCopy));
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)
std::vector<double> result; // initialise explicitly to avoid compilation warning. It will be overridden in the following block (result is used only if m_storeTResult is true)
if (m_storeTResult) {
Root::TResult theResult(m_tool->calculate(pCopy));
result = double(theResult);
Root::TResult theResult(m_tool->calculate(pCopy));
for (uint i = 0; i < theResult.getNResults(); i++){
result.push_back(theResult.getResult(i));
}
}
// decorate the original object
if(m_cut.empty()){
bool pass_selection = (bool) theAccept;
if(pass_selection) decoratorPass(**pItr) = 1;
else decoratorPass(**pItr) = 0;
decoratorIsEM(**pItr) = isEM;
if (m_storeTResult) {
SG::AuxElement::Decorator< double > decoratorResult(m_sgName + "Result");
decoratorResult(**pItr) = result;
}
bool pass_selection = (bool) theAccept;
if(pass_selection) decoratorPass(**pItr) = 1;
else decoratorPass(**pItr) = 0;
decoratorIsEM(**pItr) = isEM;
if (m_storeTResult) {
if (result.size() == 1){
SG::AuxElement::Decorator< double > decoratorResult(m_sgName + "Result");
decoratorResult(**pItr) = result.at(0);
}
else{
for (uint i = 0; i < m_sgMultipleNames.size(); i++){
SG::AuxElement::Decorator< double > decoratorResult(m_sgMultipleNames.at(i));
// the first entry is supposed to be the discriminant and does not need to be saved
decoratorResult(**pItr) = result.at(i + 1);
}
}
}
}
else{
if (theAccept.getCutResult(m_cut)) {
decoratorPass(**pItr) = 1;
} else {
decoratorPass(**pItr) = 0;
}
decoratorIsEM(**pItr) = isEM;
if (m_storeTResult) {
SG::AuxElement::Decorator< double > decoratorResult(m_sgName + "Result");
decoratorResult(**pItr) = result;
}
if (theAccept.getCutResult(m_cut)) {
decoratorPass(**pItr) = 1;
} else {
decoratorPass(**pItr) = 0;
}
decoratorIsEM(**pItr) = isEM;
if (m_storeTResult) {
if (result.size() == 1){
SG::AuxElement::Decorator< double > decoratorResult(m_sgName + "Result");
decoratorResult(**pItr) = result.at(0);
}
else{
for (uint i = 0; i < m_sgMultipleNames.size(); i++){
SG::AuxElement::Decorator< double > decoratorResult(m_sgMultipleNames.at(i));
// the first entry is supposed to be the discriminant and does not need to be saved
decoratorResult(**pItr) = result.at(i + 1);
}
}
}
}
// delete the particle copy
if (applyFF) delete pCopy;
}
return StatusCode::SUCCESS;
}
}
......@@ -112,7 +112,8 @@ private:
/** Interpolates cut values along pt*/
double interpolateCuts( const std::vector<double>& cuts, double et, double eta ) const;
/// Set all entries of the TResult to a default value of -9999
void resetTResult() const;
// Private member variables
private:
......@@ -178,7 +179,18 @@ private:
int m_cutPosition_MVA;
/// The position of the MVA value bit in the TResult return object
int m_resultPosition_MVA;
/// The position of the electron probability bit in the TResult return object
int m_resultPosition_EL;
/// The position of the chargeFlip probability bit in the TResult return object
int m_resultPosition_CF;
/// The position of the photonConversion probability bit in the TResult return object
int m_resultPosition_PC;
/// The position of the heavyFlavor probability bit in the TResult return object
int m_resultPosition_HF;
/// The position of the lightFlavorEgamma probability bit in the TResult return object
int m_resultPosition_LE;
/// The position of the lightFlavorHadron probability bit in the TResult return object
int m_resultPosition_LH;
/// number of discrimintants vs Et
static const unsigned int s_fnDiscEtBins = 10;
......
......@@ -259,11 +259,31 @@ StatusCode AsgElectronSelectorTool::initialize()
// Register the cuts and check that the registration worked:
// NOTE: THE ORDER IS IMPORTANT!!! Cut0 corresponds to bit 0, Cut1 to bit 1,...
m_resultPosition_MVA = m_resultMVA.addResult( "mvaScore", "electron mvaScore" );
m_resultPosition_MVA = m_resultMVA.addResult( "mvaScore", "electron combined MVA Score" );
if ( m_resultPosition_MVA < 0 ) sc = 0; // Exceeded the number of allowed results
// Set the result to a default value
m_resultMVA.setResult(m_resultPosition_MVA, -9999.0);
if (m_multiClass){
m_resultPosition_EL = m_resultMVA.addResult( "elScore", "electron node" );
if ( m_resultPosition_EL < 0 ) sc = 0; // Exceeded the number of allowed results
m_resultPosition_CF = m_resultMVA.addResult( "cfScore", "chargeFlip node" );
if ( m_resultPosition_CF < 0 ) sc = 0; // Exceeded the number of allowed results
m_resultPosition_PC = m_resultMVA.addResult( "pcScore", "photonConv node" );
if ( m_resultPosition_PC < 0 ) sc = 0; // Exceeded the number of allowed results
m_resultPosition_HF = m_resultMVA.addResult( "hfScore", "heavyFlavor node" );
if ( m_resultPosition_HF < 0 ) sc = 0; // Exceeded the number of allowed results
m_resultPosition_LE = m_resultMVA.addResult( "leScore", "lightFlavorEgamma node" );
if ( m_resultPosition_LE < 0 ) sc = 0; // Exceeded the number of allowed results
m_resultPosition_LH = m_resultMVA.addResult( "lhScore", "lightFlavorHadron node" );
if ( m_resultPosition_LH < 0 ) sc = 0; // Exceeded the number of allowed results
}
// Set all entries of the TResult to a default of -9999.
resetTResult();
// Check that we got everything OK
if (sc == 0){
......@@ -455,8 +475,8 @@ const Root::TAccept& AsgElectronSelectorTool::accept( const xAOD::Electron* eg,
//=============================================================================
const Root::TResult& AsgElectronSelectorTool::calculate( const xAOD::Electron* eg, double mu ) const
{
// Set the result to a default value
m_resultMVA.setResult(m_resultPosition_MVA, -9999.0);
// Set all entries of the TResult to a default of -9999.
resetTResult();
if (!eg){
throw std::runtime_error("AsgElectronSelectorTool: Failed, no electron object was passed" );
......@@ -669,6 +689,12 @@ const Root::TResult& AsgElectronSelectorTool::calculate( const xAOD::Electron* e
else{
// combine the six output nodes into one discriminant to cut on, any necessary transformation is applied within combineOutputs()
discriminant = combineOutputs(mvaScores, eta);
m_resultMVA.setResult(m_resultPosition_EL, mvaScores.at(0));
m_resultMVA.setResult(m_resultPosition_CF, mvaScores.at(1));
m_resultMVA.setResult(m_resultPosition_PC, mvaScores.at(2));
m_resultMVA.setResult(m_resultPosition_HF, mvaScores.at(3));
m_resultMVA.setResult(m_resultPosition_LE, mvaScores.at(4));
m_resultMVA.setResult(m_resultPosition_LH, mvaScores.at(5));
}
m_resultMVA.setResult(m_resultPosition_MVA, discriminant);
......@@ -706,8 +732,8 @@ const Root::TResult& AsgElectronSelectorTool::calculate( const xAOD::IParticle*
}
else {
ATH_MSG_DEBUG("AsgElectronSelectorTool::could not cast to const Electron");
// Set the result to a default value
m_resultMVA.setResult(m_resultPosition_MVA, -9999.0);
// Set all entries of the TResult to a default of -9999.
resetTResult();
return m_resultMVA;
}
}
......@@ -733,8 +759,8 @@ const Root::TResult& AsgElectronSelectorTool::calculate( const xAOD::Egamma* eg,
}
else {
ATH_MSG_DEBUG("AsgElectronSelectorTool::could not cast to const Electron");
// Set the result to a default value
m_resultMVA.setResult(m_resultPosition_MVA, -9999.0);
// Set all entries of the TResult to a default of -9999.
resetTResult();
return m_resultMVA;
}
}
......@@ -857,3 +883,18 @@ double AsgElectronSelectorTool::interpolateCuts( const std::vector<double>& cuts
return discLow + (et - etLow) * gradient;
}
// Set all results of the TResult to a default value of -9999
void AsgElectronSelectorTool::resetTResult() const
{
m_resultMVA.setResult(m_resultPosition_MVA, -9999.0);
if (m_multiClass){
m_resultMVA.setResult(m_resultPosition_EL, -9999.0);
m_resultMVA.setResult(m_resultPosition_CF, -9999.0);
m_resultMVA.setResult(m_resultPosition_PC, -9999.0);
m_resultMVA.setResult(m_resultPosition_HF, -9999.0);
m_resultMVA.setResult(m_resultPosition_LE, -9999.0);
m_resultMVA.setResult(m_resultPosition_LH, -9999.0);
}
return;
}
......@@ -59,7 +59,9 @@ namespace EgammaSelectors {
{"TightPhoton",egammaPID::PhotonTight},
};
const std::map<std::string,std::string> ElectronDNNPointToConfFile={
{"LooseDNNElectron", "ElectronPhotonSelectorTools/offline/mc16_20210204/ElectronDNNLooseConfig.conf"}
{"LooseDNNElectron", "ElectronPhotonSelectorTools/offline/mc16_20210430/ElectronDNNMulticlassLoose.conf"},
{"MediumDNNElectron", "ElectronPhotonSelectorTools/offline/mc16_20210430/ElectronDNNMulticlassMedium.conf"},
{"TightDNNElectron", "ElectronPhotonSelectorTools/offline/mc16_20210430/ElectronDNNMulticlassTight.conf"}
};
}
////////////////////////////////////////////
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment