File indexing completed on 2023-10-25 09:59:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <memory>
0021
0022
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
0057 ff_->init(es);
0058
0059 reco::BasicCluster bc;
0060 EcalRecHitCollection rhColl;
0061 float corr = ff_->getValue(bc, rhColl);
0062 std::cout << "correction: " << corr << "\n";
0063 }
0064
0065
0066 DEFINE_FWK_MODULE(testEcalClusterFunctions);