StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CombineMatchingInput.h
1 // CombineMatchingInput.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2018 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
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.
13 
14 #ifndef Pythia8_CombineMatchingInput_H
15 #define Pythia8_CombineMatchingInput_H
16 
17 // Includes and namespace
18 #include "Pythia8/Pythia.h"
19 #include "Pythia8Plugins/GeneratorInput.h"
20 #include "Pythia8Plugins/JetMatching.h"
21 
22 namespace Pythia8 {
23 
24 //==========================================================================
25 
26 // JetMatchingAlpgenInputAlpgen:
27 // A small UserHooks class that gives the functionality of both AlpgenHooks
28 // and JetMatchingAlpgen. These classes have one overlapping function,
29 // 'initAfterBeams()', which is overridden here such that both are called.
30 
32  public JetMatchingAlpgen {
33 
34 public:
35 
36  // Constructor and destructor.
38  JetMatchingAlpgen() { }
40 
41  // Initialisation.
42  virtual bool initAfterBeams() {
43  if (!AlpgenHooks::initAfterBeams()) return false;
44  if (!JetMatchingAlpgen::initAfterBeams()) return false;
45  return true;
46  }
47 
48  // Process level vetos.
49  virtual bool canVetoProcessLevel() {
50  return JetMatchingAlpgen::canVetoProcessLevel();
51  }
52  virtual bool doVetoProcessLevel(Event & proc) {
53  return JetMatchingAlpgen::doVetoProcessLevel(proc);
54  }
55 
56  // Parton level vetos (before beam remnants and resonance decays).
57  virtual bool canVetoPartonLevelEarly() {
58  return JetMatchingAlpgen::canVetoPartonLevelEarly();
59  }
60  virtual bool doVetoPartonLevelEarly(const Event &proc) {
61  return JetMatchingAlpgen::doVetoPartonLevelEarly(proc);
62  }
63 
64 };
65 
66 //==========================================================================
67 
68 // JetMatchingMadgraphInputAlpgen:
69 // A small UserHooks class that gives the functionality of both AlpgenHooks
70 // and JetMatchingMadgraph. These classes have one overlapping function,
71 // 'initAfterBeams()', which is overridden here such that both are called.
72 
74  public JetMatchingMadgraph {
75 
76 public:
77 
78  // Constructor and destructor.
82 
83  // Initialisation.
84  virtual bool initAfterBeams() {
85  // Madgraph matching parameters should not be set from Alpgen file.
86  settingsPtr->flag("JetMatching:setMad",false);
87  if (!AlpgenHooks::initAfterBeams()) return false;
88  if (!JetMatchingMadgraph::initAfterBeams()) return false;
89  return true;
90  }
91 
92  // Process level vetos.
93  virtual bool canVetoProcessLevel() {
94  return JetMatchingMadgraph::canVetoProcessLevel();
95  }
96  virtual bool doVetoProcessLevel(Event& proc) {
97  return JetMatchingMadgraph::doVetoProcessLevel(proc);
98  }
99 
100  // Parton level vetos (before beam remnants and resonance decays).
101  virtual bool canVetoPartonLevelEarly() {
102  return JetMatchingMadgraph::canVetoPartonLevelEarly();
103  }
104  virtual bool doVetoPartonLevelEarly(const Event& proc) {
105  return JetMatchingMadgraph::doVetoPartonLevelEarly(proc);
106  }
107 
108 };
109 
110 //==========================================================================
111 
113 
114 public:
115 
116  // Constructor and destructor.
119 
120  // Return a hook relevant for combination of input and matching.
121  UserHooks* getHook(Pythia& pythia) {
122 
123  // Find input source and matching scheme.
124  bool isAlpgenFile = ( pythia.word("Alpgen:file") != "void" );
125  int scheme = pythia.mode("JetMatching:scheme");
126 
127  // Return relevant UserHooks.
128  if (isAlpgenFile) {
129  if (scheme == 2) return new JetMatchingAlpgenInputAlpgen(pythia);
130  if (scheme == 1) return new JetMatchingMadgraphInputAlpgen(pythia);
131  } else {
132  if (scheme == 2) return new JetMatchingAlpgen();
133  if (scheme == 1) return new JetMatchingMadgraph();
134  }
135 
136  // If fail then abort message and return VOID.
137  pythia.info.errorMsg("Abort from CombinedInputMatching::getHook: "
138  "settings unavailable");
139  return NULL;
140  }
141 
142 };
143 
144 //==========================================================================
145 
146 } // end namespace Pythia8
147 
148 #endif // Pythia8_CombineMatchingInput_H