CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
Rivet::HiggsTemplateCrossSections Class Reference

Rivet routine for classifying MC events according to the Higgs template cross section categories. More...

Inheritance diagram for Rivet::HiggsTemplateCrossSections:

Public Member Functions

HiggsClassification classifyEvent (const Event &event, const HTXS::HiggsProdMode prodMode)
 Main classificaion method. More...
 
 HiggsTemplateCrossSections ()
 
Utility methods

Methods to identify the Higgs boson and associated vector boson and to build jets

Particle getLastInstance (Particle ptcl)
 follow a "propagating" particle and return its last instance More...
 
bool originateFrom (const Particle &p, const Particles &ptcls)
 Whether particle p originate from any of the ptcls. More...
 
bool originateFrom (const Particle &p, const Particle &p2)
 Whether particle p originates from p2. More...
 
bool hasChild (const GenParticle *ptcl, int pdgID)
 Checks whether the input particle has a child with a given PDGID. More...
 
bool hasParent (const GenParticle *ptcl, int pdgID)
 Checks whether the input particle has a parent with a given PDGID. More...
 
bool quarkDecay (const Particle &p)
 Return true is particle decays to quarks. More...
 
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. More...
 
Categorization methods

Methods to assign the truth category based on the identified Higgs boson and associated vector bosons and/or reconstructed jets

int getBin (double x, std::vector< double > bins)
 Return bin index of x given the provided bin edges. 0=first bin, -1=underflow bin. More...
 
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, but fail additional cut pT(Hjj)<25. 2 pass tight selection. More...
 
bool isVH (HTXS::HiggsProdMode p)
 Whether the Higgs is produced in association with a vector boson (VH) More...
 
HTXS::Stage0::Category getStage0Category (const HTXS::HiggsProdMode prodMode, const Particle &higgs, const Particle &V)
 Stage-0 HTXS categorization. More...
 
HTXS::Stage1::Category getStage1Category (const HTXS::HiggsProdMode prodMode, const Particle &higgs, const Jets &jets, const Particle &V)
 Stage-1 categorization. More...
 
Default Rivet analysis methods and steering methods
void setHiggsProdMode (HTXS::HiggsProdMode prodMode)
 Sets the Higgs production mode. More...
 
void init () override
 default Rivet Analysis::init method Booking of histograms, initializing Rivet projection Extracts Higgs production mode from shell variable if not set manually using setHiggsProdMode More...
 
void analyze (const Event &event) override
 
void printClassificationSummary ()
 
void finalize () override
 
void initializeHistos ()
 

Private Attributes

Histo1DPtr hist_deltay_jj
 
Histo1DPtr hist_dijet_mass
 
Histo1DPtr hist_Njets25
 
Histo1DPtr hist_Njets30
 
Histo1DPtr hist_pT_Higgs
 
Histo1DPtr hist_pT_Hjj
 
Histo1DPtr hist_pT_jet1
 
Histo1DPtr hist_pT_V
 
Histo1DPtr hist_stage0
 
Histo1DPtr hist_stage1_pTjet25
 
Histo1DPtr hist_stage1_pTjet30
 
Histo1DPtr hist_y_Higgs
 
std::map< HTXS::ErrorCode, size_t > m_errorCount
 
HTXS::HiggsProdMode m_HiggsProdMode
 
double m_sumw
 

Detailed Description

Rivet routine for classifying MC events according to the Higgs template cross section categories.

Author
Jim Lacey (DESY) <james.nosp@m..lac.nosp@m.ey@ce.nosp@m.rn.c.nosp@m.h,jlace.nosp@m.y@de.nosp@m.sy.de>
Dag Gillberg (Carleton University) dag.g.nosp@m.illb.nosp@m.erg@c.nosp@m.ern..nosp@m.ch

Definition at line 21 of file HiggsTemplateCrossSections.cc.

Constructor & Destructor Documentation

Rivet::HiggsTemplateCrossSections::HiggsTemplateCrossSections ( )
inline

Definition at line 24 of file HiggsTemplateCrossSections.cc.

25  : Analysis("HiggsTemplateCrossSections"),

Member Function Documentation

void Rivet::HiggsTemplateCrossSections::analyze ( const Event event)
inlineoverride

Definition at line 437 of file HiggsTemplateCrossSections.cc.

References funct::abs(), eostools::cat(), classifyEvent(), F(), hist_deltay_jj, hist_dijet_mass, hist_Njets25, hist_Njets30, hist_pT_Higgs, hist_pT_Hjj, hist_pT_jet1, hist_pT_V, hist_stage0, hist_stage1_pTjet25, hist_stage1_pTjet30, hist_y_Higgs, m_HiggsProdMode, m_sumw, ResonanceBuilder::mass, PFRecoTauDiscriminationByIsolation_cfi::offset, EnergyCorrector::pt, and mps_merge::weight.

437  {
438 
439  // get the classification
440  HiggsClassification cat = classifyEvent(event,m_HiggsProdMode);
441 
442  // Fill histograms: categorization --> linerize the categories
443  const double weight = event.weight();
444  m_sumw += weight;
445 
446  int F=cat.stage0_cat%10, P=cat.stage1_cat_pTjet30GeV/100;
447  hist_stage0->fill( cat.stage0_cat/10*2+F, weight );
448 
449  // Stage 1 enum offsets for each production mode: GGF=12, VBF=6, WH= 5, QQ2ZH=5, GG2ZH=4, TTH=2, BBH=2, TH=2
450  vector<int> offset({0,1,13,19,24,29,33,35,37,39});
451  int off = offset[P];
452  hist_stage1_pTjet25->fill(cat.stage1_cat_pTjet25GeV%100 + off, weight);
453  hist_stage1_pTjet30->fill(cat.stage1_cat_pTjet30GeV%100 + off, weight);
454 
455  // Fill histograms: variables used in the categorization
456  hist_pT_Higgs->fill(cat.higgs.pT(),weight);
457  hist_y_Higgs->fill(cat.higgs.rapidity(),weight);
458  hist_pT_V->fill(cat.V.pT(),weight);
459 
460  hist_Njets25->fill(cat.jets25.size(),weight);
461  hist_Njets30->fill(cat.jets30.size(),weight);
462 
463  // Jet variables. Use jet collection with pT threshold at 30 GeV
464  if (!cat.jets30.empty()) hist_pT_jet1->fill(cat.jets30[0].pt(),weight);
465  if (cat.jets30.size()>=2) {
466  const FourMomentum &j1 = cat.jets30[0].momentum(), &j2 = cat.jets30[1].momentum();
467  hist_deltay_jj->fill(std::abs(j1.rapidity()-j2.rapidity()),weight);
468  hist_dijet_mass->fill((j1+j2).mass(),weight);
469  hist_pT_Hjj->fill((j1+j2+cat.higgs.momentum()).pt(),weight);
470  }
471  }
Definition: weight.py:1
def cat(path)
Definition: eostools.py:400
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HiggsClassification classifyEvent(const Event &event, const HTXS::HiggsProdMode prodMode)
Main classificaion method.
std::pair< OmniClusterRef, TrackingParticleRef > P
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
Definition: event.py:1
HiggsClassification Rivet::HiggsTemplateCrossSections::classifyEvent ( const Event event,
const HTXS::HiggsProdMode  prodMode 
)
inline

Main classificaion method.

Definition at line 101 of file HiggsTemplateCrossSections.cc.

References eostools::cat(), class-composition::child, class-composition::children, error(), event(), getLastInstance(), getStage0Category(), getStage1Category(), HTXS::GG2ZH, hasChild(), hasParent(), HTXS::HIGGS_DECAY_IDENTIFICATION, HTXS::HIGGS_IDENTIFICATION, HTXS::HS_VTX_IDENTIFICATION, isVH(), fwrapper::jets, m_errorCount, m_HiggsProdMode, originateFrom(), AlCaHLTBitMon_ParallelJobs::p, HadronAndPartonSelector_cfi::particles, HTXS::PRODMODE_DEFINED, PVValHelper::pT, HTXS::QQ2ZH, quarkDecay(), HTXS::SUCCESS, HTXS::TH, HTXS::TOP_W_IDENTIFICATION, HTXS::TTH, HTXS::UNDEFINED, HTXS::UNKNOWN, HTXS::Stage0::UNKNOWN, HTXS::Stage1::UNKNOWN, HTXS::VH_DECAY_IDENTIFICATION, HTXS::VH_IDENTIFICATION, and HTXS::WH.

Referenced by analyze().

101  {
102 
104 
105  // the classification object
106  HiggsClassification cat;
107  cat.prodMode = prodMode;
108  cat.errorCode = HTXS::UNDEFINED;
109  cat.stage0_cat = HTXS::Stage0::UNKNOWN;
110  cat.stage1_cat_pTjet25GeV = HTXS::Stage1::UNKNOWN;
111  cat.stage1_cat_pTjet30GeV = HTXS::Stage1::UNKNOWN;
112 
113  if (prodMode == HTXS::UNKNOWN)
114  return error(cat,HTXS::PRODMODE_DEFINED,
115  "Unkown Higgs production mechanism. Cannot classify event."
116  " Classification for all events will most likely fail.");
117 
118  /*****
119  * Step 1.
120  * Idenfify the Higgs boson and the hard scatter vertex
121  * There should be only one of each.
122  */
123 
124  GenVertex *HSvtx = event.genEvent()->signal_process_vertex();
125  int Nhiggs=0;
126  for ( const GenParticle *ptcl : Rivet::particles(event.genEvent()) ) {
127 
128  // a) Reject all non-Higgs particles
129  if ( !PID::isHiggs(ptcl->pdg_id()) ) continue;
130  // b) select only the final Higgs boson copy, prior to decay
131  if ( ptcl->end_vertex() && !hasChild(ptcl,PID::HIGGS) ) {
132  cat.higgs = Particle(ptcl); ++Nhiggs;
133  }
134  // c) if HepMC::signal_proces_vertex is missing
135  // set hard-scatter vertex based on first Higgs boson
136  if ( HSvtx==nullptr && ptcl->production_vertex() && !hasParent(ptcl,PID::HIGGS) )
137  HSvtx = ptcl->production_vertex();
138  }
139 
140  // Make sure things are in order so far
141  if (Nhiggs!=1)
143  "Current event has "+std::to_string(Nhiggs)+" Higgs bosons. There must be only one.");
144  if (cat.higgs.children().size()<2)
146  "Could not identify Higgs boson decay products.");
147 
148  if (HSvtx == nullptr)
149  return error(cat,HTXS::HS_VTX_IDENTIFICATION,"Cannot find hard-scatter vertex of current event.");
150 
151  /*****
152  * Step 2.
153  * Identify associated vector bosons
154  */
155 
156  // Find associated vector bosons
157  bool is_uncatdV = false;
158  Particles uncatV_decays;
159  FourMomentum uncatV_p4(0,0,0,0);
160  FourVector uncatV_v4(0,0,0,0);
161  int nWs=0, nZs=0, nTop=0;
162  if ( isVH(prodMode) ) {
163  for (auto ptcl:particles(HSvtx,HepMC::children)) {
164  if (PID::isW(ptcl->pdg_id())) { ++nWs; cat.V=Particle(ptcl); }
165  if (PID::isZ(ptcl->pdg_id())) { ++nZs; cat.V=Particle(ptcl); }
166  }
167  if(nWs+nZs>0) cat.V = getLastInstance(cat.V);
168  else {
169  for (auto ptcl:particles(HSvtx,HepMC::children)) {
170  if (!PID::isHiggs(ptcl->pdg_id())) {
171  uncatV_decays += Particle(ptcl);
172  uncatV_p4 += Particle(ptcl).momentum();
173  // uncatV_v4 += Particle(ptcl).origin();
174  }
175  }
176  // is_uncatdV = true; cat.V = Particle(24,uncatV_p4,uncatV_v4);
177  is_uncatdV = true; cat.V = Particle(24,uncatV_p4);
178  }
179  }
180 
181  if ( !is_uncatdV ){
182 
183  if ( isVH(prodMode) && !cat.V.genParticle()->end_vertex() )
184  return error(cat,HTXS::VH_DECAY_IDENTIFICATION,"Vector boson does not decay!");
185 
186  if ( isVH(prodMode) && cat.V.children().size()<2 )
187  return error(cat,HTXS::VH_DECAY_IDENTIFICATION,"Vector boson does not decay!");
188 
189  if ( ( prodMode==HTXS::WH && (nZs>0||nWs!=1) ) ||
190  ( (prodMode==HTXS::QQ2ZH||prodMode==HTXS::GG2ZH) && (nZs!=1||nWs>0) ) )
191  return error(cat,HTXS::VH_IDENTIFICATION,"Found "+std::to_string(nWs)+" W-bosons and "+
192  std::to_string(nZs)+" Z-bosons. Inconsitent with VH expectation.");
193  }
194 
195  // Find and store the W-bosons from ttH->WbWbH
196  Particles Ws;
197  if ( prodMode==HTXS::TTH || prodMode==HTXS::TH ){
198  // loop over particles produced in hard-scatter vertex
199  for ( auto ptcl : particles(HSvtx,HepMC::children) ) {
200  if ( !PID::isTop(ptcl->pdg_id()) ) continue;
201  ++nTop;
202  Particle top = getLastInstance(Particle(ptcl));
203  if ( top.genParticle()->end_vertex() )
204  for (auto child:top.children())
205  if ( PID::isW(child.pdgId()) ) Ws += child;
206  }
207  }
208 
209  // Make sure result make sense
210  if ( (prodMode==HTXS::TTH && Ws.size()<2) || (prodMode==HTXS::TH && Ws.empty() ) )
211  return error(cat,HTXS::TOP_W_IDENTIFICATION,"Failed to identify W-boson(s) from t-decay!");
212 
213  /*****
214  * Step 3.
215  * Build jets
216  * Make sure all stable particles are present
217  */
218 
219  // Create a list of the vector bosons that decay leptonically
220  // Either the vector boson produced in association with the Higgs boson,
221  // or the ones produced from decays of top quarks produced with the Higgs
222  Particles leptonicVs;
223  if ( !is_uncatdV ){
224  if ( isVH(prodMode) && !quarkDecay(cat.V) ) leptonicVs += cat.V;
225  }else leptonicVs = uncatV_decays;
226  for ( auto W:Ws ) if ( W.genParticle()->end_vertex() && !quarkDecay(W) ) leptonicVs += W;
227 
228  // Obtain all stable, final-state particles
229  const ParticleVector FS = applyProjection<FinalState>(event, "FS").particles();
230  Particles hadrons;
231  FourMomentum sum(0,0,0,0), vSum(0,0,0,0), hSum(0,0,0,0);
232  for ( const Particle &p : FS ) {
233  // Add up the four momenta of all stable particles as a cross check
234  sum += p.momentum();
235  // ignore particles from the Higgs boson
236  if ( originateFrom(p,cat.higgs) ) { hSum += p.momentum(); continue; }
237  // Cross-check the V decay products for VH
238  if ( isVH(prodMode) && !is_uncatdV && originateFrom(p,Ws) ) vSum += p.momentum();
239  // ignore final state particles from leptonic V decays
240  if ( !leptonicVs.empty() && originateFrom(p,leptonicVs) ) continue;
241  // All particles reaching here are considered hadrons and will be used to build jets
242  hadrons += p;
243  }
244 
245  cat.p4decay_higgs = hSum;
246  cat.p4decay_V = vSum;
247 
248  FinalState fps_temp;
249  FastJets jets(fps_temp, FastJets::ANTIKT, 0.4 );
250  jets.calc(hadrons);
251 
252  cat.jets25 = jets.jetsByPt( Cuts::pT > 25.0 );
253  cat.jets30 = jets.jetsByPt( Cuts::pT > 30.0 );
254 
255  // check that four mometum sum of all stable particles satisfies momentum consevation
256 /*
257  if ( sum.pt()>0.1 )
258  return error(cat,HTXS::MOMENTUM_CONSERVATION,"Four vector sum does not amount to pT=0, m=E=sqrt(s), but pT="+
259  std::to_string(sum.pt())+" GeV and m = "+std::to_string(sum.mass())+" GeV");
260 */
261  // check if V-boson was not included in the event record but decay particles were
262  // EFT contact interaction: return UNKNOWN for category but set all event/particle kinematics
263  if(is_uncatdV)
264  return error(cat,HTXS::VH_IDENTIFICATION,"Failed to identify associated V-boson!");
265 
266  /*****
267  * Step 4.
268  * Classify and save output
269  */
270 
271  // Apply the categorization categorization
272  cat.stage0_cat = getStage0Category(prodMode,cat.higgs,cat.V);
273  cat.stage1_cat_pTjet25GeV = getStage1Category(prodMode,cat.higgs,cat.jets25,cat.V);
274  cat.stage1_cat_pTjet30GeV = getStage1Category(prodMode,cat.higgs,cat.jets30,cat.V);
275  cat.errorCode = HTXS::SUCCESS; ++m_errorCount[HTXS::SUCCESS];
276 
277  return cat;
278  }
std::map< HTXS::ErrorCode, size_t > m_errorCount
bool isVH(HTXS::HiggsProdMode p)
Whether the Higgs is produced in association with a vector boson (VH)
failed to identify associated vector boson
successful classification
bool hasParent(const GenParticle *ptcl, int pdgID)
Checks whether the input particle has a parent with a given PDGID.
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
def cat(path)
Definition: eostools.py:400
bool hasChild(const GenParticle *ptcl, int pdgID)
Checks whether the input particle has a child with a given PDGID.
bool quarkDecay(const Particle &p)
Return true is particle decays to quarks.
vector< PseudoJet > jets
Particle getLastInstance(Particle ptcl)
follow a "propagating" particle and return its last instance
failed to identify associated vector boson decay products
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
failed to identify Higgs boson
failed to identify hard scatter vertex
HTXS::Stage0::Category getStage0Category(const HTXS::HiggsProdMode prodMode, const Particle &higgs, const Particle &V)
Stage-0 HTXS categorization.
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.
production mode not defined
Definition: event.py:1
failed to identify top decay
HiggsClassification Rivet::HiggsTemplateCrossSections::error ( HiggsClassification &  cat,
HTXS::ErrorCode  err,
std::string  msg = "",
int  NmaxWarnings = 20 
)
inline

Returns the classification object with the error code set. Prints an warning message, and keeps track of number of errors.

Definition at line 85 of file HiggsTemplateCrossSections.cc.

References eostools::cat(), m_errorCount, and mps_check::msg.

Referenced by argparse.ArgumentParser::_get_option_tuples(), python.rootplot.argparse.ArgumentParser::_get_option_tuples(), argparse.ArgumentParser::_parse_known_args(), python.rootplot.argparse.ArgumentParser::_parse_known_args(), argparse.ArgumentParser::_parse_optional(), python.rootplot.argparse.ArgumentParser::_parse_optional(), argparse.ArgumentParser::_read_args_from_files(), python.rootplot.argparse.ArgumentParser::_read_args_from_files(), argparse.ArgumentParser::add_subparsers(), python.rootplot.argparse.ArgumentParser::add_subparsers(), Page1Parser.Page1Parser::check_for_whole_start_tag(), classifyEvent(), argparse.ArgumentParser::parse_args(), python.rootplot.argparse.ArgumentParser::parse_args(), argparse.ArgumentParser::parse_known_args(), and python.rootplot.argparse.ArgumentParser::parse_known_args().

86  {
87  // Set the error, and keep statistics
88  cat.errorCode = err;
89  ++m_errorCount[err];
90 
91  // Print warning message to the screen/log
92  static std::atomic<int> Nwarnings{0};
93  if ( msg!="" && ++Nwarnings < NmaxWarnings )
94  MSG_WARNING(msg);
95 
96  return cat;
97  }
std::map< HTXS::ErrorCode, size_t > m_errorCount
def cat(path)
Definition: eostools.py:400
tuple msg
Definition: mps_check.py:277
void Rivet::HiggsTemplateCrossSections::finalize ( void  )
inlineoverride

Definition at line 495 of file HiggsTemplateCrossSections.cc.

References create_public_lumi_plots::hist, hist_deltay_jj, hist_dijet_mass, hist_Njets25, hist_Njets30, hist_pT_Higgs, hist_pT_Hjj, hist_pT_jet1, hist_pT_V, hist_stage0, hist_stage1_pTjet25, hist_stage1_pTjet30, hist_y_Higgs, m_sumw, printClassificationSummary(), and Scenarios_cff::scale.

495  {
497  double sf = m_sumw>0?1.0/m_sumw:1.0;
500  scale(hist, sf);
501  }
int Rivet::HiggsTemplateCrossSections::getBin ( double  x,
std::vector< double >  bins 
)
inline

Return bin index of x given the provided bin edges. 0=first bin, -1=underflow bin.

Definition at line 287 of file HiggsTemplateCrossSections.cc.

References mps_fire::i.

Referenced by BTagWeightCalculator.BTagWeightCalculator::calcJetWeightImpl(), and getStage1Category().

287  {
288  for (size_t i=1;i<bins.size();++i)
289  if (x<bins[i]) return i-1;
290  return bins.size()-1;
291  }
Particle Rivet::HiggsTemplateCrossSections::getLastInstance ( Particle  ptcl)
inline

follow a "propagating" particle and return its last instance

Definition at line 36 of file HiggsTemplateCrossSections.cc.

References hasChild().

Referenced by classifyEvent().

36  {
37  if ( ptcl.genParticle()->end_vertex() ) {
38  if ( !hasChild(ptcl.genParticle(),ptcl.pdgId()) ) return ptcl;
39  else return getLastInstance(ptcl.children()[0]);
40  }
41  return ptcl;
42  }
bool hasChild(const GenParticle *ptcl, int pdgID)
Checks whether the input particle has a child with a given PDGID.
Particle getLastInstance(Particle ptcl)
follow a "propagating" particle and return its last instance
HTXS::Stage0::Category Rivet::HiggsTemplateCrossSections::getStage0Category ( const HTXS::HiggsProdMode  prodMode,
const Particle higgs,
const Particle V 
)
inline

Stage-0 HTXS categorization.

Definition at line 307 of file HiggsTemplateCrossSections.cc.

References funct::abs(), HTXS::GG2ZH, HTXS::GGF, HTXS::QQ2ZH, quarkDecay(), HTXS::Stage0::VH2HQQ, HTXS::Stage0::VH2HQQ_FWDH, and HTXS::WH.

Referenced by classifyEvent().

309  {
310  using namespace HTXS::Stage0;
311  int ctrlHiggs = std::abs(higgs.rapidity())<2.5;
312  // Special cases first, qq→Hqq
313  if ( (prodMode==HTXS::WH||prodMode==HTXS::QQ2ZH) && quarkDecay(V) ) {
314  return ctrlHiggs ? VH2HQQ : VH2HQQ_FWDH;
315  } else if ( prodMode==HTXS::GG2ZH && quarkDecay(V) ) {
316  return Category(HTXS::GGF*10 + ctrlHiggs);
317  }
318  // General case after
319  return Category(prodMode*10 + ctrlHiggs);
320  }
bool quarkDecay(const Particle &p)
Return true is particle decays to quarks.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Namespace for Stage0 categorization.
HTXS::Stage1::Category Rivet::HiggsTemplateCrossSections::getStage1Category ( const HTXS::HiggsProdMode  prodMode,
const Particle higgs,
const Jets &  jets,
const Particle V 
)
inline

Stage-1 categorization.

Definition at line 323 of file HiggsTemplateCrossSections.cc.

References funct::abs(), HTXS::BBH, HTXS::Stage0::BBH_FWDH, getBin(), HTXS::Stage1::GG2H_0J, HTXS::Stage1::GG2H_1J_PTH_0_60, HTXS::Stage0::GG2H_FWDH, HTXS::Stage1::GG2H_GE2J_PTH_0_60, HTXS::Stage1::GG2H_VBFTOPO_JET3, HTXS::Stage1::GG2H_VBFTOPO_JET3VETO, HTXS::Stage0::GG2HLL_FWDH, HTXS::Stage1::GG2HLL_PTV_0_150, HTXS::Stage1::GG2HLL_PTV_GT150_0J, HTXS::Stage1::GG2HLL_PTV_GT150_GE1J, HTXS::GG2ZH, HTXS::GGF, isVH(), ResonanceBuilder::mass, ECF_cff::Njets, HTXS::Stage0::QQ2HLL_FWDH, HTXS::Stage1::QQ2HLL_PTV_0_150, HTXS::Stage1::QQ2HLL_PTV_150_250_0J, HTXS::Stage1::QQ2HLL_PTV_150_250_GE1J, HTXS::Stage1::QQ2HLL_PTV_GT250, HTXS::Stage0::QQ2HLNU_FWDH, HTXS::Stage1::QQ2HLNU_PTV_0_150, HTXS::Stage1::QQ2HLNU_PTV_150_250_0J, HTXS::Stage1::QQ2HLNU_PTV_150_250_GE1J, HTXS::Stage1::QQ2HLNU_PTV_GT250, HTXS::Stage1::QQ2HQQ_FWDH, HTXS::Stage1::QQ2HQQ_PTJET1_GT200, HTXS::Stage1::QQ2HQQ_REST, HTXS::Stage1::QQ2HQQ_VBFTOPO_JET3, HTXS::Stage1::QQ2HQQ_VBFTOPO_JET3VETO, HTXS::Stage1::QQ2HQQ_VH2JET, HTXS::QQ2ZH, quarkDecay(), HTXS::TH, HTXS::Stage0::TH_FWDH, HTXS::TTH, HTXS::Stage0::TTH_FWDH, pat::UNKNOWN, HTXS::VBF, vbfTopology(), and HTXS::WH.

Referenced by classifyEvent().

326  {
327  using namespace HTXS::Stage1;
328  int Njets=jets.size(), ctrlHiggs = std::abs(higgs.rapidity())<2.5, fwdHiggs = !ctrlHiggs;
329  double pTj1 = !jets.empty() ? jets[0].momentum().pt() : 0;
330  int vbfTopo = vbfTopology(jets,higgs);
331 
332  // 1. GGF Stage 1 categories
333  // Following YR4 write-up: XXXXX
334  if (prodMode==HTXS::GGF || (prodMode==HTXS::GG2ZH && quarkDecay(V)) ) {
335  if (fwdHiggs) return GG2H_FWDH;
336  if (Njets==0) return GG2H_0J;
337  else if (Njets==1) return Category(GG2H_1J_PTH_0_60+getBin(higgs.pt(),{0,60,120,200}));
338  else if (Njets>=2) {
339  // events with pT_H>200 get priority over VBF cuts
340  if(higgs.pt()<=200){
341  if (vbfTopo==2) return GG2H_VBFTOPO_JET3VETO;
342  else if (vbfTopo==1) return GG2H_VBFTOPO_JET3;
343  }
344  // Njets >= 2jets without VBF topology
345  return Category(GG2H_GE2J_PTH_0_60+getBin(higgs.pt(),{0,60,120,200}));
346  }
347  }
348  // 2. Electroweak qq->Hqq Stage 1 categories
349  else if (prodMode==HTXS::VBF || ( isVH(prodMode) && quarkDecay(V)) ) {
350  if (std::abs(higgs.rapidity())>2.5) return QQ2HQQ_FWDH;
351  if (pTj1>200) return QQ2HQQ_PTJET1_GT200;
352  if (vbfTopo==2) return QQ2HQQ_VBFTOPO_JET3VETO;
353  if (vbfTopo==1) return QQ2HQQ_VBFTOPO_JET3;
354  double mjj = jets.size()>1 ? (jets[0].mom()+jets[1].mom()).mass():0;
355  if ( 60 < mjj && mjj < 120 ) return QQ2HQQ_VH2JET;
356  return QQ2HQQ_REST;
357  }
358  // 3. WH->Hlv categories
359  else if (prodMode==HTXS::WH) {
360  if (fwdHiggs) return QQ2HLNU_FWDH;
361  else if (V.pt()<150) return QQ2HLNU_PTV_0_150;
362  else if (V.pt()>250) return QQ2HLNU_PTV_GT250;
363  // 150 < pTV/GeV < 250
365  }
366  // 4. qq->ZH->llH categories
367  else if (prodMode==HTXS::QQ2ZH) {
368  if (fwdHiggs) return QQ2HLL_FWDH;
369  else if (V.pt()<150) return QQ2HLL_PTV_0_150;
370  else if (V.pt()>250) return QQ2HLL_PTV_GT250;
371  // 150 < pTV/GeV < 250
373  }
374  // 5. gg->ZH->llH categories
375  else if (prodMode==HTXS::GG2ZH ) {
376  if (fwdHiggs) return GG2HLL_FWDH;
377  if (V.pt()<150) return GG2HLL_PTV_0_150;
378  else if (jets.empty()) return GG2HLL_PTV_GT150_0J;
379  return GG2HLL_PTV_GT150_GE1J;
380  }
381  // 6.ttH,bbH,tH categories
382  else if (prodMode==HTXS::TTH) return Category(TTH_FWDH+ctrlHiggs);
383  else if (prodMode==HTXS::BBH) return Category(BBH_FWDH+ctrlHiggs);
384  else if (prodMode==HTXS::TH ) return Category(TH_FWDH+ctrlHiggs);
385  return UNKNOWN;
386  }
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)
int getBin(double x, std::vector< double > bins)
Return bin index of x given the provided bin edges. 0=first bin, -1=underflow bin.
0: Unidentified isolated particle
Definition: ParticleCode.h:19
bool quarkDecay(const Particle &p)
Return true is particle decays to quarks.
vector< PseudoJet > jets
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool Rivet::HiggsTemplateCrossSections::hasChild ( const GenParticle *  ptcl,
int  pdgID 
)
inline

Checks whether the input particle has a child with a given PDGID.

Definition at line 63 of file HiggsTemplateCrossSections.cc.

Referenced by classifyEvent(), and getLastInstance().

63  {
64  for (auto child:Particle(*ptcl).children())
65  if (child.pdgId()==pdgID) return true;
66  return false;
67  }
bool Rivet::HiggsTemplateCrossSections::hasParent ( const GenParticle *  ptcl,
int  pdgID 
)
inline

Checks whether the input particle has a parent with a given PDGID.

Definition at line 70 of file HiggsTemplateCrossSections.cc.

References class-composition::parent, parents, and HadronAndPartonSelector_cfi::particles.

Referenced by classifyEvent().

70  {
71  for (auto parent:particles(ptcl->production_vertex(),HepMC::parents))
72  if (parent->pdg_id()==pdgID) return true;
73  return false;
74  }
TPRegexp parents
Definition: eve_filter.cc:21
void Rivet::HiggsTemplateCrossSections::init ( void  )
inlineoverride

default Rivet Analysis::init method Booking of histograms, initializing Rivet projection Extracts Higgs production mode from shell variable if not set manually using setHiggsProdMode

Definition at line 400 of file HiggsTemplateCrossSections.cc.

References HTXS::BBH, HTXS::GG2ZH, HTXS::GGF, initializeHistos(), m_HiggsProdMode, m_sumw, HTXS::QQ2ZH, HTXS::TH, HTXS::TTH, HTXS::UNKNOWN, HTXS::VBF, and HTXS::WH.

400  {
401  printf("==============================================================\n");
402  printf("======== HiggsTemplateCrossSections Initialization =========\n");
403  printf("==============================================================\n");
404  // check that the production mode has been set
405  // if running in standalone Rivet the production mode is set through an env variable
407  char *pm_env = getenv("HIGGSPRODMODE");
408  string pm(pm_env==nullptr?"":pm_env);
409  if ( pm == "GGF" ) m_HiggsProdMode = HTXS::GGF;
410  else if ( pm == "VBF" ) m_HiggsProdMode = HTXS::VBF;
411  else if ( pm == "WH" ) m_HiggsProdMode = HTXS::WH;
412  else if ( pm == "ZH" ) m_HiggsProdMode = HTXS::QQ2ZH;
413  else if ( pm == "QQ2ZH" ) m_HiggsProdMode = HTXS::QQ2ZH;
414  else if ( pm == "GG2ZH" ) m_HiggsProdMode = HTXS::GG2ZH;
415  else if ( pm == "TTH" ) m_HiggsProdMode = HTXS::TTH;
416  else if ( pm == "BBH" ) m_HiggsProdMode = HTXS::BBH;
417  else if ( pm == "TH" ) m_HiggsProdMode = HTXS::TH;
418  else {
419  MSG_WARNING("No HIGGSPRODMODE shell variable found. Needed when running Rivet stand-alone.");
420  }
421  }
422 
423  // Projections for final state particles
424  const FinalState FS;
425  addProjection(FS,"FS");
426 
427  // initialize the histograms with for each of the stages
429  m_sumw = 0.0;
430  printf("==============================================================\n");
431  printf("======== Higgs prod mode %d =========\n",m_HiggsProdMode);
432  printf("======== Sucessful Initialization =========\n");
433  printf("==============================================================\n");
434  }
void Rivet::HiggsTemplateCrossSections::initializeHistos ( )
inline

Definition at line 507 of file HiggsTemplateCrossSections.cc.

References hist_deltay_jj, hist_dijet_mass, hist_Njets25, hist_Njets30, hist_pT_Higgs, hist_pT_Hjj, hist_pT_jet1, hist_pT_V, hist_stage0, hist_stage1_pTjet25, hist_stage1_pTjet30, and hist_y_Higgs.

Referenced by init().

507  {
508  hist_stage0 = bookHisto1D("HTXS_stage0",20,0,20);
509  hist_stage1_pTjet25 = bookHisto1D("HTXS_stage1_pTjet25",40,0,40);
510  hist_stage1_pTjet30 = bookHisto1D("HTXS_stage1_pTjet30",40,0,40);
511  hist_pT_Higgs = bookHisto1D("pT_Higgs",80,0,400);
512  hist_y_Higgs = bookHisto1D("y_Higgs",80,-4,4);
513  hist_pT_V = bookHisto1D("pT_V",80,0,400);
514  hist_pT_jet1 = bookHisto1D("pT_jet1",80,0,400);
515  hist_deltay_jj = bookHisto1D("deltay_jj",50,0,10);
516  hist_dijet_mass = bookHisto1D("m_jj",50,0,2000);
517  hist_pT_Hjj = bookHisto1D("pT_Hjj",50,0,250);
518  hist_Njets25 = bookHisto1D("Njets25",10,0,10);
519  hist_Njets30 = bookHisto1D("Njets30",10,0,10);
520  }
bool Rivet::HiggsTemplateCrossSections::isVH ( HTXS::HiggsProdMode  p)
inline

Whether the Higgs is produced in association with a vector boson (VH)

Definition at line 304 of file HiggsTemplateCrossSections.cc.

References HTXS::GG2ZH, HTXS::QQ2ZH, and HTXS::WH.

Referenced by classifyEvent(), and getStage1Category().

bool Rivet::HiggsTemplateCrossSections::originateFrom ( const Particle p,
const Particles &  ptcls 
)
inline

Whether particle p originate from any of the ptcls.

Definition at line 45 of file HiggsTemplateCrossSections.cc.

References HadronAndPartonSelector_cfi::particles.

Referenced by classifyEvent(), and originateFrom().

45  {
46  const GenVertex* prodVtx = p.genParticle()->production_vertex();
47  if (prodVtx == nullptr) return false;
48  // for each ancestor, check if it matches any of the input particles
49  for (const auto & ancestor:particles(prodVtx, HepMC::ancestors)){
50  for ( auto part:ptcls )
51  if ( ancestor==part.genParticle() ) return true;
52  }
53  // if we get here, no ancetor matched any input particle
54  return false;
55  }
part
Definition: HCALResponse.h:20
bool Rivet::HiggsTemplateCrossSections::originateFrom ( const Particle p,
const Particle p2 
)
inline

Whether particle p originates from p2.

Definition at line 58 of file HiggsTemplateCrossSections.cc.

References originateFrom().

58  {
59  Particles ptcls = {p2}; return originateFrom(p,ptcls);
60  }
double p2[4]
Definition: TauolaWrapper.h:90
bool originateFrom(const Particle &p, const Particles &ptcls)
Whether particle p originate from any of the ptcls.
void Rivet::HiggsTemplateCrossSections::printClassificationSummary ( )
inline

Definition at line 473 of file HiggsTemplateCrossSections.cc.

References HTXS::HIGGS_IDENTIFICATION, HTXS::HS_VTX_IDENTIFICATION, m_errorCount, HTXS::MOMENTUM_CONSERVATION, simpleEdmComparison::numEvents, HTXS::PRODMODE_DEFINED, HTXS::SUCCESS, HTXS::TOP_W_IDENTIFICATION, and HTXS::VH_IDENTIFICATION.

Referenced by finalize().

473  {
474  MSG_INFO (" ====================================================== ");
475  MSG_INFO (" Higgs Template X-Sec Categorization Tool ");
476  MSG_INFO (" Status Code Summary ");
477  MSG_INFO (" ====================================================== ");
478  bool allSuccess = (numEvents()==m_errorCount[HTXS::SUCCESS]);
479  if ( allSuccess ) MSG_INFO (" >>>> All "<< m_errorCount[HTXS::SUCCESS] <<" events successfully categorized!");
480  else{
481  MSG_INFO (" >>>> "<< m_errorCount[HTXS::SUCCESS] <<" events successfully categorized");
482  MSG_INFO (" >>>> --> the following errors occured:");
483  MSG_INFO (" >>>> "<< m_errorCount[HTXS::PRODMODE_DEFINED] <<" had an undefined Higgs production mode.");
484  MSG_INFO (" >>>> "<< m_errorCount[HTXS::MOMENTUM_CONSERVATION] <<" failed momentum conservation.");
485  MSG_INFO (" >>>> "<< m_errorCount[HTXS::HIGGS_IDENTIFICATION] <<" failed to identify a valid Higgs boson.");
486  MSG_INFO (" >>>> "<< m_errorCount[HTXS::HS_VTX_IDENTIFICATION] <<" failed to identify the hard scatter vertex.");
487  MSG_INFO (" >>>> "<< m_errorCount[HTXS::VH_IDENTIFICATION] <<" VH: to identify a valid V-boson.");
488  MSG_INFO (" >>>> "<< m_errorCount[HTXS::TOP_W_IDENTIFICATION] <<" failed to identify valid Ws from top decay.");
489  }
490  MSG_INFO (" ====================================================== ");
491  MSG_INFO (" ====================================================== ");
492  }
std::map< HTXS::ErrorCode, size_t > m_errorCount
failed to identify associated vector boson
successful classification
failed momentum conservation
failed to identify Higgs boson
failed to identify hard scatter vertex
production mode not defined
failed to identify top decay
bool Rivet::HiggsTemplateCrossSections::quarkDecay ( const Particle p)
inline

Return true is particle decays to quarks.

Definition at line 77 of file HiggsTemplateCrossSections.cc.

Referenced by classifyEvent(), getStage0Category(), and getStage1Category().

77  {
78  for (auto child:p.children())
79  if (PID::isQuark(child.pdgId())) return true;
80  return false;
81  }
void Rivet::HiggsTemplateCrossSections::setHiggsProdMode ( HTXS::HiggsProdMode  prodMode)
inline

Sets the Higgs production mode.

Definition at line 395 of file HiggsTemplateCrossSections.cc.

References m_HiggsProdMode.

395 { m_HiggsProdMode = prodMode; }
int Rivet::HiggsTemplateCrossSections::vbfTopology ( const Jets &  jets,
const Particle higgs 
)
inline

VBF topolog selection 0 = fail loose selction: m_jj > 400 GeV and Dy_jj > 2.8 1 pass loose, but fail additional cut pT(Hjj)<25. 2 pass tight selection.

Definition at line 296 of file HiggsTemplateCrossSections.cc.

References funct::abs(), ResonanceBuilder::mass, and EnergyCorrector::pt.

Referenced by getStage1Category().

296  {
297  if (jets.size()<2) return 0;
298  const FourMomentum &j1=jets[0].momentum(), &j2=jets[1].momentum();
299  bool VBFtopo = (j1+j2).mass() > 400.0 && std::abs(j1.rapidity()-j2.rapidity()) > 2.8;
300  return VBFtopo ? (j1+j2+higgs.momentum()).pt()<25 ? 2 : 1 : 0;
301  }
vector< PseudoJet > jets
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_deltay_jj
private

Definition at line 535 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_dijet_mass
private

Definition at line 535 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_Njets25
private

Definition at line 536 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_Njets30
private

Definition at line 536 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_pT_Higgs
private

Definition at line 533 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_pT_Hjj
private

Definition at line 535 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_pT_jet1
private

Definition at line 534 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_pT_V
private

Definition at line 534 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_stage0
private

Definition at line 531 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_stage1_pTjet25
private

Definition at line 532 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_stage1_pTjet30
private

Definition at line 532 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

Histo1DPtr Rivet::HiggsTemplateCrossSections::hist_y_Higgs
private

Definition at line 533 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and initializeHistos().

std::map<HTXS::ErrorCode,size_t> Rivet::HiggsTemplateCrossSections::m_errorCount
private

Definition at line 530 of file HiggsTemplateCrossSections.cc.

Referenced by classifyEvent(), error(), and printClassificationSummary().

HTXS::HiggsProdMode Rivet::HiggsTemplateCrossSections::m_HiggsProdMode
private

Definition at line 529 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), classifyEvent(), init(), and setHiggsProdMode().

double Rivet::HiggsTemplateCrossSections::m_sumw
private

Definition at line 528 of file HiggsTemplateCrossSections.cc.

Referenced by analyze(), finalize(), and init().