11#include " RecoEgamma/ElectronIdentification/interface/ElectronDNNEstimator.h"
22#include " FWCore/MessageLogger/interface/MessageLogger.h"
33#include " FWCore/Utilities/interface/FileInPath.h"
4+ #include " DataFormats/GsfTrackReco/interface/GsfTrack.h"
45
56#include < iostream>
67#include < fstream>
@@ -37,37 +38,55 @@ ElectronDNNEstimator::ElectronDNNEstimator(const egammaTools::DNNConfiguration&
3738
3839std::vector<tensorflow::Session*> ElectronDNNEstimator::getSessions () const { return dnnHelper_.getSessions (); };
3940
40- const std::vector<std::string> ElectronDNNEstimator::dnnAvaibleInputs = {{" pt" ,
41- " eta" ,
42- " fbrem" ,
43- " abs(deltaEtaSuperClusterTrackAtVtx)" ,
44- " abs(deltaPhiSuperClusterTrackAtVtx)" ,
45- " full5x5_sigmaIetaIeta" ,
46- " full5x5_hcalOverEcal" ,
47- " eSuperClusterOverP" ,
48- " full5x5_e1x5" ,
49- " eEleClusterOverPout" ,
50- " closestCtfTrackNormChi2" ,
51- " closestCtfTrackNLayers" ,
52- " gsfTrack.missing_inner_hits" ,
53- " dr03TkSumPt" ,
54- " dr03EcalRecHitSumEt" ,
55- " dr03HcalTowerSumEt" ,
56- " gsfTrack.normalizedChi2" ,
57- " superCluster.eta" ,
58- " ecalPFClusterIso" ,
59- " hcalPFClusterIso" ,
60- " numberOfBrems" ,
61- " abs(deltaEtaSeedClusterTrackAtCalo)" ,
62- " hadronicOverEm" ,
63- " full5x5_e2x5Max" ,
64- " full5x5_e5x5" }};
41+ const std::vector<std::string> ElectronDNNEstimator::dnnAvaibleInputs = {
42+ {" pt" ,
43+ " eta" ,
44+ " fbrem" ,
45+ " abs(deltaEtaSuperClusterTrackAtVtx)" ,
46+ " abs(deltaPhiSuperClusterTrackAtVtx)" ,
47+ " full5x5_sigmaIetaIeta" ,
48+ " full5x5_hcalOverEcal" ,
49+ " eSuperClusterOverP" ,
50+ " full5x5_e1x5" ,
51+ " eEleClusterOverPout" ,
52+ " closestCtfTrackNormChi2" ,
53+ " closestCtfTrackNLayers" ,
54+ " gsfTrack.missing_inner_hits" ,
55+ " dr03TkSumPt" ,
56+ " dr03EcalRecHitSumEt" ,
57+ " dr03HcalTowerSumEt" ,
58+ " gsfTrack.normalizedChi2" ,
59+ " superCluster.eta" ,
60+ " ecalPFClusterIso" ,
61+ " hcalPFClusterIso" ,
62+ " numberOfBrems" ,
63+ " abs(deltaEtaSeedClusterTrackAtCalo)" ,
64+ " hadronicOverEm" ,
65+ " full5x5_e2x5Max" ,
66+ " full5x5_e5x5" ,
67+ " full5x5_sigmaIphiIphi" ,
68+ " 1_minus_full5x5_e1x5_ratio_full5x5_e5x5" ,
69+ " full5x5_e1x5_ratio_full5x5_e5x5" ,
70+ " full5x5_r9" ,
71+ " gsfTrack.trackerLayersWithMeasurement" ,
72+ " superCluster.energy" ,
73+ " superCluster.rawEnergy" ,
74+ " superClusterFbrem" ,
75+ " 1_ratio_ecalEnergy_minus_1_ratio_trackMomentumAtVtx.R" ,
76+ " superCluster.preshowerEnergy_ratio_superCluster.rawEnergy" ,
77+ " convVtxFitProb" ,
78+ " superCluster.clustersSize" ,
79+ " ecalEnergyError_ratio_ecalEnergy" ,
80+ " superClusterFbrem_plus_superCluster.energy" ,
81+ " superClusterFbrem_plus_superCluster.rawEnergy" ,
82+ " trackMomentumError" ,
83+ " trackMomentumError_ratio_pt" ,
84+ " full5x5_e5x5_ratio_superCluster.rawEnergy" ,
85+ " full5x5_e5x5_ratio_superCluster.energy" }};
6586
6687std::map<std::string, float > ElectronDNNEstimator::getInputsVars (const reco::GsfElectron& ele) const {
6788 // Prepare a map with all the defined variables
6889 std::map<std::string, float > variables;
69- reco::TrackRef myTrackRef = ele.closestCtfTrackRef ();
70- bool validKF = (myTrackRef.isNonnull () && myTrackRef.isAvailable ());
7190 variables[" pt" ] = ele.pt ();
7291 variables[" eta" ] = ele.eta ();
7392 variables[" fbrem" ] = ele.fbrem ();
@@ -81,11 +100,11 @@ std::map<std::string, float> ElectronDNNEstimator::getInputsVars(const reco::Gsf
81100 variables[" closestCtfTrackNormChi2" ] = ele.closestCtfTrackNormChi2 ();
82101 variables[" closestCtfTrackNLayers" ] = ele.closestCtfTrackNLayers ();
83102 variables[" gsfTrack.missing_inner_hits" ] =
84- (validKF) ? myTrackRef ->hitPattern ().numberOfLostHits (reco::HitPattern::MISSING_INNER_HITS) : - 1 . ;
103+ ele. gsfTrack () ->hitPattern ().numberOfLostHits (reco::HitPattern::MISSING_INNER_HITS);
85104 variables[" dr03TkSumPt" ] = ele.dr03TkSumPt ();
86105 variables[" dr03EcalRecHitSumEt" ] = ele.dr03EcalRecHitSumEt ();
87106 variables[" dr03HcalTowerSumEt" ] = ele.dr03HcalTowerSumEt ();
88- variables[" gsfTrack.normalizedChi2" ] = (validKF) ? myTrackRef ->normalizedChi2 () : 0 ;
107+ variables[" gsfTrack.normalizedChi2" ] = ele. gsfTrack () ->normalizedChi2 ();
89108 variables[" superCluster.eta" ] = ele.superCluster ()->eta ();
90109 variables[" ecalPFClusterIso" ] = ele.ecalPFClusterIso ();
91110 variables[" hcalPFClusterIso" ] = ele.hcalPFClusterIso ();
@@ -94,6 +113,30 @@ std::map<std::string, float> ElectronDNNEstimator::getInputsVars(const reco::Gsf
94113 variables[" hadronicOverEm" ] = ele.hcalOverEcalValid () ? ele.hadronicOverEm () : 0 ;
95114 variables[" full5x5_e2x5Max" ] = ele.full5x5_e2x5Max ();
96115 variables[" full5x5_e5x5" ] = ele.full5x5_e5x5 ();
116+
117+ variables[" full5x5_sigmaIphiIphi" ] = ele.full5x5_sigmaIphiIphi ();
118+ variables[" 1_minus_full5x5_e1x5_ratio_full5x5_e5x5" ] = 1 - ele.full5x5_e1x5 () / ele.full5x5_e5x5 ();
119+ variables[" full5x5_e1x5_ratio_full5x5_e5x5" ] = ele.full5x5_e1x5 () / ele.full5x5_e5x5 ();
120+ variables[" full5x5_r9" ] = ele.full5x5_r9 ();
121+ variables[" gsfTrack.trackerLayersWithMeasurement" ] = ele.gsfTrack ()->hitPattern ().trackerLayersWithMeasurement ();
122+ variables[" superCluster.energy" ] = ele.superCluster ()->energy ();
123+ variables[" superCluster.rawEnergy" ] = ele.superCluster ()->rawEnergy ();
124+ variables[" superClusterFbrem" ] = ele.superClusterFbrem ();
125+ variables[" 1_ratio_ecalEnergy_minus_1_ratio_trackMomentumAtVtx.R" ] =
126+ 1 / ele.ecalEnergy () - 1 / ele.trackMomentumAtVtx ().R ();
127+ variables[" superCluster.preshowerEnergy_ratio_superCluster.rawEnergy" ] =
128+ ele.superCluster ()->preshowerEnergy () / ele.superCluster ()->rawEnergy ();
129+ variables[" convVtxFitProb" ] = ele.convVtxFitProb ();
130+ variables[" superCluster.clustersSize" ] = ele.superCluster ()->clustersSize ();
131+ variables[" ecalEnergyError_ratio_ecalEnergy" ] = ele.ecalEnergyError () / ele.ecalEnergy ();
132+ variables[" superClusterFbrem_plus_superCluster.energy" ] = ele.superClusterFbrem () + ele.superCluster ()->energy ();
133+ variables[" superClusterFbrem_plus_superCluster.rawEnergy" ] =
134+ ele.superClusterFbrem () + ele.superCluster ()->rawEnergy ();
135+ variables[" trackMomentumError" ] = ele.trackMomentumError ();
136+ variables[" trackMomentumError_ratio_pt" ] = ele.trackMomentumError () / ele.pt ();
137+ variables[" full5x5_e5x5_ratio_superCluster.rawEnergy" ] = ele.full5x5_e5x5 () / ele.superCluster ()->rawEnergy ();
138+ variables[" full5x5_e5x5_ratio_superCluster.energy" ] = ele.full5x5_e5x5 () / ele.superCluster ()->energy ();
139+
97140 // Define more variables here and use them directly in the model config!
98141 return variables;
99142}
0 commit comments