Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:21

0001 #ifndef gen_JetMatchingMGFastJet_h
0002 #define gen_JetMatchingMGFastJet_h
0003 
0004 //
0005 //  Julia V. Yarba, Feb.10, 2013
0006 //
0007 //  This code takes inspirations in the original implemetation
0008 //  by Steve Mrenna of FNAL (example main32), but is structured
0009 //  somewhat differently, and is also using FastJet package
0010 //  instead of Pythia8's native SlowJet
0011 //
0012 
0013 #include "GeneratorInterface/PartonShowerVeto/interface/JetMatching.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 
0016 #include "SimDataFormats/GeneratorProducts/interface/LHECommonBlocks.h"
0017 
0018 #include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
0019 #include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"
0020 
0021 //
0022 // FastJet package/tools
0023 // Also gives PseudoJet & JetDefinition
0024 //
0025 #include "fastjet/ClusterSequence.hh"
0026 
0027 #include <iostream>
0028 #include <fstream>
0029 
0030 namespace gen {
0031   class JetMatchingMGFastJet : public JetMatching {
0032   public:
0033     JetMatchingMGFastJet(const edm::ParameterSet &params);
0034 
0035     ~JetMatchingMGFastJet() override {
0036       if (fJetFinder)
0037         delete fJetFinder;
0038     }
0039 
0040     const std::vector<int> *getPartonList() override { return typeIdx; }
0041 
0042   protected:
0043     void init(const lhef::LHERunInfo *runInfo) override;
0044 
0045     bool initAfterBeams() override;
0046     void beforeHadronisation(const lhef::LHEEvent *) override;
0047     void beforeHadronisationExec() override { return; }
0048 
0049     int match(const lhef::LHEEvent *partonLevel, const std::vector<fastjet::PseudoJet> *jetInput) override;
0050 
0051     double getJetEtaMax() const override;
0052 
0053   private:
0054     //parameters staff from Madgraph
0055 
0056     template <typename T>
0057     static T parseParameter(const std::string &value);
0058     template <typename T>
0059     static T getParameter(const std::map<std::string, std::string> &params,
0060                           const std::string &var,
0061                           const T &defValue = T());
0062     template <typename T>
0063     T getParameter(const std::string &var, const T &defValue = T()) const;
0064 
0065     template <typename T>
0066     static void updateOrDie(const std::map<std::string, std::string> &params, T &param, const std::string &name);
0067 
0068     std::map<std::string, std::string> mgParams;
0069 
0070     // ----------------------------
0071 
0072     enum vetoStatus { NONE, LESS_JETS, MORE_JETS, HARD_JET, UNMATCHED_PARTON };
0073     enum partonTypes { ID_TOP = 6, ID_GLUON = 21, ID_PHOTON = 22 };
0074 
0075     double qCut, qCutSq;
0076     double clFact;
0077     int nQmatch;
0078 
0079     // Master switch for merging
0080     bool doMerge;
0081 
0082     // Maximum and current number of jets
0083     int nJetMax, nJetMin;
0084 
0085     // Jet algorithm parameters
0086     int jetAlgoPower;  //  similar to memain_.mektsc ?
0087     double coneRadius, etaJetMax;
0088 
0089     // Merging procedure control flag(s)
0090     // (there're also inclusive, exclusive, and soup/auto in JetMatchingMGFastJet)
0091     //
0092     bool fExcLocal;  // this is similar to memaev_.iexc
0093 
0094     // Sort final-state of incoming process into light/heavy jets and 'other'
0095     std::vector<int> typeIdx[3];
0096 
0097     bool runInitialized;
0098     bool soup;
0099     bool exclusive;
0100 
0101     //
0102     // FastJets tool(s)
0103     //
0104     fastjet::JetDefinition *fJetFinder;
0105     std::vector<fastjet::PseudoJet> fClusJets, fPtSortedJets;
0106 
0107     // output for DJR analysis
0108     //
0109     std::ofstream fDJROutput;
0110     int fDJROutFlag;
0111 
0112     bool fIsInit;
0113   };
0114 
0115 }  // namespace gen
0116 
0117 #endif