Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

70X Forward of porting MVA electron ID from 53X. #1453

Merged
merged 6 commits into from Dec 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions EgammaAnalysis/ElectronTools/BuildFile.xml
@@ -0,0 +1,25 @@
<use name="FWCore/Framework"/>
<use name="FWCore/ServiceRegistry"/>
<use name="FWCore/Utilities"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
<use name="Geometry/CaloTopology"/>
<use name="CondCore/DBOutputService"/>
<use name="CondFormats/EgammaObjects"/>
<use name="CondFormats/PhysicsToolsObjects"/>
<use name="RecoEgamma/EgammaTools"/>
<use name="RecoEcal/EgammaCoreTools"/>
<use name="DataFormats/Candidate"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/EgammaCandidates"/>
<use name="DataFormats/PatCandidates"/>
<use name="DataFormats/EgammaReco"/>
<use name="DataFormats/TrackReco"/>
<use name="TrackingTools/IPTools"/>
<use name="PhysicsTools/UtilAlgos"/>
<use name="clhep"/>
<use name="root"/>
<use name="roottmva"/>
<export>
<lib name="1"/>
</export>
27 changes: 27 additions & 0 deletions EgammaAnalysis/ElectronTools/data/download.url
@@ -0,0 +1,27 @@
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_NonTrigV0_Cat1.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_NonTrigV0_Cat2.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_NonTrigV0_Cat3.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_NonTrigV0_Cat4.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_NonTrigV0_Cat5.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_NonTrigV0_Cat6.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigV0_Cat1.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigV0_Cat2.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigV0_Cat3.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigV0_Cat4.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigV0_Cat5.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigV0_Cat6.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/EgammaAnalysis/ElectronTools/data/eleEnergyRegWeights_WithSubClusters_VApr15.root
http://cmsdoc.cern.ch/cms/data/CMSSW/EgammaAnalysis/ElectronTools/data/eleEnergyReg2012Weights_V1.root
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat1EcalCor.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat1.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat2EcalCor.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat2.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat3EcalCor.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat3.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat4EcalCor.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat4.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat5EcalCor.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat5.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat6EcalCor.weights.xml
http://cmsdoc.cern.ch/cms/data/CMSSW/RecoEgamma/ElectronIdentification/data/Electrons_BDTG_TrigNoIPV0_2012_Cat6.weights.xml

10 changes: 10 additions & 0 deletions EgammaAnalysis/ElectronTools/data/linearityNewReg-May2013.csv
@@ -0,0 +1,10 @@
0, 16, -0.00329, -0.00597, -0.01272, -0.00568, -0.00742, -0.01709
16, 22, -0.00513, -0.00359, -0.00776, -0.00731, -0.00898, -0.01208
22, 28, -0.00513, -0.00392, -0.00503, -0.00587, -0.00647, -0.00955
28, 34, -0.00342, -0.00148, -0.00282, -0.00407, -0.00353, -0.00559
34, 40, -0.00194, 0.00011, -0.00134, -0.00231, -0.00228, -0.00309
40, 46, -0.00092, 0.00017, -0.00022, -0.00129, -0.00118, -0.00147
46, 52, -0.00072, -0.00015, -0.00061, -0.00087, -0.00132, -0.00136
52, 58, -0.00066, 0.00041, -0.00166, -0.00084, -0.00123, -0.00118
58, 64, -0.00119, 0.00107, -0.00126, -0.00099, -0.00077, -0.00094
64, 7000, -0.00073, -0.00188, 0.00106, -0.00045, 0.00032, 0.00078
15 changes: 15 additions & 0 deletions EgammaAnalysis/ElectronTools/data/scales2011NewReg-May2013.csv
@@ -0,0 +1,15 @@
160431, 165547, 0.9982, 0.9940, 1.0045, 0.9945, 1.0047, 1.0017, 1.0066, 1.0003
165548, 166529, 0.9994, 0.9952, 1.0053, 0.9952, 1.0036, 1.0005, 1.0018, 0.9955
166530, 167042, 0.9997, 0.9955, 1.0043, 0.9942, 1.0021, 0.9990, 0.9997, 0.9933
167043, 170895, 0.9995, 0.9953, 1.0046, 0.9946, 1.0019, 0.9988, 0.9991, 0.9928
170896, 172400, 1.0006, 0.9964, 1.0074, 0.9974, 0.9999, 0.9968, 0.9983, 0.9920
172401, 172948, 1.0005, 0.9963, 1.0058, 0.9958, 0.9992, 0.9961, 0.9989, 0.9926
172949, 173663, 1.0013, 0.9971, 1.0071, 0.9971, 0.9986, 0.9955, 0.9973, 0.9909
173664, 176288, 1.0001, 0.9959, 1.0052, 0.9951, 0.9983, 0.9952, 0.9990, 0.9927
176289, 176840, 1.0006, 0.9964, 1.0058, 0.9957, 0.9989, 0.9958, 0.9984, 0.9921
176841, 177182, 1.0010, 0.9968, 1.0070, 0.9970, 0.9981, 0.9950, 0.9990, 0.9926
177183, 177775, 1.0015, 0.9973, 1.0067, 0.9967, 0.9984, 0.9952, 0.9983, 0.9920
177776, 178159, 1.0012, 0.9970, 1.0068, 0.9967, 0.9983, 0.9952, 1.0021, 0.9958
178160, 178723, 1.0001, 0.9959, 1.0075, 0.9975, 0.9943, 0.9912, 0.9981, 0.9917
178724, 179475, 1.0004, 0.9962, 1.0071, 0.9971, 0.9925, 0.9894, 0.9993, 0.9930
179476, 180252, 1.0015, 0.9973, 1.0081, 0.9981, 0.9939, 0.9908, 0.9983, 0.9920
25 changes: 25 additions & 0 deletions EgammaAnalysis/ElectronTools/data/scalesMoriond.csv
@@ -0,0 +1,25 @@
190645,190781,1.0020,0.9980,1.0032,0.9919,0.9945,0.9881,0.9965,0.9862
190782,191042,1.0079,1.0039,1.0063,0.9951,0.9996,0.9932,1.0010,0.9907
191043,193555,0.9989,0.9949,0.9998,0.9885,0.9968,0.9904,0.9987,0.9884
193556,194150,0.9974,0.9934,0.9954,0.9841,0.9969,0.9905,0.9988,0.9885
194151,194532,0.9980,0.9940,0.9965,0.9852,0.9986,0.9922,0.9994,0.9891
194533,195113,0.9983,0.9943,0.9984,0.9872,1.0006,0.9943,0.9999,0.9896
195114,195915,0.9984,0.9944,0.9977,0.9864,1.0010,0.9946,1.0004,0.9900
195916,198115,0.9975,0.9936,0.9965,0.9852,1.0020,0.9956,0.9992,0.9889
198116,199803,1.0010,0.9970,0.9999,0.9886,0.9963,0.9899,1.0044,0.9941
199804,200048,1.0021,0.9982,1.0008,0.9895,0.9965,0.9901,1.0060,0.9957
200049,200151,1.0035,0.9996,1.0017,0.9905,0.9992,0.9928,1.0101,0.9999
200152,200490,1.0013,0.9973,1.0003,0.9890,0.9991,0.9927,1.0073,0.9970
200491,200531,1.0035,0.9995,1.0017,0.9905,0.9995,0.9931,1.0106,1.0004
200532,201656,1.0017,0.9978,0.9999,0.9887,0.9978,0.9914,1.0069,0.9967
201657,202305,1.0026,0.9986,1.0003,0.9891,0.9987,0.9923,1.0121,1.0018
202305,203002,1.0037,0.9998,1.0010,0.9897,1.0003,0.9940,1.0144,1.0042
203003,203984,1.0061,1.0024,1.0021,0.9923,0.9994,0.9914,1.0122,1.0033
203985,205085,1.0050,1.0012,1.0045,0.9947,1.0004,0.9924,1.0108,1.0018
205086,205310,1.0062,1.0025,1.0045,0.9947,1.0060,0.9981,1.0208,1.0119
205311,206207,1.0056,1.0018,1.0033,0.9935,1.0015,0.9936,1.0157,1.0068
206208,206483,1.0060,1.0022,1.0036,0.9938,0.9993,0.9913,1.0181,1.0092
206484,206597,1.0062,1.0025,1.0033,0.9935,1.0043,0.9964,1.0172,1.0082
206598,206896,1.0060,1.0023,1.0021,0.9923,0.9980,0.9900,1.0169,1.0079
206897,207220,1.0063,1.0025,1.0033,0.9935,0.9985,0.9905,1.0180,1.0091
207221,208686,1.0064,1.0026,1.0036,0.9938,1.0027,0.9948,1.0190,1.0100
51 changes: 51 additions & 0 deletions EgammaAnalysis/ElectronTools/data/scalesNewReg-May2013.csv
@@ -0,0 +1,51 @@
190645, 190781, 0.9952, 0.9910, 1.0021, 0.9902, 0.9976, 0.9895, 1.0029, 0.9928
190782, 191042, 1.0017, 0.9976, 1.0076, 0.9957, 0.9980, 0.9898, 0.9954, 0.9852
191043, 191720, 0.9960, 0.9919, 1.0023, 0.9904, 0.9997, 0.9916, 0.9984, 0.9884
191721, 193833, 0.9951, 0.9910, 1.0035, 0.9916, 0.9993, 0.9912, 0.9989, 0.9888
193834, 194116, 0.9953, 0.9912, 1.0013, 0.9894, 0.9973, 0.9892, 0.9986, 0.9886
194117, 194427, 0.9960, 0.9919, 1.0029, 0.9910, 1.0003, 0.9922, 1.0012, 0.9911
194428, 194618, 0.9954, 0.9913, 1.0024, 0.9905, 0.9987, 0.9906, 0.9977, 0.9876
194619, 194789, 0.9957, 0.9916, 1.0028, 0.9909, 1.0007, 0.9926, 0.9996, 0.9896
194790, 195111, 0.9969, 0.9928, 1.0054, 0.9935, 1.0045, 0.9964, 1.0013, 0.9913
195112, 195377, 0.9970, 0.9929, 1.0038, 0.9920, 1.0043, 0.9962, 1.0030, 0.9929
195378, 195398, 0.9956, 0.9914, 1.0023, 0.9904, 0.9998, 0.9917, 0.9997, 0.9896
195399, 195657, 0.9967, 0.9925, 1.0045, 0.9927, 1.0021, 0.9940, 1.0019, 0.9919
195658, 195918, 0.9971, 0.9930, 1.0051, 0.9933, 1.0023, 0.9942, 1.0011, 0.9911
195919, 196198, 0.9963, 0.9922, 1.0032, 0.9913, 1.0030, 0.9949, 0.9999, 0.9899
196199, 196356, 0.9972, 0.9931, 1.0051, 0.9933, 1.0015, 0.9934, 1.0018, 0.9917
196357, 198115, 0.9962, 0.9921, 1.0019, 0.9900, 0.9984, 0.9903, 0.9979, 0.9878
198116, 198940, 0.9960, 0.9919, 1.0024, 0.9905, 1.0025, 0.9945, 1.0025, 0.9924
198941, 199317, 0.9963, 0.9921, 1.0031, 0.9913, 0.9990, 0.9908, 1.0006, 0.9905
199318, 199428, 0.9957, 0.9916, 1.0041, 0.9922, 1.0015, 0.9934, 1.0026, 0.9926
199429, 199697, 0.9960, 0.9918, 1.0023, 0.9904, 0.9978, 0.9897, 0.9995, 0.9895
199698, 199832, 0.9964, 0.9923, 1.0035, 0.9916, 0.9997, 0.9916, 1.0009, 0.9909
199833, 199960, 0.9966, 0.9925, 1.0024, 0.9905, 1.0017, 0.9936, 1.0026, 0.9925
199961, 200151, 0.9969, 0.9928, 1.0026, 0.9907, 0.9986, 0.9905, 1.0034, 0.9934
200152, 200490, 0.9965, 0.9924, 1.0029, 0.9911, 1.0009, 0.9928, 1.0012, 0.9911
200491, 200991, 0.9974, 0.9933, 1.0029, 0.9910, 1.0017, 0.9936, 1.0020, 0.9919
200992, 201201, 0.9963, 0.9922, 1.0031, 0.9912, 0.9961, 0.9880, 1.0031, 0.9930
201202, 201624, 0.9970, 0.9929, 1.0048, 0.9929, 1.0001, 0.9919, 1.0057, 0.9957
201625, 201707, 0.9971, 0.9930, 1.0035, 0.9916, 1.0004, 0.9923, 1.0033, 0.9933
201708, 202059, 0.9969, 0.9927, 1.0034, 0.9915, 1.0008, 0.9927, 1.0030, 0.9929
202060, 202204, 0.9971, 0.9929, 1.0024, 0.9905, 0.9995, 0.9914, 1.0038, 0.9938
202205, 202332, 0.9979, 0.9938, 1.0044, 0.9925, 1.0030, 0.9949, 1.0043, 0.9943
202333, 202972, 0.9974, 0.9932, 1.0035, 0.9916, 1.0003, 0.9922, 1.0031, 0.9931
202973, 203002, 0.9964, 0.9923, 0.9999, 0.9879, 0.9999, 0.9918, 1.0027, 0.9926
203853, 204099, 0.9955, 0.9914, 1.0029, 0.9911, 0.9982, 0.9901, 0.9987, 0.9887
204100, 204562, 0.9965, 0.9923, 1.0051, 0.9932, 1.0015, 0.9934, 1.0041, 0.9941
204563, 205085, 0.9959, 0.9918, 1.0048, 0.9929, 1.0023, 0.9942, 0.9990, 0.9889
205086, 205310, 0.9964, 0.9923, 1.0044, 0.9926, 1.0030, 0.9949, 1.0018, 0.9917
205311, 205617, 0.9956, 0.9914, 1.0022, 0.9904, 0.9994, 0.9913, 0.9981, 0.9880
205618, 205825, 0.9963, 0.9921, 1.0025, 0.9906, 1.0019, 0.9938, 0.9997, 0.9897
205826, 206207, 0.9976, 0.9935, 1.0050, 0.9931, 1.0043, 0.9962, 1.0042, 0.9942
206208, 206389, 0.9964, 0.9922, 1.0041, 0.9923, 0.9970, 0.9889, 0.9990, 0.9889
206390, 206483, 0.9963, 0.9922, 1.0033, 0.9915, 1.0033, 0.9952, 1.0033, 0.9933
206484, 206597, 0.9966, 0.9925, 1.0038, 0.9919, 1.0050, 0.9969, 1.0001, 0.9901
206598, 206896, 0.9955, 0.9914, 1.0024, 0.9905, 0.9982, 0.9901, 1.0000, 0.9899
206897, 207220, 0.9972, 0.9930, 1.0031, 0.9913, 0.9999, 0.9918, 1.0045, 0.9945
207221, 207315, 0.9966, 0.9925, 1.0035, 0.9917, 1.0013, 0.9932, 0.9994, 0.9893
207316, 207489, 0.9971, 0.9930, 1.0046, 0.9928, 1.0032, 0.9951, 1.0012, 0.9912
207490, 207919, 0.9966, 0.9925, 1.0044, 0.9925, 1.0013, 0.9932, 0.9988, 0.9887
207920, 208351, 0.9964, 0.9923, 1.0028, 0.9909, 1.0014, 0.9933, 1.0032, 0.9932
208352, 208686, 0.9966, 0.9925, 1.0045, 0.9926, 1.0037, 0.9956, 1.0026, 0.9926

152 changes: 152 additions & 0 deletions EgammaAnalysis/ElectronTools/interface/EGammaCutBasedEleId.h
@@ -0,0 +1,152 @@

//
// to use this code outside of CMSSW
// set this definition
//

//#define STANDALONEID
#ifndef STANDALONEID
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
#include "DataFormats/EgammaCandidates/interface/Conversion.h"
#include "DataFormats/Common/interface/ValueMap.h"
#include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#endif

#include <vector>

namespace EgammaCutBasedEleId {

//
// typedefs
//

typedef std::vector< edm::Handle< edm::ValueMap<reco::IsoDeposit> > > IsoDepositMaps;
typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsoDepositVals;

//
// defined ID working points
//

enum WorkingPoint {
VETO,
LOOSE,
MEDIUM,
TIGHT
};

enum TriggerWorkingPoint {
TRIGGERTIGHT,
TRIGGERWP70
};

//
// cuts used within working points
//

enum CutType {
DETAIN = (1<<0),
DPHIIN = (1<<1),
SIGMAIETAIETA = (1<<2),
HOE = (1<<3),
OOEMOOP = (1<<4),
D0VTX = (1<<5),
DZVTX = (1<<6),
ISO = (1<<7),
VTXFIT = (1<<8),
MHITS = (1<<9)
};

//
// all possible cuts pass
//

static const unsigned int PassAll = DETAIN | DPHIIN | SIGMAIETAIETA | HOE | OOEMOOP | D0VTX | DZVTX | ISO | VTXFIT | MHITS;

//
// CMSSW interface
//

#ifndef STANDALONEID

bool PassWP(const WorkingPoint workingPoint,
const reco::GsfElectronRef &ele,
const edm::Handle<reco::ConversionCollection> &conversions,
const reco::BeamSpot &beamspot,
const edm::Handle<reco::VertexCollection> &vtxs,
const double &iso_ch,
const double &iso_em,
const double &iso_nh,
const double &rho);


bool PassWP(const WorkingPoint workingPoint,
const reco::GsfElectron &ele,
const edm::Handle<reco::ConversionCollection> &conversions,
const reco::BeamSpot &beamspot,
const edm::Handle<reco::VertexCollection> &vtxs,
const double &iso_ch,
const double &iso_em,
const double &iso_nh,
const double &rho);


bool PassTriggerCuts(const TriggerWorkingPoint triggerWorkingPoint, const reco::GsfElectronRef &ele);

bool PassTriggerCuts(const TriggerWorkingPoint triggerWorkingPoint, const reco::GsfElectron &ele);

bool PassEoverPCuts(const reco::GsfElectronRef &ele);

bool PassEoverPCuts(const reco::GsfElectron &ele);

unsigned int TestWP(const WorkingPoint workingPoint,
const reco::GsfElectronRef &ele,
const edm::Handle<reco::ConversionCollection> &conversions,
const reco::BeamSpot &beamspot,
const edm::Handle<reco::VertexCollection> &vtxs,
const double &iso_ch,
const double &iso_em,
const double &iso_nh,
const double &rho);

unsigned int TestWP(const WorkingPoint workingPoint,
const reco::GsfElectron &ele,
const edm::Handle<reco::ConversionCollection> &conversions,
const reco::BeamSpot &beamspot,
const edm::Handle<reco::VertexCollection> &vtxs,
const double &iso_ch,
const double &iso_em,
const double &iso_nh,
const double &rho);

#endif

//
// implementation of working points
// used by CMSSW interface, does not
// itself depend on CMSSW code
//

bool PassWP(WorkingPoint workingPoint, const bool isEB, const float pt, const float eta,
const float dEtaIn, const float dPhiIn, const float sigmaIEtaIEta, const float hoe,
const float ooemoop, const float d0vtx, const float dzvtx, const float iso_ch, const float iso_em, const float iso_nh,
const bool vtxFitConversion, const unsigned int mHits, const double rho);

bool PassTriggerCuts(const TriggerWorkingPoint triggerWorkingPoint, const bool isEB, const float pt,
const float dEtaIn, const float dPhiIn, const float sigmaIEtaIEta, const float hoe,
const float trackIso, const float ecalIso, const float hcalIso);

bool PassEoverPCuts(const float eta, const float eopin, const float fbrem);

unsigned int TestWP(WorkingPoint workingPoint, const bool isEB, const float pt, const float eta,
const float dEtaIn, const float dPhiIn, const float sigmaIEtaIEta, const float hoe,
const float ooemoop, const float d0vtx, const float dzvtx, const float iso_ch, const float iso_em, const float iso_nh,
const bool vtxFitConversion, const unsigned int mHits, const double rho);

// print the bit mask
void PrintDebug(unsigned int mask);

}