Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:56

0001 
0002 //
0003 // to use this code outside of CMSSW
0004 // set this definition
0005 //
0006 
0007 //#define STANDALONEID
0008 #ifndef STANDALONEID
0009 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0010 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
0011 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
0012 #include "DataFormats/Common/interface/ValueMap.h"
0013 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
0014 #include "DataFormats/VertexReco/interface/Vertex.h"
0015 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0016 #endif
0017 #include "EgammaAnalysis/ElectronTools/interface/ElectronEffectiveArea.h"
0018 
0019 #include <vector>
0020 
0021 namespace EgammaCutBasedEleId {
0022 
0023   //
0024   // typedefs
0025   //
0026 
0027   typedef std::vector<edm::Handle<edm::ValueMap<reco::IsoDeposit> > > IsoDepositMaps;
0028   typedef std::vector<edm::Handle<edm::ValueMap<double> > > IsoDepositVals;
0029 
0030   //
0031   // defined ID working points
0032   //
0033 
0034   enum WorkingPoint { VETO, LOOSE, MEDIUM, TIGHT };
0035 
0036   enum TriggerWorkingPoint { TRIGGERTIGHT, TRIGGERWP70 };
0037 
0038   //
0039   // cuts used within working points
0040   //
0041 
0042   enum CutType {
0043     DETAIN = (1 << 0),
0044     DPHIIN = (1 << 1),
0045     SIGMAIETAIETA = (1 << 2),
0046     HOE = (1 << 3),
0047     OOEMOOP = (1 << 4),
0048     D0VTX = (1 << 5),
0049     DZVTX = (1 << 6),
0050     ISO = (1 << 7),
0051     VTXFIT = (1 << 8),
0052     MHITS = (1 << 9)
0053   };
0054 
0055   //
0056   // all possible cuts pass
0057   //
0058 
0059   static const unsigned int PassAll =
0060       DETAIN | DPHIIN | SIGMAIETAIETA | HOE | OOEMOOP | D0VTX | DZVTX | ISO | VTXFIT | MHITS;
0061 
0062   //
0063   // CMSSW interface
0064   //
0065 
0066 #ifndef STANDALONEID
0067 
0068   bool PassWP(const WorkingPoint workingPoint,
0069               const reco::GsfElectronRef &ele,
0070               const edm::Handle<reco::ConversionCollection> &conversions,
0071               const reco::BeamSpot &beamspot,
0072               const edm::Handle<reco::VertexCollection> &vtxs,
0073               const double &iso_ch,
0074               const double &iso_em,
0075               const double &iso_nh,
0076               const double &rho,
0077               ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);
0078 
0079   bool PassWP(const WorkingPoint workingPoint,
0080               const reco::GsfElectron &ele,
0081               const edm::Handle<reco::ConversionCollection> &conversions,
0082               const reco::BeamSpot &beamspot,
0083               const edm::Handle<reco::VertexCollection> &vtxs,
0084               const double &iso_ch,
0085               const double &iso_em,
0086               const double &iso_nh,
0087               const double &rho,
0088               ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);
0089 
0090   bool PassTriggerCuts(const TriggerWorkingPoint triggerWorkingPoint, const reco::GsfElectronRef &ele);
0091 
0092   bool PassTriggerCuts(const TriggerWorkingPoint triggerWorkingPoint, const reco::GsfElectron &ele);
0093 
0094   bool PassEoverPCuts(const reco::GsfElectronRef &ele);
0095 
0096   bool PassEoverPCuts(const reco::GsfElectron &ele);
0097 
0098   unsigned int TestWP(const WorkingPoint workingPoint,
0099                       const reco::GsfElectronRef &ele,
0100                       const edm::Handle<reco::ConversionCollection> &conversions,
0101                       const reco::BeamSpot &beamspot,
0102                       const edm::Handle<reco::VertexCollection> &vtxs,
0103                       const double &iso_ch,
0104                       const double &iso_em,
0105                       const double &iso_nh,
0106                       const double &rho,
0107                       ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);
0108 
0109   unsigned int TestWP(const WorkingPoint workingPoint,
0110                       const reco::GsfElectron &ele,
0111                       const edm::Handle<reco::ConversionCollection> &conversions,
0112                       const reco::BeamSpot &beamspot,
0113                       const edm::Handle<reco::VertexCollection> &vtxs,
0114                       const double &iso_ch,
0115                       const double &iso_em,
0116                       const double &iso_nh,
0117                       const double &rho,
0118                       ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);
0119 
0120 #endif
0121 
0122   //
0123   // implementation of working points
0124   // used by CMSSW interface, does not
0125   // itself depend on CMSSW code
0126   //
0127 
0128   bool PassWP(WorkingPoint workingPoint,
0129               const bool isEB,
0130               const float pt,
0131               const float eta,
0132               const float dEtaIn,
0133               const float dPhiIn,
0134               const float sigmaIEtaIEta,
0135               const float hoe,
0136               const float ooemoop,
0137               const float d0vtx,
0138               const float dzvtx,
0139               const float iso_ch,
0140               const float iso_em,
0141               const float iso_nh,
0142               const bool vtxFitConversion,
0143               const unsigned int mHits,
0144               const double rho,
0145               ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);
0146 
0147   bool PassTriggerCuts(const TriggerWorkingPoint triggerWorkingPoint,
0148                        const bool isEB,
0149                        const float pt,
0150                        const float dEtaIn,
0151                        const float dPhiIn,
0152                        const float sigmaIEtaIEta,
0153                        const float hoe,
0154                        const float trackIso,
0155                        const float ecalIso,
0156                        const float hcalIso);
0157 
0158   bool PassEoverPCuts(const float eta, const float eopin, const float fbrem);
0159 
0160   unsigned int TestWP(WorkingPoint workingPoint,
0161                       const bool isEB,
0162                       const float pt,
0163                       const float eta,
0164                       const float dEtaIn,
0165                       const float dPhiIn,
0166                       const float sigmaIEtaIEta,
0167                       const float hoe,
0168                       const float ooemoop,
0169                       const float d0vtx,
0170                       const float dzvtx,
0171                       const float iso_ch,
0172                       const float iso_em,
0173                       const float iso_nh,
0174                       const bool vtxFitConversion,
0175                       const unsigned int mHits,
0176                       const double rho,
0177                       ElectronEffectiveArea::ElectronEffectiveAreaTarget EAtarget);
0178 
0179   // print the bit mask
0180   void PrintDebug(unsigned int mask);
0181 
0182 }  // namespace EgammaCutBasedEleId