File indexing completed on 2024-04-06 12:26:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <memory>
0011 #include <string>
0012 #include <iostream>
0013
0014
0015 #include "DataFormats/Common/interface/Handle.h"
0016 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h"
0017 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h"
0018 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/Framework/interface/EventSetup.h"
0021 #include "FWCore/Framework/interface/EventSetup.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 #include "RecoLocalTracker/SiStripRecHitConverter/test/ReadRecHitAlgorithm.h"
0025
0026 namespace cms {
0027 class ReadRecHit : public edm::one::EDAnalyzer<> {
0028 public:
0029 explicit ReadRecHit(const edm::ParameterSet& conf);
0030 virtual ~ReadRecHit() override = default;
0031
0032 virtual void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0033
0034 private:
0035 ReadRecHitAlgorithm readRecHitAlgorithm_;
0036 const std::string recHitProducer_;
0037 const edm::EDGetTokenT<SiStripMatchedRecHit2DCollection> matchedRecHitToken_;
0038 const edm::EDGetTokenT<SiStripRecHit2DCollection> rphiToken_;
0039 const edm::EDGetTokenT<SiStripRecHit2DCollection> stereoToken_;
0040 };
0041 }
0042
0043 namespace cms {
0044
0045 ReadRecHit::ReadRecHit(edm::ParameterSet const& conf)
0046 : readRecHitAlgorithm_(conf),
0047 recHitProducer_(conf.getParameter<std::string>("RecHitProducer")),
0048 matchedRecHitToken_(
0049 consumes<SiStripMatchedRecHit2DCollection>(edm::InputTag{recHitProducer_, "matchedRecHit"})),
0050 rphiToken_(consumes<SiStripRecHit2DCollection>(edm::InputTag{recHitProducer_, "rphiRecHit"})),
0051 stereoToken_(consumes<SiStripRecHit2DCollection>(edm::InputTag{recHitProducer_, "stereoRecHit"})) {}
0052
0053
0054 void ReadRecHit::analyze(const edm::Event& e, const edm::EventSetup& es) {
0055 using namespace edm;
0056
0057
0058 edm::Handle<SiStripMatchedRecHit2DCollection> rechitsmatched = e.getHandle(matchedRecHitToken_);
0059 edm::Handle<SiStripRecHit2DCollection> rechitsrphi = e.getHandle(rphiToken_);
0060 edm::Handle<SiStripRecHit2DCollection> rechitsstereo = e.getHandle(stereoToken_);
0061
0062 edm::LogInfo("ReadRecHit") << "Matched hits:";
0063 readRecHitAlgorithm_.run(rechitsmatched.product());
0064 edm::LogInfo("ReadRecHit") << "Rphi hits:";
0065 readRecHitAlgorithm_.run(rechitsrphi.product());
0066 edm::LogInfo("ReadRecHit") << "Stereo hits:";
0067 readRecHitAlgorithm_.run(rechitsstereo.product());
0068 }
0069
0070 }