Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:15

0001 //
0002 // to use this code outside of CMSSW
0003 // set this definition
0004 //
0005 
0006 //#define STANDALONE_ECALCORR
0007 #ifndef STANDALONE_ECALCORR
0008 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0009 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0010 #include "DataFormats/PatCandidates/interface/Electron.h"
0011 #include "DataFormats/PatCandidates/interface/Photon.h"
0012 #endif
0013 
0014 #include <string>
0015 #include <iostream>
0016 
0017 class EcalIsolationCorrector {
0018 public:
0019   enum RunRange { RunAB, RunC, RunD };
0020 
0021   EcalIsolationCorrector(bool forElectrons);
0022   ~EcalIsolationCorrector(){};
0023 
0024 #ifndef STANDALONE_ECALCORR
0025   // Global correction for ABCD together
0026   float correctForNoise(
0027       reco::GsfElectron e, bool isData = false, float intL_AB = 5.5, float intL_C = 6.7, float intL_D = 7.3);
0028   // Run dependent correction
0029   float correctForNoise(reco::GsfElectron e, int runNumber, bool isData = false);
0030   float correctForNoise(reco::GsfElectron e, std::string runName, bool isData = false);
0031 
0032   // Global correction for ABCD together
0033   float correctForHLTDefinition(
0034       reco::GsfElectron e, bool isData = false, float intL_AB = 5.5, float intL_C = 6.7, float intL_D = 7.3);
0035   // Run dependent correction
0036   float correctForHLTDefinition(reco::GsfElectron e, int runNumber, bool isData = false);
0037   float correctForHLTDefinition(reco::GsfElectron e, std::string runName, bool isData = false);
0038 
0039   // Global correction for ABCD together
0040   float correctForNoise(
0041       reco::Photon p, bool isData = false, float intL_AB = 5.5, float intL_C = 6.7, float intL_D = 7.3);
0042   // Run dependent correction
0043   float correctForNoise(reco::Photon p, int runNumber, bool isData = false);
0044   float correctForNoise(reco::Photon p, std::string runName, bool isData = false);
0045 
0046   // Global correction for ABCD together
0047   float correctForHLTDefinition(
0048       reco::Photon p, bool isData = false, float intL_AB = 5.5, float intL_C = 6.7, float intL_D = 7.3);
0049   // Run dependent correction
0050   float correctForHLTDefinition(reco::Photon p, int runNumber, bool isData = false);
0051   float correctForHLTDefinition(reco::Photon p, std::string runName, bool isData = false);
0052 
0053   // Global correction for ABCD together
0054   float correctForNoise(
0055       pat::Electron e, bool isData = false, float intL_AB = 5.5, float intL_C = 6.7, float intL_D = 7.3);
0056   // Run dependent correction
0057   float correctForNoise(pat::Electron e, int runNumber, bool isData = false);
0058   float correctForNoise(pat::Electron e, std::string runName, bool isData = false);
0059 
0060   // Global correction for ABCD together
0061   float correctForHLTDefinition(
0062       pat::Electron e, bool isData = false, float intL_AB = 5.5, float intL_C = 6.7, float intL_D = 7.3);
0063   // Run dependent correction
0064   float correctForHLTDefinition(pat::Electron e, int runNumber, bool isData = false);
0065   float correctForHLTDefinition(pat::Electron e, std::string runName, bool isData = false);
0066 
0067   // Global correction for ABCD together
0068   float correctForNoise(pat::Photon p, bool isData = false, float intL_AB = 5.5, float intL_C = 6.7, float intL_D = 7.3);
0069   // Run dependent correction
0070   float correctForNoise(pat::Photon p, int runNumber, bool isData = false);
0071   float correctForNoise(pat::Photon p, std::string runName, bool isData = false);
0072 
0073   // Global correction for ABCD together
0074   float correctForHLTDefinition(
0075       pat::Photon p, bool isData = false, float intL_AB = 5.5, float intL_C = 6.7, float intL_D = 7.3);
0076   // Run dependent correction
0077   float correctForHLTDefinition(pat::Photon p, int runNumber, bool isData = false);
0078   float correctForHLTDefinition(pat::Photon p, std::string runName, bool isData = false);
0079 #else
0080   // Global correction for ABCD together
0081   float correctForNoise(
0082       float unCorrIso, bool isBarrel, bool isData = false, float intL_AB = 5.5, float intL_C = 6.7, float intL_D = 7.3);
0083   // Run dependent correction
0084   float correctForNoise(float unCorrIso, bool isBarrel, int runNumber, bool isData = false);
0085   float correctForNoise(float unCorrIso, bool isBarrel, std::string runName, bool isData = false);
0086 
0087   // Global correction for ABCD together
0088   float correctForHLTDefinition(float unCorrIso,
0089                                 bool isBarrrel,
0090                                 bool isData = false,
0091                                 float intL_AB = 5.5,
0092                                 float intL_C = 6.7,
0093                                 float intL_D = 7.3);
0094   // Run dependent correction
0095   float correctForHLTDefinition(float unCorrIso, bool isBarrel, int runNumber, bool isData = false);
0096   float correctForHLTDefinition(float unCorrIso, bool isBarrel, std::string runName, bool isData = false);
0097 #endif
0098 
0099 protected:
0100   RunRange checkRunRange(int runNumber);
0101   float correctForNoise(float iso, bool isBarrel, RunRange runRange, bool isData);
0102   float correctForHLTDefinition(float iso, bool isBarrel, RunRange runRange);
0103 
0104 private:
0105   bool isElectron_;
0106 };