Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:59:04

0001 // -*- C++ -*-
0002 //
0003 // Package:    testEcalClusterFunctions
0004 // Class:      testEcalClusterFunctions
0005 //
0006 /**\class testEcalClusterFunctions testEcalClusterFunctions.cc
0007 
0008 Description: <one line class summary>
0009 
0010 Implementation:
0011 <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  "Federico Ferri federi
0015 //         Created:  Mon Apr  7 14:11:00 CEST 2008
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0025 
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028 
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030 
0031 #include "FWCore/Framework/interface/ESHandle.h"
0032 #include "FWCore/Framework/interface/ConsumesCollector.h"
0033 
0034 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h"
0035 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h"
0036 
0037 #include "CondFormats/EcalObjects/interface/EcalFunctionParameters.h"
0038 
0039 class testEcalClusterFunctions : public edm::one::EDAnalyzer<> {
0040 public:
0041   explicit testEcalClusterFunctions(const edm::ParameterSet&);
0042   ~testEcalClusterFunctions() override = default;
0043 
0044 private:
0045   void analyze(const edm::Event&, const edm::EventSetup&) override;
0046   std::unique_ptr<EcalClusterFunctionBaseClass> ff_;
0047 };
0048 
0049 testEcalClusterFunctions::testEcalClusterFunctions(const edm::ParameterSet& ps) {
0050   std::string functionName = ps.getParameter<std::string>("functionName");
0051   ff_ = EcalClusterFunctionFactory::get()->create(functionName, ps, consumesCollector());
0052   std::cout << "got " << functionName << " function at: " << ff_.get() << "\n";
0053 }
0054 
0055 void testEcalClusterFunctions::analyze(const edm::Event& ev, const edm::EventSetup& es) {
0056   // init function parameters
0057   ff_->init(es);
0058   // basic test with empty collections
0059   reco::BasicCluster bc;
0060   EcalRecHitCollection rhColl;
0061   float corr = ff_->getValue(bc, rhColl);
0062   std::cout << "correction: " << corr << "\n";
0063 }
0064 
0065 //define this as a plug-in
0066 DEFINE_FWK_MODULE(testEcalClusterFunctions);