Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:48:42

0001 #ifndef GeneratorInterface_Pythia8Interface_JetMatchingEWKFxFx_h
0002 #define GeneratorInterface_Pythia8Interface_JetMatchingEWKFxFx_h
0003 
0004 // Class declaration for the new JetMatching plugin
0005 // Author: Carlos Vico (U. Oviedo)
0006 // taken from: https://amcatnlo.web.cern.ch/amcatnlo/JetMatching.h
0007 
0008 // Includes
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "FWCore/PluginManager/interface/PluginFactory.h"
0011 #include "Pythia8/Pythia.h"
0012 #include "Pythia8Plugins/JetMatching.h"
0013 #include "Pythia8Plugins/GeneratorInput.h"
0014 #include <memory>
0015 #include "GeneratorInterface/Pythia8Interface/interface/CustomHook.h"
0016 
0017 // The plugin must inherit from the original Pythia8::JetMatching
0018 // class
0019 
0020 class JetMatchingEWKFxFx : public Pythia8::JetMatching {
0021 public:
0022   // Constructor and destructor
0023   JetMatchingEWKFxFx(const edm::ParameterSet& iConfig);
0024   ~JetMatchingEWKFxFx() override {}
0025 
0026   // Method declaration
0027   bool initAfterBeams() override;
0028 
0029   bool canVetoPartonLevelEarly() override { return true; }
0030   bool doVetoPartonLevelEarly(const Pythia8::Event& event) override;
0031 
0032   bool canVetoProcessLevel() override { return true; }
0033   bool doVetoProcessLevel(Pythia8::Event& event) override;
0034 
0035   // Shower step vetoes (after the first emission, for Shower-kT scheme)
0036   int numberVetoStep() override { return 1; }
0037   bool canVetoStep() override { return doShowerKt; }
0038   bool doVetoStep(int, int, int, const Pythia8::Event&) override;
0039 
0040   Pythia8::SlowJet* slowJetDJR;
0041 
0042   Pythia8::vector<double> getDJR() { return DJR; }
0043   Pythia8::pair<int, int> nMEpartons() { return nMEpartonsSave; }
0044 
0045   Pythia8::Event getWorkEventJet() { return workEventJetSave; }
0046   Pythia8::Event getProcessSubset() { return processSubsetSave; }
0047   bool getExclusive() { return exclusive; }
0048   double getPTfirst() { return pTfirstSave; }
0049 
0050   // Different steps of the matching algorithm.
0051   void sortIncomingProcess(const Pythia8::Event&) override;
0052 
0053   void jetAlgorithmInput(const Pythia8::Event&, int) override;
0054   void runJetAlgorithm() override;
0055   bool matchPartonsToJets(int) override;
0056   int matchPartonsToJetsLight() override;
0057   int matchPartonsToJetsHeavy() override;
0058   int matchPartonsToJetsOther();
0059   bool doShowerKtVeto(double pTfirst);
0060 
0061   // Functions to clear and set the jet clustering scales.
0062   void clearDJR() { DJR.resize(0); }
0063   void setDJR(const Pythia8::Event& event);
0064   // Functions to clear and set the jet clustering scales.
0065   void clear_nMEpartons() { nMEpartonsSave.first = nMEpartonsSave.second = -1; }
0066   void set_nMEpartons(const int nOrig, const int nMatch) {
0067     clear_nMEpartons();
0068     nMEpartonsSave.first = nOrig;
0069     nMEpartonsSave.second = nMatch;
0070   };
0071 
0072   // Function to get the current number of partons in the Born state, as
0073   // read from LHE.
0074   int npNLO();
0075 
0076 private:
0077   Pythia8::Event processSubsetSave;
0078   Pythia8::Event workEventJetSave;
0079   double pTfirstSave;
0080 
0081   bool performVeto;
0082 
0083   Pythia8::vector<int> origTypeIdx[3];
0084   int nQmatch;
0085   double qCut, qCutSq, clFact;
0086   bool doFxFx;
0087   int nPartonsNow;
0088   double qCutME, qCutMESq;
0089 
0090   Pythia8::vector<double> DJR;
0091 
0092   Pythia8::pair<int, int> nMEpartonsSave;
0093 };
0094 
0095 // Register in the UserHook factory
0096 REGISTER_USERHOOK(JetMatchingEWKFxFx);
0097 #endif