Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:22

0001 #include "RecoEgamma/EgammaTools/interface/BaselinePFSCRegression.h"
0002 #include "RecoEgamma/EgammaTools/interface/EcalRegressionData.h"
0003 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
0004 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
0005 
0006 #include "TVector2.h"
0007 #include "DataFormats/Math/interface/deltaR.h"
0008 
0009 void BaselinePFSCRegression::update(const edm::EventSetup& es) {
0010   const CaloTopologyRecord& topofrom_es = es.get<CaloTopologyRecord>();
0011   if (!topo_record || topofrom_es.cacheIdentifier() != topo_record->cacheIdentifier()) {
0012     topo_record = &topofrom_es;
0013     topo_record->get(calotopo);
0014   }
0015   const CaloGeometryRecord& geomfrom_es = es.get<CaloGeometryRecord>();
0016   if (!geom_record || geomfrom_es.cacheIdentifier() != geom_record->cacheIdentifier()) {
0017     geom_record = &geomfrom_es;
0018     geom_record->get(calogeom);
0019   }
0020 }
0021 
0022 void BaselinePFSCRegression::set(const reco::SuperCluster& sc, std::vector<float>& vars) const {
0023   EcalRegressionData regData;
0024   regData.fill(sc, rechitsEB, rechitsEE, calogeom.product(), calotopo.product(), vertices);
0025   regData.fillVec(vars);
0026 
0027   //solely to reproduce old exception behaviour, unnessessary although it likely is
0028   if (sc.seed()->hitsAndFractions().at(0).first.subdetId() != EcalBarrel &&
0029       sc.seed()->hitsAndFractions().at(0).first.subdetId() != EcalEndcap) {
0030     throw cms::Exception("PFECALSuperClusterProducer::calculateRegressedEnergy")
0031         << "Supercluster seed is either EB nor EE!" << std::endl;
0032   }
0033 }
0034 
0035 void BaselinePFSCRegression::setTokens(const edm::ParameterSet& ps, edm::ConsumesCollector&& cc) {
0036   inputTagEBRecHits_ = cc.consumes(ps.getParameter<edm::InputTag>("ecalRecHitsEB"));
0037   inputTagEERecHits_ = cc.consumes(ps.getParameter<edm::InputTag>("ecalRecHitsEE"));
0038   inputTagVertices_ = cc.consumes(ps.getParameter<edm::InputTag>("vertexCollection"));
0039 }
0040 
0041 void BaselinePFSCRegression::setEvent(const edm::Event& ev) {
0042   rechitsEB = &ev.get(inputTagEBRecHits_);
0043   rechitsEE = &ev.get(inputTagEERecHits_);
0044   vertices = &ev.get(inputTagVertices_);
0045 }