18 #include "Rivet/Particle.hh" 19 #include "Rivet/AnalysisHandler.hh" 29 using namespace Rivet;
38 usesResource(
"Rivet");
39 _prodMode =
cfg.getParameter<
string>(
"ProductionMode");
42 _analysisHandler =
nullptr;
43 produces<HTXS::HiggsClassification>(
"HiggsClassification").setBranchAlias(
"HiggsClassification");
68 bool product_exists =
iEvent.getByToken(_hepmcCollection, evt);
71 const HepMC3::GenEventData* genEventData = evt->
GetEvent();
72 std::unique_ptr<HepMC3::GenEvent> myGenEvent = std::make_unique<HepMC3::GenEvent>();
73 myGenEvent->read_data(*genEventData);
75 if (_prodMode ==
"AUTO") {
84 ConstGenVertexPtr HSvtx = myGenEvent->vertices()[0];
90 if (ptcl->pdg_id() == 23)
92 if (
abs(ptcl->pdg_id()) == 6)
94 if (
abs(ptcl->pdg_id()) == 5)
96 if (ptcl->pdg_id() == 25)
101 if (nZs == 1 && nHs == 1 && (nWs + nTs) == 0) {
103 }
else if (nWs == 1 && nHs == 1 && (nZs + nTs) == 0) {
105 }
else if (nTs == 2 && nHs == 1 && nZs == 0) {
107 }
else if (nTs == 1 && nHs == 1 && nZs == 0) {
109 }
else if (nBs == 2 && nHs == 1 && nZs == 0) {
115 if (!_HTXS || !_HTXS->hasProjection(
"FS")) {
116 _analysisHandler = std::make_unique<Rivet::AnalysisHandler>();
118 _analysisHandler->addAnalysis(_HTXS);
121 if (_prodMode ==
"GGF")
123 else if (_prodMode ==
"VBF")
125 else if (_prodMode ==
"WH")
127 else if (_prodMode ==
"ZH")
129 else if (_prodMode ==
"QQ2ZH")
131 else if (_prodMode ==
"GG2ZH")
133 else if (_prodMode ==
"TTH")
135 else if (_prodMode ==
"BBH")
137 else if (_prodMode ==
"TH")
139 else if (_prodMode ==
"AUTO") {
141 <<
"Using AUTO for HiggsProdMode, found it to be: " << m_HiggsProdMode <<
"\n";
143 <<
"(UNKNOWN=0, GGF=1, VBF=2, WH=3, QQ2ZH=4, GG2ZH=5, TTH=6, BBH=7, TH=8)" << endl;
146 <<
"ProductionMode must be one of: GGF,VBF,WH,ZH,QQ2ZH,GG2ZH,TTH,BBH,TH,AUTO ";
148 _HTXS->setHiggsProdMode(m_HiggsProdMode);
152 edm::LogInfo(
"HTXSRivetProducer") <<
"HTXSRivetProducer WARNING: HiggsProduction mode is UNKNOWN" << endl;
156 _analysisHandler->init(*myGenEvent);
160 const Rivet::Event
event(const_cast<GenEvent&>(*myGenEvent));
162 Rivet::HiggsClassification rivet_cat = _HTXS->classifyEvent(
event, m_HiggsProdMode);
173 _HTXS->printClassificationSummary();
177 if (_prodMode ==
"AUTO") {
180 if (product_exists) {
181 typedef std::vector<LHERunInfoProduct::Header>::const_iterator headers_const_iterator;
185 std::vector<std::string>
lines = iter->lines();
186 for (
unsigned int iLine = 0; iLine <
lines.size(); iLine++) {
189 if (
line.find(
"gg_H_quark-mass-effects") != std::string::npos) {
194 if (
line.find(
"Process: HJ") != std::string::npos) {
199 if (
line.find(
"Process: HJJ") != std::string::npos) {
204 if (
line.find(
"VBF_H") != std::string::npos) {
209 if (
line.find(
"HZJ") != std::string::npos) {
214 if (
line.find(
"ggHZ") != std::string::npos) {
220 if (
line.find(
"ggh012j") != std::string::npos) {
225 if (
line.find(
"vbfh") != std::string::npos) {
230 if (
line.find(
"zh012j") != std::string::npos) {
235 if (
line.find(
"ggzh01j") != std::string::npos) {
headers_const_iterator headers_begin() const
HiggsProdMode
Higgs production modes, corresponding to input sample.
HTXS::HiggsProdMode m_HiggsProdMode
std::unique_ptr< Rivet::AnalysisHandler > _analysisHandler
Rivet::HiggsTemplateCrossSections * _HTXS
headers_const_iterator headers_end() const
Abs< T >::type abs(const T &t)
void produce(edm::Event &, const edm::EventSetup &) override
bool getByLabel(std::string const &label, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edm::HepMC3Product > _hepmcCollection
Log< level::Info, false > LogInfo
void beginRun(edm::Run const &iRun, edm::EventSetup const &es) override
Rivet routine for classifying MC events according to the Higgs template cross section categories...
HTXS::HiggsClassification Rivet2Root(category const &htxs_cat_rivet)
HTXS::HiggsClassification cat_
void endRun(edm::Run const &iRun, edm::EventSetup const &es) override
HTXSRivetProducer(const edm::ParameterSet &cfg)
const HepMC3::GenEventData * GetEvent() const
edm::EDGetTokenT< LHERunInfoProduct > _lheRunInfo