Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:56

0001 #ifndef gen_JetMatchingHook_h
0002 #define gen_JetMatchingHook_h
0003 
0004 #include "Pythia8/Pythia.h"
0005 
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 
0008 #include "SimDataFormats/GeneratorProducts/interface/LHECommonBlocks.h"
0009 
0010 #include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
0011 #include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"
0012 
0013 #include "GeneratorInterface/PartonShowerVeto/interface/JetMatching.h"
0014 
0015 // forward declaration
0016 class Py8toJetInput;
0017 
0018 class JetMatchingHook : public Pythia8::UserHooks {
0019 public:
0020   JetMatchingHook(const edm::ParameterSet&, const Pythia8::Info*);
0021   ~JetMatchingHook() override;
0022 
0023   //
0024   // Julia Yarba, Jan.8, 2013
0025   // The "Early" option will work with Pythia8.170 or higher;
0026   // for lower versions, please use just VetoPartonLevel
0027   //
0028   // virtual bool canVetoPartonLevelEarly() { return true; }
0029   // virtual bool doVetoPartonLevelEarly( const Pythia8::Event& event );
0030   bool canVetoPartonLevel() override { return true; }
0031   bool doVetoPartonLevel(const Pythia8::Event& event) override;
0032 
0033   void setEventNumber(int ievt) {
0034     fEventNumber = ievt;
0035     return;
0036   }
0037 
0038   virtual void init(lhef::LHERunInfo* runInfo);
0039   bool initAfterBeams() override {
0040     if (fIsInitialized)
0041       return true;
0042     fJetMatching->initAfterBeams();
0043     fIsInitialized = true;
0044     return true;
0045   }
0046   void resetMatchingStatus() {
0047     fJetMatching->resetMatchingStatus();
0048     return;
0049   }
0050   virtual void beforeHadronization(lhef::LHEEvent* lhee);
0051 
0052 protected:
0053   JetMatchingHook() : UserHooks() {}
0054 
0055   void setLHERunInfo(lhef::LHERunInfo* lheri) {
0056     fRunBlock = lheri;
0057     if (fRunBlock == nullptr)
0058       return;
0059     const lhef::HEPRUP* heprup = fRunBlock->getHEPRUP();
0060     lhef::CommonBlocks::fillHEPRUP(heprup);
0061     return;
0062   }
0063   void setLHEEvent(lhef::LHEEvent* lhee) {
0064     fEventBlock = lhee;
0065     if (fEventBlock == nullptr)
0066       return;
0067     const lhef::HEPEUP* hepeup = fEventBlock->getHEPEUP();
0068     lhef::CommonBlocks::fillHEPEUP(hepeup);
0069     return;
0070   }
0071 
0072   // private:
0073 
0074   lhef::LHERunInfo* fRunBlock;
0075   lhef::LHEEvent* fEventBlock;
0076   int fEventNumber;
0077 
0078   Pythia8::Info* fInfoPtr;
0079 
0080   gen::JetMatching* fJetMatching;
0081   Py8toJetInput* fJetInputFill;
0082 
0083   //void setJetAlgoInput( const Pythia8::Event& );
0084   //int getAncestor( int, const Pythia8::Event& );
0085 
0086   bool fIsInitialized;
0087 };
0088 
0089 #endif  // gen_JetMatchingHook_h