Rivet Analyses Reference

CMS_2016_I1491950

Differential cross sections for top quark pair production using the lepton+jets final state in proton proton collisions at 13 TeV
Experiment: CMS (LHC)
Inspire ID: 1491950
Status: VALIDATED
Authors:
  • Regina Demina
  • Yi-Ting Duh
  • Mario Galanti
  • Aran Garcia-Bellido
  • Otto Hindrichs
  • Mauro Verzetti
  • Markus Seidel
References:
  • Phys. Rev. D 95 (2017) 092001
  • arXiv: 1610.04191
  • CMS-TOP-16-008
Beams: p+ p+
Beam energies: (6500.0, 6500.0) GeV
Run details:
  • pp QCD interactions at $\sqrt{s} = 13$ TeV. Data collected by CMS during the year 2015. Selection of lepton+jets top pair candidate events at particle level.

Abstract: Differential and double-differential cross sections for the production of top quark pairs in proton-proton collisions at 13 TeV are measured as a function of jet multiplicity and of kinematic variables of the top quarks and the top quark-antiquark system. This analysis is based on data collected by the CMS experiment at the LHC corresponding to an integrated luminosity of 2.3 inverse femtobarns. The measurements are performed in the lepton+jets decay channels with a single muon or electron in the final state. The differential cross sections are presented at particle level, within a phase space close to the experimental acceptance, and at parton level in the full phase space. The results are compared to several standard model predictions. Rivet: This analysis is to be run on $\text{t}\bar{\text{t}}$ Monte Carlo. The particle-level phase space is defined using the following definitions: an electron or muon with $p_\text{T}>30\,\text{GeV}$ and $|\eta|<2.5$, dressed within a cone of radius 0.1; a jet is reconstructed with the anti-$k_t$ algorithm with a radius of 0.4, after removing the neutrinos and dressed leptons, with $p_\text{T}>25\,\text{GeV}$ and $|\eta|<2.5$; a jet that contains a B-hadron. A W boson is reconstructed from a lepton and the sum of the neutrino energies, while another W boson is reconstructed from a light jet pair. The two top quarks are reconstructed by combining b jets to these W boson. A check based on the W boson and top quark masses is performed to choose the proper combinations.

Source code: CMS_2016_I1491950.cc
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
// -*- C++ -*-
#include "Rivet/Analysis.hh"
#include "Rivet/Projections/FinalState.hh"
#include "Rivet/Projections/FastJets.hh"
#include "Rivet/Projections/DressedLeptons.hh"
#include "Rivet/Projections/PromptFinalState.hh"
#include "Rivet/Projections/IdentifiedFinalState.hh"
#include "Rivet/Projections/VetoedFinalState.hh"

namespace Rivet {


  class CMS_2016_I1491950 : public Analysis {
  public:

    /// Constructor
    CMS_2016_I1491950()
      : Analysis("CMS_2016_I1491950")
    {    }

    /// Book histograms and initialise projections before the run
    void init() {

    FinalState fs(Cuts::pT > 0. && Cuts::abseta < 6.);
    PromptFinalState prompt_fs(fs);
    prompt_fs.acceptMuonDecays(true);
    prompt_fs.acceptTauDecays(true);

    // Projection for dressed electrons and muons
    Cut leptonCuts = Cuts::abseta < 2.5 and Cuts::pt > 30.*GeV;
    SpecialDressedLeptons dressedleptons(prompt_fs, leptonCuts);
    declare(dressedleptons, "DressedLeptons");

    // Neutrinos
    IdentifiedFinalState neutrinos(prompt_fs);
    neutrinos.acceptNeutrinos();
    declare(neutrinos, "Neutrinos");

    // Projection for jets
    VetoedFinalState fsForJets(fs);
    fsForJets.addVetoOnThisFinalState(dressedleptons);
    fsForJets.addVetoOnThisFinalState(neutrinos);
    declare(FastJets(fsForJets, FastJets::ANTIKT, 0.4, JetAlg::Muons::DECAY, JetAlg::Invisibles::DECAY), "Jets");

    //book hists
    book(_hist_thadpt, "d01-x02-y01");
    book(_hist_thady, "d03-x02-y01");
    book(_hist_tleppt, "d05-x02-y01");
    book(_hist_tlepy, "d07-x02-y01");
    book(_hist_ttpt, "d09-x02-y01");
    book(_hist_tty, "d13-x02-y01");
    book(_hist_ttm, "d11-x02-y01");
    book(_hist_njet, "d15-x02-y01");
    book(_hist_njets_thadpt_1, "d17-x02-y01");
    book(_hist_njets_thadpt_2, "d18-x02-y01");
    book(_hist_njets_thadpt_3, "d19-x02-y01");
    book(_hist_njets_thadpt_4, "d20-x02-y01");
    book(_hist_njets_ttpt_1, "d22-x02-y01");
    book(_hist_njets_ttpt_2, "d23-x02-y01");
    book(_hist_njets_ttpt_3, "d24-x02-y01");
    book(_hist_njets_ttpt_4, "d25-x02-y01");
    book(_hist_thady_thadpt_1, "d27-x02-y01");
    book(_hist_thady_thadpt_2, "d28-x02-y01");
    book(_hist_thady_thadpt_3, "d29-x02-y01");
    book(_hist_thady_thadpt_4, "d30-x02-y01");
    book(_hist_ttm_tty_1, "d32-x02-y01");
    book(_hist_ttm_tty_2, "d33-x02-y01");
    book(_hist_ttm_tty_3, "d34-x02-y01");
    book(_hist_ttm_tty_4, "d35-x02-y01");
    book(_hist_ttpt_ttm_1, "d37-x02-y01");
    book(_hist_ttpt_ttm_2, "d38-x02-y01");
    book(_hist_ttpt_ttm_3, "d39-x02-y01");
    book(_hist_ttpt_ttm_4, "d40-x02-y01");
    book(_histnorm_thadpt, "d42-x02-y01");
    book(_histnorm_thady, "d44-x02-y01");
    book(_histnorm_tleppt, "d46-x02-y01");
    book(_histnorm_tlepy, "d48-x02-y01");
    book(_histnorm_ttpt, "d50-x02-y01");
    book(_histnorm_tty, "d54-x02-y01");
    book(_histnorm_ttm, "d52-x02-y01");
    book(_histnorm_njet, "d56-x02-y01");
    book(_histnorm_njets_thadpt_1, "d58-x02-y01");
    book(_histnorm_njets_thadpt_2, "d59-x02-y01");
    book(_histnorm_njets_thadpt_3, "d60-x02-y01");
    book(_histnorm_njets_thadpt_4, "d61-x02-y01");
    book(_histnorm_njets_ttpt_1, "d63-x02-y01");
    book(_histnorm_njets_ttpt_2, "d64-x02-y01");
    book(_histnorm_njets_ttpt_3, "d65-x02-y01");
    book(_histnorm_njets_ttpt_4, "d66-x02-y01");
    book(_histnorm_thady_thadpt_1, "d68-x02-y01");
    book(_histnorm_thady_thadpt_2, "d69-x02-y01");
    book(_histnorm_thady_thadpt_3, "d70-x02-y01");
    book(_histnorm_thady_thadpt_4, "d71-x02-y01");
    book(_histnorm_ttm_tty_1, "d73-x02-y01");
    book(_histnorm_ttm_tty_2, "d74-x02-y01");
    book(_histnorm_ttm_tty_3, "d75-x02-y01");
    book(_histnorm_ttm_tty_4, "d76-x02-y01");
    book(_histnorm_ttpt_ttm_1, "d78-x02-y01");
    book(_histnorm_ttpt_ttm_2, "d79-x02-y01");
    book(_histnorm_ttpt_ttm_3, "d80-x02-y01");
    book(_histnorm_ttpt_ttm_4, "d81-x02-y01");

   }


    /// Perform the per-event analysis
    void analyze(const Event& event) {

      // leptons
      const SpecialDressedLeptons& dressedleptons_proj = applyProjection<SpecialDressedLeptons>(event, "DressedLeptons");
      std::vector<DressedLepton> dressedLeptons = dressedleptons_proj.dressedLeptons();
      if(dressedLeptons.size() != 1) return;

      // neutrinos
      const Particles neutrinos = apply<FinalState>(event, "Neutrinos").particlesByPt();
      _nusum = FourMomentum(0., 0., 0., 0.);
      for(const Particle& neutrino : neutrinos)
          _nusum += neutrino.momentum();
      _wl = _nusum + dressedLeptons[0].momentum();

      // jets
      Cut jet_cut = (Cuts::abseta < 2.5) and (Cuts::pT > 25.*GeV);
      const Jets jets = apply<FastJets>(event, "Jets").jetsByPt(jet_cut);
      Jets allJets;
      for (const Jet& jet : jets) {
        allJets.push_back(jet);
      }
      Jets bJets;
      for (const Jet& jet : allJets) {
        if (jet.bTagged()) bJets.push_back(jet);
      }

      if(bJets.size() < 2 || allJets.size() < 4) return;

      //construct top quark proxies
      double Kmin = numeric_limits<double>::max();
      for(const Jet& itaj : allJets) {
          for(const Jet& itbj : allJets) {
              if (itaj.momentum() == itbj.momentum()) continue;
              FourMomentum wh(itaj.momentum() + itbj.momentum());
              for(const Jet& ithbj : bJets) {
                  if(itaj.momentum() == ithbj.momentum() || itbj.momentum() == ithbj.momentum()) continue;
                  FourMomentum th(wh + ithbj.momentum());
                  for(const Jet& itlbj : bJets) {
                      if(itaj.momentum() == itlbj.momentum() || itbj.momentum() == itlbj.momentum() || ithbj.momentum() == itlbj.momentum()) continue;
                      FourMomentum tl(_wl + itlbj.momentum());

                      double K = pow(wh.mass() - 80.4, 2) + pow(th.mass() - 172.5, 2) + pow(tl.mass() - 172.5, 2);
                      if(K < Kmin)
                        {
                          Kmin = K;
                          _tl = tl;
                          _th = th;
                          _wh = wh;
                        }
                    }
                }
            }
        }

    _hist_thadpt->fill(_th.pt());
    _hist_thady->fill(abs(_th.rapidity()) );
    _hist_tleppt->fill(_tl.pt() );
    _hist_tlepy->fill(abs(_tl.rapidity()) );
    _histnorm_thadpt->fill(_th.pt());
    _histnorm_thady->fill(abs(_th.rapidity()) );
    _histnorm_tleppt->fill(_tl.pt() );
    _histnorm_tlepy->fill(abs(_tl.rapidity()) );
    FourMomentum tt(_tl+_th);
    _hist_ttpt->fill(tt.pt() );
    _hist_tty->fill(abs(tt.rapidity()) );
    _hist_ttm->fill(tt.mass() );
    _hist_njet->fill(min(allJets.size()-4., 4.));
    _histnorm_ttpt->fill(tt.pt() );
    _histnorm_tty->fill(abs(tt.rapidity()) );
    _histnorm_ttm->fill(tt.mass() );
    _histnorm_njet->fill(min(allJets.size()-4., 4.));
    if(allJets.size() == 4)
    {
     _hist_njets_thadpt_1->fill(_th.pt());
     _hist_njets_ttpt_1->fill(tt.pt());
     _histnorm_njets_thadpt_1->fill(_th.pt());
     _histnorm_njets_ttpt_1->fill(tt.pt());
    }
    else if(allJets.size() == 5)
    {
     _hist_njets_thadpt_2->fill(_th.pt());
     _hist_njets_ttpt_2->fill(tt.pt());
     _histnorm_njets_thadpt_2->fill(_th.pt());
     _histnorm_njets_ttpt_2->fill(tt.pt());
    }
    else if(allJets.size() == 6)
    {
     _hist_njets_thadpt_3->fill(_th.pt());
     _hist_njets_ttpt_3->fill(tt.pt());
     _histnorm_njets_thadpt_3->fill(_th.pt());
     _histnorm_njets_ttpt_3->fill(tt.pt());
    }
    else //>= 4 jets
    {
     _hist_njets_thadpt_4->fill(_th.pt());
     _hist_njets_ttpt_4->fill(tt.pt());
     _histnorm_njets_thadpt_4->fill(_th.pt());
     _histnorm_njets_ttpt_4->fill(tt.pt());
    }

    if(abs(_th.rapidity()) < 0.5)
    {
     _hist_thady_thadpt_1->fill(_th.pt());
     _histnorm_thady_thadpt_1->fill(_th.pt());
    }
    else if(abs(_th.rapidity()) < 1.0)
    {
     _hist_thady_thadpt_2->fill(_th.pt());
     _histnorm_thady_thadpt_2->fill(_th.pt());
    }
    else if(abs(_th.rapidity()) < 1.5)
    {
     _hist_thady_thadpt_3->fill(_th.pt());
     _histnorm_thady_thadpt_3->fill(_th.pt());
    }
    else if(abs(_th.rapidity()) < 2.5)
    {
     _hist_thady_thadpt_4->fill(_th.pt());
     _histnorm_thady_thadpt_4->fill(_th.pt());
    }

      if(tt.mass() >= 300. && tt.mass() < 450.)
        {
          _hist_ttm_tty_1->fill(abs(tt.rapidity()));
          _histnorm_ttm_tty_1->fill(abs(tt.rapidity()));
        }
      else if(tt.mass() >= 450. && tt.mass() < 625.)
        {
          _hist_ttm_tty_2->fill(abs(tt.rapidity()));
          _histnorm_ttm_tty_2->fill(abs(tt.rapidity()));
        }
      else if(tt.mass() >= 625. && tt.mass() < 850.)
        {
          _hist_ttm_tty_3->fill(abs(tt.rapidity()));
          _histnorm_ttm_tty_3->fill(abs(tt.rapidity()));
        }
      else if(tt.mass() >= 850. && tt.mass() < 2000.)
        {
          _hist_ttm_tty_4->fill(abs(tt.rapidity()));
          _histnorm_ttm_tty_4->fill(abs(tt.rapidity()));
        }

      if(tt.pt() < 35.)
        {
          _hist_ttpt_ttm_1->fill(tt.mass());
          _histnorm_ttpt_ttm_1->fill(tt.mass());
        }
      else if(tt.pt() < 80.)
        {
          _hist_ttpt_ttm_2->fill(tt.mass());
          _histnorm_ttpt_ttm_2->fill(tt.mass());
        }
      else if(tt.pt() < 140.)
        {
          _hist_ttpt_ttm_3->fill(tt.mass());
          _histnorm_ttpt_ttm_3->fill(tt.mass());
        }
      else if(tt.pt() < 500.)
        {
          _hist_ttpt_ttm_4->fill(tt.mass());
          _histnorm_ttpt_ttm_4->fill(tt.mass());
        }

    }


    /// Normalise histograms etc., after the run
    void finalize()
    {
      scale(_hist_thadpt, crossSection()/sumOfWeights());
      scale(_hist_thady, crossSection()/sumOfWeights());
      scale(_hist_tleppt, crossSection()/sumOfWeights());
      scale(_hist_tlepy, crossSection()/sumOfWeights());
      scale(_hist_ttpt, crossSection()/sumOfWeights());
      scale(_hist_tty, crossSection()/sumOfWeights());
      scale(_hist_ttm, crossSection()/sumOfWeights());
      scale(_hist_njet, crossSection()/sumOfWeights());
      scale(_hist_njets_thadpt_1, crossSection()/sumOfWeights());
      scale(_hist_njets_thadpt_2, crossSection()/sumOfWeights());
      scale(_hist_njets_thadpt_3, crossSection()/sumOfWeights());
      scale(_hist_njets_thadpt_4, crossSection()/sumOfWeights());
      scale(_hist_njets_ttpt_1, crossSection()/sumOfWeights());
      scale(_hist_njets_ttpt_2, crossSection()/sumOfWeights());
      scale(_hist_njets_ttpt_3, crossSection()/sumOfWeights());
      scale(_hist_njets_ttpt_4, crossSection()/sumOfWeights());
      scale(_hist_thady_thadpt_1, crossSection()/sumOfWeights()/0.5);
      scale(_hist_thady_thadpt_2, crossSection()/sumOfWeights()/0.5);
      scale(_hist_thady_thadpt_3, crossSection()/sumOfWeights()/0.5);
      scale(_hist_thady_thadpt_4, crossSection()/sumOfWeights()/1.0);
      scale(_hist_ttm_tty_1, crossSection()/sumOfWeights()/150.);
      scale(_hist_ttm_tty_2, crossSection()/sumOfWeights()/175.);
      scale(_hist_ttm_tty_3, crossSection()/sumOfWeights()/225.);
      scale(_hist_ttm_tty_4, crossSection()/sumOfWeights()/1150.);
      scale(_hist_ttpt_ttm_1, crossSection()/sumOfWeights()/35.);
      scale(_hist_ttpt_ttm_2, crossSection()/sumOfWeights()/45.);
      scale(_hist_ttpt_ttm_3, crossSection()/sumOfWeights()/60.);
      scale(_hist_ttpt_ttm_4, crossSection()/sumOfWeights()/360.);

      scale(_histnorm_thadpt, 1./_histnorm_thadpt->sumW(false));
      scale(_histnorm_thady, 1./_histnorm_thady->sumW(false));
      scale(_histnorm_tleppt, 1./_histnorm_tleppt->sumW(false));
      scale(_histnorm_tlepy, 1./_histnorm_tlepy->sumW(false));
      scale(_histnorm_ttpt, 1./_histnorm_ttpt->sumW(false));
      scale(_histnorm_tty, 1./_histnorm_tty->sumW(false));
      scale(_histnorm_ttm, 1./_histnorm_ttm->sumW(false));
      scale(_histnorm_njet, 1./_histnorm_njet->sumW(false));
      double sum_njets_thadpt = _histnorm_njets_thadpt_1->sumW(false) + _histnorm_njets_thadpt_2->sumW(false) + _histnorm_njets_thadpt_3->sumW(false) + _histnorm_njets_thadpt_4->sumW(false);
      scale(_histnorm_njets_thadpt_1, 1./sum_njets_thadpt);
      scale(_histnorm_njets_thadpt_2, 1./sum_njets_thadpt);
      scale(_histnorm_njets_thadpt_3, 1./sum_njets_thadpt);
      scale(_histnorm_njets_thadpt_4, 1./sum_njets_thadpt);
      double sum_njets_ttpt = _histnorm_njets_ttpt_1->sumW(false) + _histnorm_njets_ttpt_2->sumW(false) + _histnorm_njets_ttpt_3->sumW(false) + _histnorm_njets_ttpt_4->sumW(false);
      scale(_histnorm_njets_ttpt_1, 1./sum_njets_ttpt);
      scale(_histnorm_njets_ttpt_2, 1./sum_njets_ttpt);
      scale(_histnorm_njets_ttpt_3, 1./sum_njets_ttpt);
      scale(_histnorm_njets_ttpt_4, 1./sum_njets_ttpt);
      double sum_thady_thadpt = _histnorm_thady_thadpt_1->sumW(false) + _histnorm_thady_thadpt_2->sumW(false) + _histnorm_thady_thadpt_3->sumW(false) + _histnorm_thady_thadpt_4->sumW(false);
      scale(_histnorm_thady_thadpt_1, 1./sum_thady_thadpt/0.5);
      scale(_histnorm_thady_thadpt_2, 1./sum_thady_thadpt/0.5);
      scale(_histnorm_thady_thadpt_3, 1./sum_thady_thadpt/0.5);
      scale(_histnorm_thady_thadpt_4, 1./sum_thady_thadpt/1.0);
      double sum_ttm_tty = _histnorm_ttm_tty_1->sumW(false) + _histnorm_ttm_tty_2->sumW(false) + _histnorm_ttm_tty_3->sumW(false) + _histnorm_ttm_tty_4->sumW(false);
      scale(_histnorm_ttm_tty_1, 1./sum_ttm_tty/150.);
      scale(_histnorm_ttm_tty_2, 1./sum_ttm_tty/175.);
      scale(_histnorm_ttm_tty_3, 1./sum_ttm_tty/225.);
      scale(_histnorm_ttm_tty_4, 1./sum_ttm_tty/1150.);
      double sum_ttpt_ttm = _histnorm_ttpt_ttm_1->sumW(false) + _histnorm_ttpt_ttm_2->sumW(false) + _histnorm_ttpt_ttm_3->sumW(false) + _histnorm_ttpt_ttm_4->sumW(false);
      scale(_histnorm_ttpt_ttm_1, 1./sum_ttpt_ttm/35.);
      scale(_histnorm_ttpt_ttm_2, 1./sum_ttpt_ttm/45.);
      scale(_histnorm_ttpt_ttm_3, 1./sum_ttpt_ttm/60.);
      scale(_histnorm_ttpt_ttm_4, 1./sum_ttpt_ttm/360.);

    }


    /// @brief Special dressed lepton finder
    ///
    /// Find dressed leptons by clustering all leptons and photons
    class SpecialDressedLeptons : public FinalState {
    public:
      /// The default constructor. May specify cuts
      SpecialDressedLeptons(const FinalState& fs, const Cut& cut)
        : FinalState(cut)
      {
        setName("SpecialDressedLeptons");
        IdentifiedFinalState ifs(fs);
        ifs.acceptIdPair(PID::PHOTON);
        ifs.acceptIdPair(PID::ELECTRON);
        ifs.acceptIdPair(PID::MUON);
        declare(ifs, "IFS");
        declare(FastJets(ifs, FastJets::ANTIKT, 0.1), "LeptonJets");
      }

      /// Clone on the heap.
      virtual unique_ptr<Projection> clone() const {
        return unique_ptr<Projection>(new SpecialDressedLeptons(*this));
      }

      /// Retrieve the dressed leptons
      const vector<DressedLepton>& dressedLeptons() const { return _clusteredLeptons; }

    private:
      /// Container which stores the clustered lepton objects
      vector<DressedLepton> _clusteredLeptons;

    public:
      void project(const Event& e) {

        _theParticles.clear();
        _clusteredLeptons.clear();

        vector<DressedLepton> allClusteredLeptons;

        const Jets jets = applyProjection<FastJets>(e, "LeptonJets").jetsByPt(5.*GeV);
        for (const Jet& jet : jets) {
          Particle lepCand;
          for (const Particle& cand : jet.particles()) {
            const int absPdgId = abs(cand.pid());
            if (absPdgId == PID::ELECTRON || absPdgId == PID::MUON) {
              if (cand.pt() > lepCand.pt()) lepCand = cand;
            }
          }

          //Central lepton must be the major component
          if ((lepCand.pt() < jet.pt()/2.) || (lepCand.pid() == 0)) continue;

          DressedLepton lepton(lepCand);
          for (const Particle& cand : jet.particles()) {
            if (isSame(cand, lepCand)) continue;
            if (cand.pid() != PID::PHOTON) continue;
            lepton.addConstituent(cand, true);
          }
          allClusteredLeptons.push_back(lepton);
        }

        for (const DressedLepton& lepton : allClusteredLeptons) {
          if (accept(lepton)) {
            _clusteredLeptons.push_back(lepton);
            _theParticles.push_back(lepton.constituentLepton());
            _theParticles += lepton.constituentPhotons();
          }
        }
      }

    };


  private:

   FourMomentum _tl;
   FourMomentum _th;
   FourMomentum _wl;
   FourMomentum _wh;
   FourMomentum _nusum;

   Histo1DPtr _hist_thadpt;
   Histo1DPtr _hist_thady;
   Histo1DPtr _hist_tleppt;
   Histo1DPtr _hist_tlepy;
   Histo1DPtr _hist_ttpt;
   Histo1DPtr _hist_tty;
   Histo1DPtr _hist_ttm;
   Histo1DPtr _hist_njet;
   Histo1DPtr _hist_njets_thadpt_1;
   Histo1DPtr _hist_njets_thadpt_2;
   Histo1DPtr _hist_njets_thadpt_3;
   Histo1DPtr _hist_njets_thadpt_4;
   Histo1DPtr _hist_njets_ttpt_1;
   Histo1DPtr _hist_njets_ttpt_2;
   Histo1DPtr _hist_njets_ttpt_3;
   Histo1DPtr _hist_njets_ttpt_4;
   Histo1DPtr _hist_thady_thadpt_1;
   Histo1DPtr _hist_thady_thadpt_2;
   Histo1DPtr _hist_thady_thadpt_3;
   Histo1DPtr _hist_thady_thadpt_4;
   Histo1DPtr _hist_ttm_tty_1;
   Histo1DPtr _hist_ttm_tty_2;
   Histo1DPtr _hist_ttm_tty_3;
   Histo1DPtr _hist_ttm_tty_4;
   Histo1DPtr _hist_ttpt_ttm_1;
   Histo1DPtr _hist_ttpt_ttm_2;
   Histo1DPtr _hist_ttpt_ttm_3;
   Histo1DPtr _hist_ttpt_ttm_4;

   Histo1DPtr _histnorm_thadpt;
   Histo1DPtr _histnorm_thady;
   Histo1DPtr _histnorm_tleppt;
   Histo1DPtr _histnorm_tlepy;
   Histo1DPtr _histnorm_ttpt;
   Histo1DPtr _histnorm_tty;
   Histo1DPtr _histnorm_ttm;
   Histo1DPtr _histnorm_njet;
   Histo1DPtr _histnorm_njets_thadpt_1;
   Histo1DPtr _histnorm_njets_thadpt_2;
   Histo1DPtr _histnorm_njets_thadpt_3;
   Histo1DPtr _histnorm_njets_thadpt_4;
   Histo1DPtr _histnorm_njets_ttpt_1;
   Histo1DPtr _histnorm_njets_ttpt_2;
   Histo1DPtr _histnorm_njets_ttpt_3;
   Histo1DPtr _histnorm_njets_ttpt_4;
   Histo1DPtr _histnorm_thady_thadpt_1;
   Histo1DPtr _histnorm_thady_thadpt_2;
   Histo1DPtr _histnorm_thady_thadpt_3;
   Histo1DPtr _histnorm_thady_thadpt_4;
   Histo1DPtr _histnorm_ttm_tty_1;
   Histo1DPtr _histnorm_ttm_tty_2;
   Histo1DPtr _histnorm_ttm_tty_3;
   Histo1DPtr _histnorm_ttm_tty_4;
   Histo1DPtr _histnorm_ttpt_ttm_1;
   Histo1DPtr _histnorm_ttpt_ttm_2;
   Histo1DPtr _histnorm_ttpt_ttm_3;
   Histo1DPtr _histnorm_ttpt_ttm_4;   
   
 };



 // The hook for the plugin system
 RIVET_DECLARE_PLUGIN(CMS_2016_I1491950);

}