1 #ifndef TRUTHRIVETTOOLS_HIGGSTEMPLATECROSSSECTIONS_CC 2 #define TRUTHRIVETTOOLS_HIGGSTEMPLATECROSSSECTIONS_CC 5 #include "Rivet/Analysis.hh" 6 #include "Rivet/Particle.hh" 7 #include "Rivet/Projections/FastJets.hh" 34 if (ptcl.genParticle()->end_vertex()) {
35 if (!
hasChild(ptcl.genParticle(), ptcl.pid()))
45 const ConstGenVertexPtr prodVtx = p.genParticle()->production_vertex();
46 if (prodVtx ==
nullptr)
50 for (
auto part : ptcls)
51 if (ancestor ==
part.genParticle())
60 Particles ptcls = {p2};
65 bool hasChild(
const ConstGenParticlePtr &ptcl,
int pdgID) {
67 if (
child.pid() == pdgID)
73 bool hasParent(
const ConstGenParticlePtr &ptcl,
int pdgID) {
75 if (
parent->pdg_id() == pdgID)
82 for (
auto child : p.children())
83 if (PID::isQuark(
child.pid()))
90 HiggsClassification
error(HiggsClassification &
cat,
93 int NmaxWarnings = 20) {
99 static std::atomic<int> Nwarnings{0};
100 if (!
msg.empty() && ++Nwarnings < NmaxWarnings)
113 HiggsClassification
cat;
114 cat.prodMode = prodMode;
127 "Unkown Higgs production mechanism. Cannot classify event." 128 " Classification for all events will most likely fail.");
136 ConstGenVertexPtr HSvtx =
event.genEvent()->signal_process_vertex();
140 if (!PID::isHiggs(ptcl->pdg_id()))
143 if (ptcl->end_vertex() && !
hasChild(ptcl, PID::HIGGS)) {
149 if (HSvtx ==
nullptr && ptcl->production_vertex() && !
hasParent(ptcl, PID::HIGGS))
150 HSvtx = ptcl->production_vertex();
157 "Current event has " + std::to_string(Nhiggs) +
" Higgs bosons. There must be only one.");
158 if (cat.higgs.children().size() < 2)
161 if (HSvtx ==
nullptr)
170 bool is_uncatdV =
false;
171 Particles uncatV_decays;
172 FourMomentum uncatV_p4(0, 0, 0, 0);
173 FourVector uncatV_v4(0, 0, 0, 0);
174 int nWs = 0, nZs = 0, nTop = 0;
175 if (
isVH(prodMode)) {
177 if (PID::isW(ptcl->pdg_id())) {
181 if (PID::isZ(ptcl->pdg_id())) {
190 if (!PID::isHiggs(ptcl->pdg_id())) {
192 uncatV_p4 +=
Particle(ptcl).momentum();
203 if (
isVH(prodMode) && !cat.V.genParticle()->end_vertex())
206 if (
isVH(prodMode) && cat.V.children().size() < 2)
209 if ((prodMode ==
HTXS::WH && (nZs > 0 || nWs != 1)) ||
213 "Found " + std::to_string(nWs) +
" W-bosons and " + std::to_string(nZs) +
214 " Z-bosons. Inconsitent with VH expectation.");
222 if (!PID::isTop(ptcl->pdg_id()))
226 if (top.genParticle()->end_vertex())
227 for (
auto child : top.children())
228 if (PID::isW(
child.pid()))
234 if ((prodMode ==
HTXS::TTH && Ws.size() < 2) || (prodMode ==
HTXS::TH && Ws.empty()))
246 Particles leptonicVs;
251 leptonicVs = uncatV_decays;
253 if (W.genParticle()->end_vertex() && !
quarkDecay(W))
259 FourMomentum sum(0, 0, 0, 0), vSum(0, 0, 0, 0), hSum(0, 0, 0, 0);
265 hSum +=
p.momentum();
270 vSum +=
p.momentum();
278 cat.p4decay_higgs = hSum;
279 cat.p4decay_V = vSum;
282 FastJets
jets(fps_temp, FastJets::ANTIKT, 0.4);
285 cat.jets25 = jets.jetsByPt(
Cuts::pT > 25.0);
286 cat.jets30 = jets.jetsByPt(
Cuts::pT > 30.0);
306 cat.stage1_cat_pTjet25GeV =
getStage1Category(prodMode, cat.higgs, cat.jets25, cat.V);
307 cat.stage1_cat_pTjet30GeV =
getStage1Category(prodMode, cat.higgs, cat.jets30, cat.V);
328 for (
size_t i = 1;
i < bins.size(); ++
i)
331 return bins.size() - 1;
340 const FourMomentum &j1 = jets[0].momentum(), &j2 = jets[1].momentum();
341 bool VBFtopo = (j1 + j2).
mass() > 400.0 &&
std::abs(j1.rapidity() - j2.rapidity()) > 2.8;
342 return VBFtopo ? (j1 + j2 + higgs.momentum()).
pt() < 25 ? 2 : 1 : 0;
352 const FourMomentum &j1 = jets[0].momentum(), &j2 = jets[1].momentum();
353 double mjj = (j1 + j2).
mass();
354 if (mjj > 350 && mjj <= 700)
355 return (j1 + j2 + higgs.momentum()).
pt() < 25 ? 1 : 2;
357 return (j1 + j2 + higgs.momentum()).
pt() < 25 ? 3 : 4;
371 const FourMomentum &j1 = jets[0].momentum(), &j2 = jets[1].momentum();
372 double mjj = (j1 + j2).
mass();
373 if (mjj > 350 && mjj <= 700)
374 return (j1 + j2 + higgs.momentum()).
pt() < 25 ? 1 : 2;
375 else if (mjj > 700 && mjj <= 1000)
376 return (j1 + j2 + higgs.momentum()).
pt() < 25 ? 3 : 4;
377 else if (mjj > 1000 && mjj <= 1500)
378 return (j1 + j2 + higgs.momentum()).
pt() < 25 ? 5 : 6;
380 return (j1 + j2 + higgs.momentum()).
pt() < 25 ? 7 : 8;
393 int ctrlHiggs =
std::abs(higgs.rapidity()) < 2.5;
401 return Category(prodMode * 10 + ctrlHiggs);
410 int Njets = jets.size(), ctrlHiggs =
std::abs(higgs.rapidity()) < 2.5, fwdHiggs = !ctrlHiggs;
411 double pTj1 = !jets.empty() ? jets[0].momentum().pt() : 0;
423 else if (Njets >= 2) {
425 if (higgs.pt() <= 200) {
428 else if (vbfTopo == 1)
437 if (
std::abs(higgs.rapidity()) > 2.5)
445 double mjj = jets.size() > 1 ? (jets[0].mom() + jets[1].mom()).
mass() : 0;
446 if (60 < mjj && mjj < 120)
454 else if (V.pt() < 150)
456 else if (V.pt() > 250)
465 else if (V.pt() < 150)
467 else if (V.pt() > 250)
478 else if (jets.empty())
498 int Njets = jets.size(), ctrlHiggs =
std::abs(higgs.rapidity()) < 2.5, fwdHiggs = !ctrlHiggs;
506 if (higgs.pt() > 200)
523 if (
std::abs(higgs.rapidity()) > 2.5)
525 int Njets = jets.size();
530 else if (Njets >= 2) {
531 double mjj = (jets[0].mom() + jets[1].mom()).
mass();
534 else if (60 < mjj && mjj < 120)
536 else if (120 < mjj && mjj < 350)
538 else if (mjj > 350) {
539 if (higgs.pt() > 200)
550 else if (V.pt() < 75)
552 else if (V.pt() < 150)
554 else if (V.pt() > 250)
563 else if (V.pt() < 75)
565 else if (V.pt() < 150)
567 else if (V.pt() > 250)
576 else if (V.pt() < 75)
578 else if (V.pt() < 150)
580 else if (V.pt() > 250)
600 int Njets = jets.size(), ctrlHiggs =
std::abs(higgs.rapidity()) < 2.5, fwdHiggs = !ctrlHiggs;
608 if (higgs.pt() > 200)
616 double pTHjj = (jets[0].momentum() + jets[1].momentum() + higgs.momentum()).
pt();
630 if (
std::abs(higgs.rapidity()) > 2.5)
632 int Njets = jets.size();
637 else if (Njets >= 2) {
638 double mjj = (jets[0].mom() + jets[1].mom()).
mass();
639 double pTHjj = (jets[0].momentum() + jets[1].momentum() + higgs.momentum()).
pt();
646 if (higgs.pt() < 200) {
658 int Njets = jets.size();
669 int Njets = jets.size();
680 int Njets = jets.size();
709 printf(
"==============================================================\n");
710 printf(
"======== HiggsTemplateCrossSections Initialization =========\n");
711 printf(
"==============================================================\n");
715 char *pm_env = std::getenv(
"HIGGSPRODMODE");
716 string pm(pm_env ==
nullptr ?
"" : pm_env);
719 else if (pm ==
"VBF")
725 else if (pm ==
"QQ2ZH")
727 else if (pm ==
"GG2ZH")
729 else if (pm ==
"TTH")
731 else if (pm ==
"BBH")
736 MSG_WARNING(
"No HIGGSPRODMODE shell variable found. Needed when running Rivet stand-alone.");
748 printf(
"==============================================================\n");
750 printf(
"======== Sucessful Initialization =========\n");
751 printf(
"==============================================================\n");
760 const double weight = 1.0;
763 int F = cat.stage0_cat % 10,
P = cat.stage1_cat_pTjet30GeV / 100;
764 hist_stage0->fill(cat.stage0_cat / 10 * 2 + F, weight);
767 vector<int>
offset({0, 1, 13, 19, 24, 29, 33, 35, 37, 39});
781 if (!cat.jets30.empty())
783 if (cat.jets30.size() >= 2) {
784 const FourMomentum &j1 = cat.jets30[0].momentum(), &j2 = cat.jets30[1].momentum();
792 MSG_INFO(
" ====================================================== ");
793 MSG_INFO(
" Higgs Template X-Sec Categorization Tool ");
794 MSG_INFO(
" Status Code Summary ");
795 MSG_INFO(
" ====================================================== ");
801 MSG_INFO(
" >>>> --> the following errors occured:");
805 <<
" failed to identify a valid Higgs boson.");
807 <<
" failed to identify the hard scatter vertex.");
810 <<
" failed to identify valid Ws from top decay.");
812 MSG_INFO(
" ====================================================== ");
813 MSG_INFO(
" ====================================================== ");
874 #ifdef RIVET_ANALYSIS_PATH
int vbfTopology(const Jets &jets, const Particle &higgs)
VBF topolog selection 0 = fail loose selction: m_jj > 400 GeV and Dy_jj > 2.8 1 pass loose...
bool isVH(HTXS::HiggsProdMode p)
Whether the Higgs is produced in association with a vector boson (VH)
failed to identify associated vector boson
int getBin(double x, std::vector< double > bins)
Return bin index of x given the provided bin edges. 0=first bin, -1=underflow bin.
ErrorCode
Error code: whether the classification was successful or failed.
int vbfTopology_Stage1_1(const Jets &jets, const Particle &higgs)
VBF topology selection Stage1.1 0 = fail loose selection: m_jj > 350 GeV 1 pass loose, but fail additional cut pT(Hjj)<25. 2 pass pT(Hjj)>25 selection 3 pass tight (m_jj>700 GeV), but fail additional cut pT(Hjj)<25. 4 pass pT(Hjj)>25 selection.
bool originateFrom(const Particle &p, const Particle &p2)
Whether particle p originates from p2.
successful classification
void printClassificationSummary()
HiggsTemplateCrossSections()
HTXS::Stage1::Category getStage1Category(const HTXS::HiggsProdMode prodMode, const Particle &higgs, const Jets &jets, const Particle &V)
Stage-1 categorization.
failed to identify Higgs boson decay products
HiggsProdMode
Higgs production modes, corresponding to input sample.
HTXS::Stage1_1::Category getStage1_1_Category(const HTXS::HiggsProdMode prodMode, const Particle &higgs, const Jets &jets, const Particle &V)
Stage-1.1 categorization.
int vbfTopology_Stage1_1_Fine(const Jets &jets, const Particle &higgs)
VBF topology selection for Stage1.1 Fine 0 = fail loose selection: m_jj > 350 GeV 1 pass loose...
Histo1DPtr hist_dijet_mass
std::map< HTXS::ErrorCode, size_t > m_errorCount
void init() override
default Rivet Analysis::init method Booking of histograms, initializing Rivet projection Extracts Hig...
HTXS::HiggsProdMode m_HiggsProdMode
void analyze(const Event &event) override
HTXS::Stage1_1_Fine::Category getStage1_1_Fine_Category(const HTXS::HiggsProdMode prodMode, const Particle &higgs, const Jets &jets, const Particle &V)
Stage-1_1 categorization.
bool quarkDecay(const Particle &p)
Return true is particle decays to quarks.
failed momentum conservation
DECLARE_RIVET_PLUGIN(CMS_2013_I1224539_DIJET)
Particle getLastInstance(Particle ptcl)
follow a "propagating" particle and return its last instance
Abs< T >::type abs(const T &t)
Namespace for Stage0 categorization.
Higgs Template Cross Section namespace.
bool hasChild(const ConstGenParticlePtr &ptcl, int pdgID)
Checks whether the input particle has a child with a given PDGID.
failed to identify associated vector boson decay products
void setHiggsProdMode(HTXS::HiggsProdMode prodMode)
Sets the Higgs production mode.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
HiggsClassification classifyEvent(const Event &event, const HTXS::HiggsProdMode prodMode)
Main classificaion method.
failed to identify Higgs boson
Histo1DPtr hist_stage1_pTjet30
Rivet routine for classifying MC events according to the Higgs template cross section categories...
failed to identify hard scatter vertex
std::pair< OmniClusterRef, TrackingParticleRef > P
HTXS::Stage0::Category getStage0Category(const HTXS::HiggsProdMode prodMode, const Particle &higgs, const Particle &V)
Stage-0 HTXS categorization.
bool hasParent(const ConstGenParticlePtr &ptcl, int pdgID)
Checks whether the input particle has a parent with a given PDGID.
HiggsClassification error(HiggsClassification &cat, HTXS::ErrorCode err, std::string msg="", int NmaxWarnings=20)
Returns the classification object with the error code set. Prints an warning message, and keeps track of number of errors.
bool originateFrom(const Particle &p, const Particles &ptcls)
Whether particle p originate from any of the ptcls.
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Histo1DPtr hist_stage1_pTjet25
production mode not defined
Histo1DPtr hist_deltay_jj
failed to identify top decay