18 #include "Rivet/AnalysisHandler.hh" 27 using namespace Rivet;
44 produces<HTXS::HiggsClassification>(
"HiggsClassification").setBranchAlias(
"HiggsClassification");
76 _analysisHandler.addAnalysis(_HTXS);
84 bool product_exists = iEvent.
getByToken(_hepmcCollection, evt);
88 const HepMC::GenEvent *myGenEvent = evt->
GetEvent();
90 if (_prodMode ==
"AUTO") {
101 HepMC::GenVertex *HSvtx = myGenEvent->signal_process_vertex();
105 if (
std::abs(ptcl->pdg_id()) == 24) ++nWs;
106 if (ptcl->pdg_id() == 23) ++nZs;
107 if (
abs(ptcl->pdg_id()) == 6) ++nTs;
108 if (
abs(ptcl->pdg_id()) == 5) ++nBs;
109 if (ptcl->pdg_id() == 25) ++nHs;
113 if (nZs==1 && nHs==1 && (nWs+nTs)==0) {
115 }
else if (nWs==1 && nHs==1 && (nZs+nTs)==0) {
117 }
else if (nTs==2 && nHs==1 && nZs==0) {
119 }
else if (nTs==1 && nHs==1 && nZs==0) {
121 }
else if (nBs==2 && nHs==1 && nZs==0) {
125 _HTXS->setHiggsProdMode(m_HiggsProdMode);
134 if ( _prodMode ==
"GGF" ) m_HiggsProdMode =
HTXS::GGF;
135 else if ( _prodMode ==
"VBF" ) m_HiggsProdMode =
HTXS::VBF;
136 else if ( _prodMode ==
"WH" ) m_HiggsProdMode =
HTXS::WH;
137 else if ( _prodMode ==
"ZH" ) m_HiggsProdMode =
HTXS::QQ2ZH;
138 else if ( _prodMode ==
"QQ2ZH" ) m_HiggsProdMode =
HTXS::QQ2ZH;
139 else if ( _prodMode ==
"GG2ZH" ) m_HiggsProdMode =
HTXS::GG2ZH;
140 else if ( _prodMode ==
"TTH" ) m_HiggsProdMode =
HTXS::TTH;
141 else if ( _prodMode ==
"BBH" ) m_HiggsProdMode =
HTXS::BBH;
142 else if ( _prodMode ==
"TH" ) m_HiggsProdMode =
HTXS::TH;
143 else if ( _prodMode ==
"AUTO" ) {
144 edm::LogInfo (
"HTXSRivetProducer") <<
"Using AUTO for HiggsProdMode, found it to be: "<<m_HiggsProdMode<<
"\n";
145 edm::LogInfo (
"HTXSRivetProducer") <<
"(UNKNOWN=0, GGF=1, VBF=2, WH=3, QQ2ZH=4, GG2ZH=5, TTH=6, BBH=7, TH=8)"<<endl;
147 throw cms::Exception(
"HTXSRivetProducer") <<
"ProductionMode must be one of: GGF,VBF,WH,ZH,QQ2ZH,GG2ZH,TTH,BBH,TH,AUTO " ;
149 _HTXS->setHiggsProdMode(m_HiggsProdMode);
153 edm::LogInfo (
"HTXSRivetProducer") <<
"HTXSRivetProducer WARNING: HiggsProduction mode is UNKNOWN" << endl;
157 _analysisHandler.init(*myGenEvent);
158 _isFirstEvent =
false;
163 Rivet::HiggsClassification rivet_cat = _HTXS->classifyEvent(*myGenEvent,m_HiggsProdMode);
173 _HTXS->printClassificationSummary();
182 if (_prodMode ==
"AUTO") {
186 if( product_exists ){
188 typedef std::vector<LHERunInfoProduct::Header>::const_iterator headers_const_iterator;
190 for (headers_const_iterator iter=myLHERunInfoProduct.
headers_begin(); iter!=myLHERunInfoProduct.
headers_end(); iter++){
191 std::vector<std::string>
lines = iter->lines();
192 for (
unsigned int iLine = 0; iLine<lines.size(); iLine++) {
195 if (line.find(
"gg_H_quark-mass-effects") != std::string::npos) {
196 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
200 if (line.find(
"Process: HJ") != std::string::npos) {
201 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
205 if (line.find(
"Process: HJJ") != std::string::npos) {
206 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
210 if (line.find(
"VBF_H") != std::string::npos) {
211 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
215 if (line.find(
"HZJ") != std::string::npos) {
216 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
220 if (line.find(
"ggHZ") != std::string::npos) {
221 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
226 if (line.find(
"ggh012j") != std::string::npos) {
227 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
231 if (line.find(
"vbfh") != std::string::npos) {
232 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
236 if (line.find(
"zh012j") != std::string::npos) {
237 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
241 if (line.find(
"ggzh01j") != std::string::npos) {
242 edm::LogInfo (
"HTXSRivetProducer") <<iLine<<
" "<<line<<std::endl;
T getParameter(std::string const &) const
bool getByLabel(std::string const &label, Handle< PROD > &result) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
~HTXSRivetProducer() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
headers_const_iterator headers_end() const
HiggsProdMode
Higgs production modes, corresponding to input sample.
HTXS::HiggsProdMode m_HiggsProdMode
Rivet::AnalysisHandler _analysisHandler
Rivet::HiggsTemplateCrossSections * _HTXS
headers_const_iterator headers_begin() const
Abs< T >::type abs(const T &t)
void produce(edm::Event &, const edm::EventSetup &) override
const HepMC::GenEvent * GetEvent() const
void beginRun(edm::Run const &iRun, edm::EventSetup const &es) override
T const * product() const
Rivet routine for classifying MC events according to the Higgs template cross section categories...
edm::EDGetTokenT< edm::HepMCProduct > _hepmcCollection
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)
edm::EDGetTokenT< LHERunInfoProduct > _lheRunInfo