Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-04 23:36:08

0001 //--------------------------------------------------------------------------------------------------
0002 //
0003 // SCEnergyCorrectorDRN
0004 //
0005 // Helper Class for applying regression-based energy corrections with DRN implimentation
0006 //
0007 // Based on RecoEcal/EgammaClusterAlgos/SCEnergyCorrectorSemiParm
0008 //
0009 // Author: Simon Rothman (MIT, UMN)
0010 //
0011 //--------------------------------------------------------------------------------------------------
0012 
0013 #ifndef RecoEcal_EgammaClusterAlgos_SCEnergyCorrectorDRN_h
0014 #define RecoEcal_EgammaClusterAlgos_SCEnergyCorrectorDRN_h
0015 
0016 #include "HeterogeneousCore/SonicTriton/interface/TritonData.h"
0017 
0018 #include "FWCore/Framework/interface/EventSetup.h"
0019 #include "FWCore/Framework/interface/ESHandle.h"
0020 #include "FWCore/Framework/interface/ConsumesCollector.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 
0023 #include "Geometry/Records/interface/CaloTopologyRecord.h"
0024 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0025 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0026 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0027 
0028 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0029 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0030 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0031 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0032 #include "DataFormats/ParticleFlowReco/interface/PFRecHit.h"
0033 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0034 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0035 
0036 #include "CondFormats/GBRForest/interface/GBRForestD.h"
0037 #include "CondFormats/DataRecord/interface/GBRDWrapperRcd.h"
0038 
0039 #include "RecoEgamma/EgammaTools/interface/EgammaBDTOutputTransformer.h"
0040 #include "RecoEgamma/EgammaTools/interface/HGCalShowerShapeHelper.h"
0041 
0042 #include <sstream>
0043 #include <string>
0044 #include <vector>
0045 #include <random>
0046 
0047 class SCEnergyCorrectorDRN {
0048 public:
0049   SCEnergyCorrectorDRN();
0050   //if you want override the default on where conditions are consumed, you need to use
0051   //the other constructor and then call setTokens approprately
0052   SCEnergyCorrectorDRN(const edm::ParameterSet& iConfig, edm::ConsumesCollector cc);
0053 
0054   static void fillPSetDescription(edm::ParameterSetDescription& desc);
0055   static edm::ParameterSetDescription makePSetDescription();
0056 
0057   template <edm::Transition tr = edm::Transition::BeginLuminosityBlock>
0058   void setTokens(const edm::ParameterSet& iConfig, edm::ConsumesCollector cc);
0059 
0060   void setEventSetup(const edm::EventSetup& es);
0061   void setEvent(const edm::Event& e);
0062 
0063   void makeInput(const edm::Event& iEvent, TritonInputMap& iInput, const reco::SuperClusterCollection& inputSCs) const;
0064   TritonOutput<float> getOutput(const TritonOutputMap& iOutput);
0065 
0066 private:
0067   const CaloTopology* caloTopo_;
0068   const CaloGeometry* caloGeom_;
0069   edm::ESGetToken<CaloTopology, CaloTopologyRecord> caloTopoToken_;
0070   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_;
0071 
0072   edm::EDGetTokenT<EcalRecHitCollection> tokenEBRecHits_;
0073   edm::EDGetTokenT<EcalRecHitCollection> tokenEERecHits_;
0074   edm::EDGetTokenT<double> rhoToken_;
0075 
0076   edm::Handle<EcalRecHitCollection> recHitsEB_;
0077   edm::Handle<EcalRecHitCollection> recHitsEE_;
0078 
0079   edm::Handle<double> rhoHandle_;
0080 };
0081 
0082 template <edm::Transition esTransition>
0083 void SCEnergyCorrectorDRN::setTokens(const edm::ParameterSet& iConfig, edm::ConsumesCollector cc) {
0084   tokenEBRecHits_ = cc.consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("ecalRecHitsEB"));
0085   tokenEERecHits_ = cc.consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("ecalRecHitsEE"));
0086   caloGeomToken_ = cc.esConsumes<CaloGeometry, CaloGeometryRecord, esTransition>();
0087   caloTopoToken_ = cc.esConsumes<CaloTopology, CaloTopologyRecord, esTransition>();
0088   rhoToken_ = cc.consumes<double>(iConfig.getParameter<edm::InputTag>("rhoFastJet"));
0089 }
0090 #endif