Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:21

0001 #ifndef __PFClusterEMEnergyCorrector_H__
0002 #define __PFClusterEMEnergyCorrector_H__
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/Framework/interface/ConsumesCollector.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 
0010 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
0011 #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
0012 #include "DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h"
0013 #include "DataFormats/ParticleFlowReco/interface/PFRecHit.h"
0014 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0015 #include "DataFormats/EcalDigi/interface/EBSrFlag.h"
0016 #include "DataFormats/EcalDigi/interface/EESrFlag.h"
0017 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0018 
0019 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
0020 #include "CalibCalorimetry/EcalTPGTools/interface/EcalReadoutTools.h"
0021 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyCalibration.h"
0022 
0023 #include "CondFormats/DataRecord/interface/GBRDWrapperRcd.h"
0024 #include "CondFormats/GBRForest/interface/GBRForestD.h"
0025 
0026 #include <vector>
0027 
0028 class PFClusterEMEnergyCorrector {
0029 public:
0030   PFClusterEMEnergyCorrector(const edm::ParameterSet& conf, edm::ConsumesCollector&& cc);
0031   PFClusterEMEnergyCorrector(const PFClusterEMEnergyCorrector&) = delete;
0032   PFClusterEMEnergyCorrector& operator=(const PFClusterEMEnergyCorrector&) = delete;
0033 
0034   void correctEnergies(const edm::Event& evt,
0035                        const edm::EventSetup& es,
0036                        const reco::PFCluster::EEtoPSAssociation& assoc,
0037                        reco::PFClusterCollection& cs);
0038 
0039 private:
0040   double maxPtForMVAEvaluation_;
0041 
0042   edm::EDGetTokenT<EBSrFlagCollection> ebSrFlagToken_;
0043   edm::EDGetTokenT<EESrFlagCollection> eeSrFlagToken_;
0044 
0045   //required for reading SR flags
0046   edm::EDGetTokenT<EcalRecHitCollection> recHitsEB_;
0047   edm::EDGetTokenT<EcalRecHitCollection> recHitsEE_;
0048   edm::EDGetTokenT<unsigned int> bunchSpacing_;
0049 
0050   const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_;
0051   const EcalReadoutTools::ESGetTokens ecalReadoutToolsESGetTokens_;
0052 
0053   std::vector<std::string> condnames_mean_;
0054   std::vector<std::string> condnames_sigma_;
0055 
0056   std::vector<std::string> condnames_mean_25ns_;
0057   std::vector<std::string> condnames_sigma_25ns_;
0058   std::vector<std::string> condnames_mean_50ns_;
0059   std::vector<std::string> condnames_sigma_50ns_;
0060 
0061   bool srfAwareCorrection_;
0062   bool applyCrackCorrections_;
0063   bool applyMVACorrections_;
0064   bool setEnergyUncertainty_;
0065 
0066   bool autoDetectBunchSpacing_;
0067   int bunchSpacingManual_;
0068 
0069   std::unique_ptr<PFEnergyCalibration> calibrator_;
0070   void getAssociatedPSEnergy(const size_t clusIdx,
0071                              const reco::PFCluster::EEtoPSAssociation& assoc,
0072                              float& e1,
0073                              float& e2);
0074 
0075   double meanlimlowEB_;
0076   double meanlimhighEB_;
0077   double meanoffsetEB_;
0078   double meanscaleEB_;
0079 
0080   double meanlimlowEE_;
0081   double meanlimhighEE_;
0082   double meanoffsetEE_;
0083   double meanscaleEE_;
0084 
0085   double sigmalimlowEB_;
0086   double sigmalimhighEB_;
0087   double sigmaoffsetEB_;
0088   double sigmascaleEB_;
0089 
0090   double sigmalimlowEE_;
0091   double sigmalimhighEE_;
0092   double sigmaoffsetEE_;
0093   double sigmascaleEE_;
0094 
0095 private:
0096   std::vector<edm::ESGetToken<GBRForestD, GBRDWrapperRcd> > forestMeanTokens_25ns_;
0097   std::vector<edm::ESGetToken<GBRForestD, GBRDWrapperRcd> > forestSigmaTokens_25ns_;
0098   std::vector<edm::ESGetToken<GBRForestD, GBRDWrapperRcd> > forestMeanTokens_50ns_;
0099   std::vector<edm::ESGetToken<GBRForestD, GBRDWrapperRcd> > forestSigmaTokens_50ns_;
0100 };
0101 
0102 #endif