File indexing completed on 2024-07-03 04:17:52
0001 #ifndef GeneratorInterface_RivetInterface_RivetAnalyzer
0002 #define GeneratorInterface_RivetInterface_RivetAnalyzer
0003
0004 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0005 #include "Rivet/AnalysisHandler.hh"
0006
0007
0008 #include "DQMServices/Core/interface/DQMStore.h"
0009
0010 #include "SimDataFormats/GeneratorProducts/interface/HepMC3Product.h"
0011 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
0012 #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"
0013 #include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h"
0014 #include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h"
0015
0016 #include "Rivet/Tools/RivetYODA.hh"
0017
0018
0019 #include <vector>
0020 #include <string>
0021
0022 class RivetAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
0023 public:
0024 RivetAnalyzer(const edm::ParameterSet &);
0025
0026 ~RivetAnalyzer() override;
0027
0028 void beginJob() override;
0029
0030 void endJob() override;
0031
0032 void analyze(const edm::Event &, const edm::EventSetup &) override;
0033
0034 void beginRun(const edm::Run &, const edm::EventSetup &) override;
0035
0036 void endRun(const edm::Run &, const edm::EventSetup &) override;
0037
0038 private:
0039 edm::EDGetTokenT<edm::HepMC3Product> _hepmcCollection;
0040 bool _useLHEweights;
0041 double _weightCap;
0042 double _NLOSmearing;
0043 bool _setIgnoreBeams;
0044 bool _skipMultiWeights;
0045 std::string _selectMultiWeights;
0046 std::string _deselectMultiWeights;
0047 std::string _setNominalWeightName;
0048 edm::EDGetTokenT<LHEEventProduct> _LHECollection;
0049 edm::EDGetTokenT<GenEventInfoProduct> _genEventInfoCollection;
0050 edm::EDGetTokenT<GenLumiInfoHeader> _genLumiInfoToken;
0051 edm::EDGetTokenT<LHERunInfoProduct> _lheRunInfoToken;
0052 std::unique_ptr<Rivet::AnalysisHandler> _analysisHandler;
0053 bool _isFirstEvent;
0054 std::string _outFileName;
0055 std::vector<std::string> _analysisNames;
0056 bool _doFinalize;
0057 const edm::InputTag _lheLabel;
0058 double _xsection;
0059 std::vector<std::string> _weightNames;
0060 std::vector<std::string> _lheWeightNames;
0061 std::vector<std::string> _cleanedWeightNames;
0062 std::shared_ptr<HepMC3::GenRunInfo> runinfo;
0063 };
0064
0065 #endif