|
12 | 12 |
|
13 | 13 | struct KElectronMetadata |
14 | 14 | { |
15 | | - std::vector<std::string> idNames; |
| 15 | + std::vector<std::string> idNames; //< names of configurable electron IDs |
16 | 16 | }; |
17 | 17 |
|
18 | | -struct KElectron : public KLepton |
| 18 | +namespace KElectronType { enum Type |
19 | 19 | { |
20 | | - /// Isolation variables |
21 | | - float trackIso03; // dr03TkSumPt: track iso deposit with electron footprint removed (Delta R = 0.3) |
22 | | - float ecalIso03; // dr03EcalRecHitSumEt: ecal iso deposit with electron footprint removed. |
23 | | - float hcal1Iso03; // dr03HcalDepth1TowerSumEt: hcal depht 1 iso deposit with electron footprint removed. |
24 | | - float hcal2Iso03; // dr03HcalDepth2TowerSumEt: hcal depht 2 iso deposit with electron footprint removed. |
25 | | - inline float hcalIso03() const { return hcal1Iso03 + hcal2Iso03; }; // dr03HcalTowerSumEt |
| 20 | + ecalEnergyCorrected = 0, //< true if ecal energy has been corrected = isEcalScaleCorrected |
| 21 | + momentumCorrected = 1, //< true if E-p combination has been applied. |
| 22 | + ecalDriven = 2, //< |
| 23 | + trackerDriven = 3, //< |
| 24 | + cutPreselected = 4, //< |
| 25 | + mvaPreselected = 5, //< |
| 26 | + ecalDrivenSeed = 6, //< can be replaced if space is needed = preselection + ecalDriven |
| 27 | + hasConversionMatch = 7 //< |
| 28 | +}; |
| 29 | +} |
26 | 30 |
|
27 | | - float trackIso04; // same isolations with Delta R = 0.4 |
28 | | - float ecalIso04; |
29 | | - float hcal1Iso04; |
30 | | - float hcal2Iso04; |
31 | | - inline float hcalIso04() const { return hcal1Iso04 + hcal2Iso04; }; |
32 | 31 |
|
33 | | - float pfIsoCh; // PF isolation from PAT electrons isoVals |
34 | | - float pfIsoEm; |
35 | | - float pfIsoNh; |
| 32 | +struct KElectron : public KLepton |
| 33 | +{ |
| 34 | + /// identification results |
| 35 | + std::vector<float> electronIds; //< configurable electron IDs (mainly for MVA IDs) |
36 | 36 |
|
37 | | - /// Identification |
| 37 | + /// identification variables |
38 | 38 | /// Variables for cutbased electron identification (cf. reco::GsfElectron) |
39 | | - // https://twiki.cern.ch/twiki/bin/viewauth/CMS/EgammaCutBasedIdentification |
40 | | - float deltaEtaSuperClusterTrackAtVtx; // dEtaIn |
41 | | - float deltaPhiSuperClusterTrackAtVtx; // dPhiIn |
| 39 | + /// https://twiki.cern.ch/twiki/bin/viewauth/CMS/EgammaCutBasedIdentification?rev=32 |
| 40 | + unsigned char fiducialFlags; //< ECAL region: bits are set according to reco::GsfElectron::FiducialFlags |
| 41 | + unsigned char electronType; //< cf. enum KElectronType::Type |
| 42 | + float dEtaIn; //< deltaEtaSuperClusterTrackAtVtx |
| 43 | + float dPhiIn; //< deltaPhiSuperClusterTrackAtVtx |
42 | 44 | float sigmaIetaIeta; |
43 | 45 | float hadronicOverEm; |
44 | 46 | float fbrem; |
| 47 | + //d0 dz vertexfitprob + missing hits |
45 | 48 | float eSuperClusterOverP; |
46 | | - float superclusterEnergy; //supercluster |
47 | | - RMPoint superclusterPosition; |
48 | | - bool ecalDrivenSeed; |
49 | | - bool ecalDriven; |
50 | | - bool isEcalEnergyCorrected; //true if ecal energy has been corrected. = isEcalScaleCorrected |
51 | | - float ecalEnergy; //the new corrected value, or the supercluster energy. |
52 | | - float ecalEnergyError; |
53 | | - bool isMomentumCorrected; //true if E-p combination has been applied. |
54 | | - float trackMomentumError; //track momentum error from gsf fit. |
55 | | - float electronMomentumError; //the final electron momentum error. |
56 | | - bool hasConversionMatch; |
57 | | - int status; |
58 | | - /// calculable quantities: p_in and 1/E - 1/p_in: |
59 | | - inline float trackMomentumAtVtxP() const { return ecalEnergy / eSuperClusterOverP; }; |
60 | | - inline float invEMinusInvP() const { return (1.0f - eSuperClusterOverP) / ecalEnergy; }; |
61 | | - |
62 | | - /// cutbased isolation results |
63 | | - unsigned char cutbasedIDs; |
64 | | - inline bool cutbasedIdLoose() const { return (cutbasedIDs & (1 << 0)); }; |
65 | | - inline bool cutbasedIdMedium() const { return (cutbasedIDs & (1 << 1)); }; |
66 | | - inline bool cutbasedIdTight() const { return (cutbasedIDs & (1 << 2)); }; |
67 | | - inline bool cutbasedIdVeto() const { return (cutbasedIDs & (1 << 3)); }; |
68 | | - |
| 49 | + float superclusterEnergy; |
| 50 | + float ecalEnergy; //< the new corrected value, or the supercluster energy. |
| 51 | + float ecalEnergyErr; |
| 52 | + float trackMomentumErr; //< track momentum error from gsf fit. |
| 53 | + float electronMomentumErr; //< the final electron momentum error. |
| 54 | + RMPoint superclusterPosition; //< position of the supercluster |
69 | 55 |
|
70 | | - // ECAL region: bits are set according to reco::GsfElectron::FiducialFlags |
71 | | - unsigned char fiducialFlags; // container for all 7 bits |
72 | | - // accessor functions: must be in sync with KElectronProducer |
73 | | - inline bool isEB() const { return (fiducialFlags & (1 << 0)); }; // is e in ECAL Barrel (EB) |
74 | | - inline bool isEE() const { return (fiducialFlags & (1 << 1)); }; // is e in ECAL Endcaps (EE) |
75 | | - inline bool isEBEEGap() const { return (fiducialFlags & (1 << 2)); }; // is e in the crack between EB and EE |
76 | | - inline bool isEBEtaGap() const { return (fiducialFlags & (1 << 3)); }; // is e in EB and in the eta gaps between modules |
77 | | - inline bool isEBPhiGap() const { return (fiducialFlags & (1 << 4)); }; // is e in EB and in the phi gaps between modules |
78 | | - inline bool isEEDeeGap() const { return (fiducialFlags & (1 << 5)); }; // is e in EE and in the gaps between dees |
79 | | - inline bool isEERingGap() const { return (fiducialFlags & (1 << 6)); }; // is e in EE and in the gaps between rings |
80 | | - inline bool isEBGap() const { return isEBEtaGap() || isEBPhiGap(); }; // is e in in any EB gap |
81 | | - inline bool isEEGap() const { return isEEDeeGap() || isEERingGap(); }; // is e in any EE gap |
82 | | - inline bool isGap() const { return isEBEEGap() || isEBGap() || isEEGap(); }; // is e in any gap |
| 56 | + /// Isolation results |
| 57 | + float trackIso; //< dr03TkSumPt: track iso deposit with electron footprint removed (Delta R = 0.3) |
| 58 | + float ecalIso; //< dr03EcalRecHitSumEt: ecal iso deposit with electron footprint removed. |
| 59 | + float hcal1Iso; //< dr03HcalDepth1TowerSumEt: hcal depht 1 iso deposit with electron footprint removed. |
| 60 | + float hcal2Iso; //< dr03HcalDepth2TowerSumEt: hcal depht 2 iso deposit with electron footprint removed. |
83 | 61 |
|
84 | | - /// Configurable MVA IDs |
85 | | - /** Run2: https://twiki.cern.ch/twiki/bin/viewauth/CMS/MultivariateElectronIdentificationRun2 |
86 | | - * Full instructions in Producer/interface/KElectrons_cff |
87 | | - */ |
88 | | - std::vector<float> electronIds; |
| 62 | + /// calculable quantities: |
| 63 | + inline float pIn() const { return ecalEnergy / eSuperClusterOverP; }; //< trackMomentumAtVtxP |
| 64 | + inline float invEMinusInvP() const { return (1.0f - eSuperClusterOverP) / ecalEnergy; }; //< 1/E - 1/p_in |
| 65 | + inline float hcalIso() const { return hcal1Iso + hcal2Iso; }; //< dr03HcalTowerSumEt |
89 | 66 |
|
90 | | - float getId(const std::string &name, const KElectronMetadata *idMetadata) const |
| 67 | + /// get configurable (MVA) ID |
| 68 | + float getId(const std::string &name, const KElectronMetadata* meta) const |
91 | 69 | { |
92 | | - for (unsigned int i = 0; i < idMetadata->idNames.size(); ++i) |
| 70 | + for (unsigned int i = 0; i < meta->idNames.size(); ++i) |
93 | 71 | { |
94 | | - if (idMetadata->idNames[i] == name) |
| 72 | + if (meta->idNames[i] == name) |
95 | 73 | return electronIds[i]; |
96 | 74 | } |
97 | | - std::cout << "ElectronId " << name << " not available!" << std::endl; |
| 75 | + std::cout << "Electron ID " << name << " not available!" << std::endl; |
98 | 76 | exit(1); |
99 | 77 | } |
100 | 78 |
|
| 79 | + /** Accessor functions to gap values |
| 80 | + * must be in sync with KElectronProducer |
| 81 | + */ |
| 82 | + inline bool isEB() const { return (fiducialFlags & (1 << 0)); }; //< is e in ECAL Barrel (EB) |
| 83 | + inline bool isEE() const { return (fiducialFlags & (1 << 1)); }; //< is e in ECAL Endcaps (EE) |
| 84 | + inline bool isEBEEGap() const { return (fiducialFlags & (1 << 2)); }; //< is e in the crack between EB and EE |
| 85 | + inline bool isEBEtaGap() const { return (fiducialFlags & (1 << 3)); }; //< is e in EB and in the eta gaps between modules |
| 86 | + inline bool isEBPhiGap() const { return (fiducialFlags & (1 << 4)); }; //< is e in EB and in the phi gaps between modules |
| 87 | + inline bool isEEDeeGap() const { return (fiducialFlags & (1 << 5)); }; //< is e in EE and in the gaps between dees |
| 88 | + inline bool isEERingGap() const { return (fiducialFlags & (1 << 6)); }; //< is e in EE and in the gaps between rings |
| 89 | + inline bool isEBGap() const { return isEBEtaGap() || isEBPhiGap(); }; //< is e in in any EB gap |
| 90 | + inline bool isEEGap() const { return isEEDeeGap() || isEERingGap(); }; //< is e in any EE gap |
| 91 | + inline bool isGap() const { return isEBEEGap() || isEBGap() || isEEGap(); }; // is e in any gap |
| 92 | + |
| 93 | + |
101 | 94 | }; |
102 | 95 | typedef std::vector<KElectron> KElectrons; |
103 | 96 |
|
|
0 commit comments