JetMatchingMGFastJet

partonTypes

vetoStatus

Macros

Line Code
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
#ifndef gen_JetMatchingMGFastJet_h
#define gen_JetMatchingMGFastJet_h

//
//  Julia V. Yarba, Feb.10, 2013
//
//  This code takes inspirations in the original implemetation
//  by Steve Mrenna of FNAL (example main32), but is structured
//  somewhat differently, and is also using FastJet package
//  instead of Pythia8's native SlowJet
//

#include "GeneratorInterface/PartonShowerVeto/interface/JetMatching.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "SimDataFormats/GeneratorProducts/interface/LHECommonBlocks.h"

#include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
#include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"

//
// FastJet package/tools
// Also gives PseudoJet & JetDefinition
//
#include "fastjet/ClusterSequence.hh"

#include <iostream>
#include <fstream>

namespace gen {
  class JetMatchingMGFastJet : public JetMatching {
  public:
    JetMatchingMGFastJet(const edm::ParameterSet &params);

    ~JetMatchingMGFastJet() override {
      if (fJetFinder)
        delete fJetFinder;
    }

    const std::vector<int> *getPartonList() override { return typeIdx; }

  protected:
    void init(const lhef::LHERunInfo *runInfo) override;

    bool initAfterBeams() override;
    void beforeHadronisation(const lhef::LHEEvent *) override;
    void beforeHadronisationExec() override { return; }

    int match(const lhef::LHEEvent *partonLevel, const std::vector<fastjet::PseudoJet> *jetInput) override;

    double getJetEtaMax() const override;

  private:
    //parameters staff from Madgraph

    template <typename T>
    static T parseParameter(const std::string &value);
    template <typename T>
    static T getParameter(const std::map<std::string, std::string> &params,
                          const std::string &var,
                          const T &defValue = T());
    template <typename T>
    T getParameter(const std::string &var, const T &defValue = T()) const;

    template <typename T>
    static void updateOrDie(const std::map<std::string, std::string> &params, T &param, const std::string &name);

    std::map<std::string, std::string> mgParams;

    // ----------------------------

    enum vetoStatus { NONE, LESS_JETS, MORE_JETS, HARD_JET, UNMATCHED_PARTON };
    enum partonTypes { ID_TOP = 6, ID_GLUON = 21, ID_PHOTON = 22 };

    double qCut, qCutSq;
    double clFact;
    int nQmatch;

    // Master switch for merging
    bool doMerge;

    // Maximum and current number of jets
    int nJetMax, nJetMin;

    // Jet algorithm parameters
    int jetAlgoPower;  //  similar to memain_.mektsc ?
    double coneRadius, etaJetMax;

    // Merging procedure control flag(s)
    // (there're also inclusive, exclusive, and soup/auto in JetMatchingMGFastJet)
    //
    bool fExcLocal;  // this is similar to memaev_.iexc

    // Sort final-state of incoming process into light/heavy jets and 'other'
    std::vector<int> typeIdx[3];

    bool runInitialized;
    bool soup;
    bool exclusive;

    //
    // FastJets tool(s)
    //
    fastjet::JetDefinition *fJetFinder;
    std::vector<fastjet::PseudoJet> fClusJets, fPtSortedJets;

    // output for DJR analysis
    //
    std::ofstream fDJROutput;
    int fDJROutFlag;

    bool fIsInit;
  };

}  // namespace gen

#endif