CutType

TriggerWorkingPoint

WorkingPoint

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182

//
// 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 "EgammaAnalysis/ElectronTools/interface/ElectronEffectiveArea.h"

#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,
              ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);

  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,
              ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);

  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,
                      ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);

  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,
                      ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);

#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,
              ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);

  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,
                      ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);

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

}  // namespace EgammaCutBasedEleId