1 // CombineMatchingInput.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2013 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
6 // This file contains the following classes:
7 // JetMatchingAlpgenInputAlpgen: combines Alpgen-style MLM matching
8 // with Alpgen native format event input.
9 // JetMatchingMadgraphInputAlpgen: combines Madgraph-style MLM matching
10 // with Alpgen native format event input.
11 // CombineMatchingInput: invokes Alpgen- or Madgraphs-style MLM matching
12 // for Madgraph LHEF or Alpgen native format event input.
14 #ifndef Pythia8_CombineMatchingInput_H
15 #define Pythia8_CombineMatchingInput_H
17 // Includes and namespace
19 #include "GeneratorInput.h"
20 #include "JetMatching.h"
21 using namespace Pythia8;
23 //==========================================================================
25 // JetMatchingAlpgenInputAlpgen:
26 // A small UserHooks class that gives the functionality of both AlpgenHooks
27 // and JetMatchingAlpgen. These classes have one overlapping function,
28 // 'initAfterBeams()', which is overridden here such that both are called.
30 class JetMatchingAlpgenInputAlpgen : public AlpgenHooks,
31 public JetMatchingAlpgen {
35 // Constructor and destructor.
36 JetMatchingAlpgenInputAlpgen(Pythia& pythia) : AlpgenHooks(pythia),
37 JetMatchingAlpgen() { }
38 ~JetMatchingAlpgenInputAlpgen() {}
41 virtual bool initAfterBeams() {
42 if (!AlpgenHooks::initAfterBeams()) return false;
43 if (!JetMatchingAlpgen::initAfterBeams()) return false;
47 // Process level vetos.
48 virtual bool canVetoProcessLevel() {
49 return JetMatchingAlpgen::canVetoProcessLevel();
51 virtual bool doVetoProcessLevel(Event & proc) {
52 return JetMatchingAlpgen::doVetoProcessLevel(proc);
55 // Parton level vetos (before beam remnants and resonance decays).
56 virtual bool canVetoPartonLevelEarly() {
57 return JetMatchingAlpgen::canVetoPartonLevelEarly();
59 virtual bool doVetoPartonLevelEarly(const Event &proc) {
60 return JetMatchingAlpgen::doVetoPartonLevelEarly(proc);
65 //==========================================================================
67 // JetMatchingMadgraphInputAlpgen:
68 // A small UserHooks class that gives the functionality of both AlpgenHooks
69 // and JetMatchingMadgraph. These classes have one overlapping function,
70 // 'initAfterBeams()', which is overridden here such that both are called.
72 class JetMatchingMadgraphInputAlpgen : public AlpgenHooks,
73 public JetMatchingMadgraph {
77 // Constructor and destructor.
78 JetMatchingMadgraphInputAlpgen(Pythia& pythia) : AlpgenHooks(pythia),
79 JetMatchingMadgraph() {}
80 ~JetMatchingMadgraphInputAlpgen() {}
83 virtual bool initAfterBeams() {
84 // Madgraph matching parameters should not be set from Alpgen file.
85 settingsPtr->flag("JetMatching:setMad",false);
86 if (!AlpgenHooks::initAfterBeams()) return false;
87 if (!JetMatchingMadgraph::initAfterBeams()) return false;
91 // Process level vetos.
92 virtual bool canVetoProcessLevel() {
93 return JetMatchingMadgraph::canVetoProcessLevel();
95 virtual bool doVetoProcessLevel(Event& proc) {
96 return JetMatchingMadgraph::doVetoProcessLevel(proc);
99 // Parton level vetos (before beam remnants and resonance decays).
100 virtual bool canVetoPartonLevelEarly() {
101 return JetMatchingMadgraph::canVetoPartonLevelEarly();
103 virtual bool doVetoPartonLevelEarly(const Event& proc) {
104 return JetMatchingMadgraph::doVetoPartonLevelEarly(proc);
109 //==========================================================================
111 class CombineMatchingInput {
115 // Constructor and destructor.
116 CombineMatchingInput() {}
117 ~CombineMatchingInput() {}
119 // Return a hook relevant for combination of input and matching.
120 UserHooks* getHook(Pythia& pythia) {
122 // Find input source and matching scheme.
123 bool isAlpgenFile = ( pythia.word("Alpgen:file") != "void" );
124 int scheme = pythia.mode("JetMatching:scheme");
126 // Return relevant UserHooks.
128 if (scheme == 2) return new JetMatchingAlpgenInputAlpgen(pythia);
129 if (scheme == 1) return new JetMatchingMadgraphInputAlpgen(pythia);
131 if (scheme == 2) return new JetMatchingAlpgen();
132 if (scheme == 1) return new JetMatchingMadgraph();
135 // If fail then abort message and return VOID.
136 pythia.info.errorMsg("Abort from CombinedInputMatching::getHook: "
137 "settings unavailable");
143 //==========================================================================
145 #endif // Pythia8_CombineMatchingInput_H