File indexing completed on 2023-03-17 11:29:06
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
0024 #include <vector>
0025 #include <map>
0026 #include <limits>
0027
0028 #include "FWCore/Framework/interface/Frameworkfwd.h"
0029 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0030
0031 #include "FWCore/Framework/interface/Event.h"
0032 #include "FWCore/Framework/interface/Run.h"
0033 #include "FWCore/Framework/interface/MakerMacros.h"
0034
0035 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0036
0037 #include "FWCore/Utilities/interface/InputTag.h"
0038
0039 #include "Validation/RecoVertex/interface/BeamSpotHistogramMaker.h"
0040 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0041
0042
0043
0044
0045
0046 class AnotherBeamSpotAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
0047 public:
0048 explicit AnotherBeamSpotAnalyzer(const edm::ParameterSet&);
0049 ~AnotherBeamSpotAnalyzer() override;
0050
0051 private:
0052 void beginJob() override;
0053 void analyze(const edm::Event&, const edm::EventSetup&) override;
0054 void beginRun(const edm::Run&, const edm::EventSetup&) override;
0055 void endRun(const edm::Run&, const edm::EventSetup&) override;
0056 void endJob() override;
0057
0058
0059
0060 BeamSpotHistogramMaker _bshm;
0061 edm::EDGetTokenT<reco::BeamSpot> _recoBeamSpotToken;
0062 };
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 AnotherBeamSpotAnalyzer::AnotherBeamSpotAnalyzer(const edm::ParameterSet& iConfig)
0076 : _bshm(iConfig.getParameter<edm::ParameterSet>("bsHistogramMakerPSet"), consumesCollector()),
0077 _recoBeamSpotToken(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("bsCollection"))) {
0078
0079 usesResource(TFileService::kSharedResource);
0080
0081
0082 _bshm.book();
0083 }
0084
0085 AnotherBeamSpotAnalyzer::~AnotherBeamSpotAnalyzer() {
0086
0087
0088 }
0089
0090
0091
0092
0093
0094
0095 void AnotherBeamSpotAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0096
0097
0098 edm::Handle<reco::BeamSpot> bs;
0099 iEvent.getByToken(_recoBeamSpotToken, bs);
0100 _bshm.fill(iEvent.orbitNumber(), *bs);
0101 }
0102
0103
0104 void AnotherBeamSpotAnalyzer::beginJob() {}
0105
0106 void AnotherBeamSpotAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
0107 _bshm.beginRun(iRun.run());
0108 }
0109
0110 void AnotherBeamSpotAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {}
0111
0112 void AnotherBeamSpotAnalyzer::endJob() {}
0113
0114
0115 DEFINE_FWK_MODULE(AnotherBeamSpotAnalyzer);