Rivet is hosted by Hepforge, IPPP Durham

Rivet analyses reference

ATLAS_2011_I945498

$Z$+jets in $pp$ at 7 TeV
Experiment: ATLAS (LHC)
Inspire ID: 945498
Status: VALIDATED
Authors:
  • Evelin Meoni
  • Holger Schulz
  • Roman Lysak
References: Beams: p+ p+
Beam energies: (3500.0, 3500.0) GeV
Run details:
  • Z+jets, electronic and/or muonic Z-decays. Jets with transverse momentum $p_T > 30$ GeV and jet rapidity $|y| < 4.4$.

Production of jets in association with a $Z/\gamma^*$ boson in proton--proton collisions at $\sqrt{s} = 7$ TeV with the ATLAS detector. The analysis includes the full 2010 data set, collected with a low rate of multiple proton--proton collisions in the accelerator, corresponding to an integrated luminosity of 36 pb$^{-1}$. Inclusive jet cross sections in $Z/\gamma^*$ events, with $Z/\gamma^*$ decaying into electron or muon pairs, are measured for jets with transverse momentum $p_T > 30$ GeV and jet rapidity $|y| < 4.4$.

Source code: ATLAS_2011_I945498.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
// -*- C++ -*-
#include "Rivet/Analysis.hh"

#include "Rivet/Projections/ZFinder.hh"
#include "Rivet/Projections/FastJets.hh"
#include "Rivet/Projections/FinalState.hh"
#include "Rivet/Projections/VetoedFinalState.hh"
#include "Rivet/Projections/IdentifiedFinalState.hh"
#include "Rivet/Projections/LeadingParticlesFinalState.hh"


namespace Rivet {


  /// ATLAS Z+jets in pp at 7 TeV
  class ATLAS_2011_I945498 : public Analysis {
  public:

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


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

      // Variable initialisation
      _isZeeSample = false;
      _isZmmSample = false;
      for (size_t chn = 0; chn < 3; ++chn) {
        weights_nj0[chn] = 0;
        weights_nj1[chn] = 0;
        weights_nj2[chn] = 0;
        weights_nj3[chn] = 0;
        weights_nj4[chn] = 0;
      }

      // Set up projections
	  FinalState fs;
      ZFinder zfinder_mu(fs, Cuts::abseta < 2.4 && Cuts::pT > 20*GeV, PID::MUON, 66*GeV, 116*GeV, 0.1, ZFinder::CLUSTERNODECAY);
      declare(zfinder_mu, "ZFinder_mu");

      Cut cuts = (Cuts::abseta < 1.37 || Cuts::absetaIn(1.52, 2.47)) && Cuts::pT > 20*GeV;

      ZFinder zfinder_el(fs, cuts, PID::ELECTRON, 66*GeV, 116*GeV, 0.1, ZFinder::CLUSTERNODECAY);
      declare(zfinder_el, "ZFinder_el");

	  Cut cuts25_20 = Cuts::abseta < 2.5 && Cuts::pT > 20*GeV;
      // For combined cross-sections (combined phase space + dressed level)
      ZFinder zfinder_comb_mu(fs, cuts25_20, PID::MUON, 66.0*GeV, 116.0*GeV, 0.1, ZFinder::CLUSTERNODECAY);
      declare(zfinder_comb_mu, "ZFinder_comb_mu");
      ZFinder zfinder_comb_el(fs, cuts25_20, PID::ELECTRON, 66.0*GeV, 116.0*GeV, 0.1, ZFinder::CLUSTERNODECAY);
      declare(zfinder_comb_el, "ZFinder_comb_el");

      // Define veto FS in order to prevent Z-decay products entering the jet algorithm
      VetoedFinalState remfs;
      remfs.addVetoOnThisFinalState(zfinder_el);
      remfs.addVetoOnThisFinalState(zfinder_mu);
      VetoedFinalState remfs_comb;
      remfs_comb.addVetoOnThisFinalState(zfinder_comb_el);
      remfs_comb.addVetoOnThisFinalState(zfinder_comb_mu);

      FastJets jets(remfs, FastJets::ANTIKT, 0.4);
      jets.useInvisibles();
      declare(jets, "jets");
      FastJets jets_comb(remfs_comb, FastJets::ANTIKT, 0.4);
      jets_comb.useInvisibles();
      declare(jets_comb, "jets_comb");

      // 0=el, 1=mu, 2=comb
      for (size_t chn = 0; chn < 3; ++chn) {
        _h_njet_incl[chn]  = bookHisto1D(1, 1, chn+1);
        _h_njet_ratio[chn] = bookScatter2D(2, 1, chn+1);
        _h_ptjet[chn]      = bookHisto1D(3, 1, chn+1);
        _h_ptlead[chn]     = bookHisto1D(4, 1, chn+1);
        _h_ptseclead[chn]  = bookHisto1D(5, 1, chn+1);
        _h_yjet[chn]       = bookHisto1D(6, 1, chn+1);
        _h_ylead[chn]      = bookHisto1D(7, 1, chn+1);
        _h_yseclead[chn]   = bookHisto1D(8, 1, chn+1);
        _h_mass[chn]       = bookHisto1D(9, 1, chn+1);
        _h_deltay[chn]     = bookHisto1D(10, 1, chn+1);
        _h_deltaphi[chn]   = bookHisto1D(11, 1, chn+1);
        _h_deltaR[chn]     = bookHisto1D(12, 1, chn+1);
      }
    }


    // Jet selection criteria universal for electron and muon channel
    /// @todo Replace with a Cut passed to jetsByPt
    Jets selectJets(const ZFinder* zf, const FastJets* allJets) {
      const FourMomentum l1 = zf->constituents()[0].momentum();
      const FourMomentum l2 = zf->constituents()[1].momentum();
      Jets jets;
      foreach (const Jet& jet, allJets->jetsByPt(30*GeV)) {
        const FourMomentum jmom = jet.momentum();
        if (jmom.absrap() < 4.4 &&
            deltaR(l1, jmom) > 0.5  && deltaR(l2, jmom) > 0.5) {
          jets.push_back(jet);
        }
      }
      return jets;
    }


    /// Perform the per-event analysis
    void analyze(const Event& event) {
      const double weight = event.weight();

      vector<const ZFinder*> zfs;
      zfs.push_back(& (apply<ZFinder>(event, "ZFinder_el")));
      zfs.push_back(& (apply<ZFinder>(event, "ZFinder_mu")));
      zfs.push_back(& (apply<ZFinder>(event, "ZFinder_comb_el")));
      zfs.push_back(& (apply<ZFinder>(event, "ZFinder_comb_mu")));

      vector<const FastJets*> fjs;
      fjs.push_back(& (apply<FastJets>(event, "jets")));
      fjs.push_back(& (apply<FastJets>(event, "jets_comb")));

      // Determine what kind of MC sample this is
      const bool isZee = (zfs[0]->bosons().size() == 1) || (zfs[2]->bosons().size() == 1);
      const bool isZmm = (zfs[1]->bosons().size() == 1) || (zfs[3]->bosons().size() == 1);
      if (isZee) _isZeeSample = true;
      if (isZmm) _isZmmSample = true;

      // Require exactly one electronic or muonic Z-decay in the event
      bool isZeemm = ( (zfs[0]->bosons().size() == 1 && zfs[1]->bosons().size() != 1) ||
                       (zfs[1]->bosons().size() == 1 && zfs[0]->bosons().size() != 1) );
      bool isZcomb = ( (zfs[2]->bosons().size() == 1 && zfs[3]->bosons().size() != 1) ||
                       (zfs[3]->bosons().size() == 1 && zfs[2]->bosons().size() != 1) );
      if (!isZeemm && !isZcomb) vetoEvent;

      vector<int> zfIDs;
      vector<int> fjIDs;
      if (isZeemm) {
        int chn = zfs[0]->bosons().size() == 1 ? 0 : 1;
        zfIDs.push_back(chn);
        fjIDs.push_back(0);
      }
      if (isZcomb) {
        int chn = zfs[2]->bosons().size() == 1 ? 2 : 3;
        zfIDs.push_back(chn);
        fjIDs.push_back(1);
      }

      for (size_t izf = 0; izf < zfIDs.size(); ++izf) {
        int zfID = zfIDs[izf];
        int fjID = fjIDs[izf];

        int chn = zfID;
        if (zfID == 2 || zfID == 3) chn = 2;

        Jets jets = selectJets(zfs[zfID], fjs[fjID]);

        switch (jets.size()) {
        case 0:
          weights_nj0[chn] += weight;
          break;
        case 1:
          weights_nj0[chn] += weight;
          weights_nj1[chn] += weight;
          break;
        case 2:
          weights_nj0[chn] += weight;
          weights_nj1[chn] += weight;
          weights_nj2[chn] += weight;
          break;
        case 3:
          weights_nj0[chn] += weight;
          weights_nj1[chn] += weight;
          weights_nj2[chn] += weight;
          weights_nj3[chn] += weight;
          break;
        default: // >= 4
          weights_nj0[chn] += weight;
          weights_nj1[chn] += weight;
          weights_nj2[chn] += weight;
          weights_nj3[chn] += weight;
          weights_nj4[chn] += weight;
        }

        // Require at least one jet
        if (jets.empty()) continue;

        // Fill jet multiplicities
        for (size_t ijet = 1; ijet <= jets.size(); ++ijet) {
          _h_njet_incl[chn]->fill(ijet, weight);
        }

        // Loop over selected jets, fill inclusive jet distributions
        for (size_t ijet = 0; ijet < jets.size(); ++ijet) {
          _h_ptjet[chn]->fill(jets[ijet].pT()/GeV, weight);
          _h_yjet [chn]->fill(fabs(jets[ijet].rapidity()), weight);
        }

        // Leading jet histos
        const double ptlead   = jets[0].pT()/GeV;
        const double yabslead = fabs(jets[0].rapidity());
        _h_ptlead[chn]->fill(ptlead,   weight);
        _h_ylead [chn]->fill(yabslead, weight);

        if (jets.size() >= 2) {
          // Second jet histos
          const double pt2ndlead   = jets[1].pT()/GeV;
          const double yabs2ndlead = fabs(jets[1].rapidity());
          _h_ptseclead[chn] ->fill(pt2ndlead,   weight);
          _h_yseclead [chn] ->fill(yabs2ndlead, weight);

          // Dijet histos
          const double deltaphi = fabs(deltaPhi(jets[1], jets[0]));
          const double deltarap = fabs(jets[0].rapidity() - jets[1].rapidity()) ;
          const double deltar   = fabs(deltaR(jets[0], jets[1], RAPIDITY));
          const double mass     = (jets[0].momentum() + jets[1].momentum()).mass();
          _h_mass    [chn] ->fill(mass/GeV, weight);
          _h_deltay  [chn] ->fill(deltarap, weight);
          _h_deltaphi[chn] ->fill(deltaphi, weight);
          _h_deltaR  [chn] ->fill(deltar,   weight);
        }
      }
    }


    /// @name Ratio calculator util functions
    //@{

    /// Calculate the ratio, being careful about div-by-zero
    double ratio(double a, double b) {
      return (b != 0) ? a/b : 0;
    }

    /// Calculate the ratio error, being careful about div-by-zero
    double ratio_err(double a, double b) {
      return (b != 0) ? sqrt(a/sqr(b) + sqr(a)/(b*b*b)) : 0;
    }

    //@}


    void finalize() {
      // Fill ratio histograms
      for (size_t chn = 0; chn < 3; ++chn) {
        _h_njet_ratio[chn]->addPoint(1, ratio(weights_nj1[chn], weights_nj0[chn]), 0.5, ratio_err(weights_nj1[chn], weights_nj0[chn]));
        _h_njet_ratio[chn]->addPoint(2, ratio(weights_nj2[chn], weights_nj1[chn]), 0.5, ratio_err(weights_nj2[chn], weights_nj1[chn]));
        _h_njet_ratio[chn]->addPoint(3, ratio(weights_nj3[chn], weights_nj2[chn]), 0.5, ratio_err(weights_nj3[chn], weights_nj2[chn]));
        _h_njet_ratio[chn]->addPoint(4, ratio(weights_nj4[chn], weights_nj3[chn]), 0.5, ratio_err(weights_nj4[chn], weights_nj3[chn]));
      }

      // Scale other histos
      for (size_t chn = 0; chn < 3; ++chn) {
        // For ee and mumu channels: normalize to Njet inclusive cross-section
        double xs = (chn == 2) ? crossSectionPerEvent()/picobarn : 1 / weights_nj0[chn];
        // For inclusive MC sample(ee/mmu channels together) we want the single-lepton-flavor xsec
        if (_isZeeSample && _isZmmSample) xs /= 2;

        // Special case histogram: always not normalized
        scale(_h_njet_incl[chn], (chn < 2) ? crossSectionPerEvent()/picobarn : xs);

        scale(_h_ptjet[chn]    , xs);
        scale(_h_ptlead[chn]   , xs);
        scale(_h_ptseclead[chn], xs);
        scale(_h_yjet[chn]     , xs);
        scale(_h_ylead[chn]    , xs);
        scale(_h_yseclead[chn] , xs);
        scale(_h_deltaphi[chn] , xs);
        scale(_h_deltay[chn]   , xs);
        scale(_h_deltaR[chn]   , xs);
        scale(_h_mass[chn]     , xs);
      }

    }

    //@}


  private:

    bool _isZeeSample;
    bool _isZmmSample;

    double weights_nj0[3];
    double weights_nj1[3];
    double weights_nj2[3];
    double weights_nj3[3];
    double weights_nj4[3];

    Scatter2DPtr _h_njet_ratio[3];
    Histo1DPtr _h_njet_incl[3];
    Histo1DPtr _h_ptjet[3];
    Histo1DPtr _h_ptlead[3];
    Histo1DPtr _h_ptseclead[3];
    Histo1DPtr _h_yjet[3];
    Histo1DPtr _h_ylead[3];
    Histo1DPtr _h_yseclead[3];
    Histo1DPtr _h_deltaphi[3];
    Histo1DPtr _h_deltay[3];
    Histo1DPtr _h_deltaR[3];
    Histo1DPtr _h_mass[3];

  };


  DECLARE_RIVET_PLUGIN(ATLAS_2011_I945498);


}