Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:26

0001 // system includes
0002 #include <iostream>
0003 #include <memory>
0004 #include <string>
0005 
0006 // user includes
0007 #include "FWCore/Framework/interface/ESHandle.h"
0008 #include "FWCore/Framework/interface/Event.h"
0009 #include "FWCore/Framework/interface/EventSetup.h"
0010 #include "FWCore/Framework/interface/Frameworkfwd.h"
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015 #include "FWCore/Utilities/interface/InputTag.h"
0016 #include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h"
0017 #include "RecoLocalTracker/Records/interface/TkPixelCPERecord.h"
0018 
0019 using namespace edm;
0020 
0021 class CPEAccessTester : public edm::one::EDAnalyzer<> {
0022 public:
0023   CPEAccessTester(const edm::ParameterSet& pset)
0024       : cpeName_(pset.getParameter<std::string>("PixelCPE")), cpeToken_(esConsumes(edm::ESInputTag("", cpeName_))) {
0025     edm::LogPrint("CPEAccessTester") << "Asking for the CPE with name " << cpeName_;
0026   }
0027 
0028   ~CPEAccessTester() = default;
0029   void analyze(const edm::Event& event, const edm::EventSetup& setup) override {
0030     //
0031     // access the CPE
0032     //
0033     edm::ESHandle<PixelClusterParameterEstimator> theEstimator = setup.getHandle(cpeToken_);
0034     auto& estimator = *theEstimator;
0035     edm::LogPrint("CPEAccessTester") << "Got a " << typeid(estimator).name();
0036   }
0037 
0038 private:
0039   const std::string cpeName_;
0040   const edm::ESGetToken<PixelClusterParameterEstimator, TkPixelCPERecord> cpeToken_;
0041 };
0042 
0043 // define this as a plug-in
0044 DEFINE_FWK_MODULE(CPEAccessTester);