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) 2014 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.
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 "GeneratorInput.h"
20 #include "JetMatching.h"
21 using namespace Pythia8;
22 
23 //==========================================================================
24 
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.
29 
31  public JetMatchingAlpgen {
32 
33 public:
34 
35  // Constructor and destructor.
37  JetMatchingAlpgen() { }
39 
40  // Initialisation.
41  virtual bool initAfterBeams() {
42  if (!AlpgenHooks::initAfterBeams()) return false;
43  if (!JetMatchingAlpgen::initAfterBeams()) return false;
44  return true;
45  }
46 
47  // Process level vetos.
48  virtual bool canVetoProcessLevel() {
49  return JetMatchingAlpgen::canVetoProcessLevel();
50  }
51  virtual bool doVetoProcessLevel(Event & proc) {
52  return JetMatchingAlpgen::doVetoProcessLevel(proc);
53  }
54 
55  // Parton level vetos (before beam remnants and resonance decays).
56  virtual bool canVetoPartonLevelEarly() {
57  return JetMatchingAlpgen::canVetoPartonLevelEarly();
58  }
59  virtual bool doVetoPartonLevelEarly(const Event &proc) {
60  return JetMatchingAlpgen::doVetoPartonLevelEarly(proc);
61  }
62 
63 };
64 
65 //==========================================================================
66 
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.
71 
73  public JetMatchingMadgraph {
74 
75 public:
76 
77  // Constructor and destructor.
81 
82  // Initialisation.
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;
88  return true;
89  }
90 
91  // Process level vetos.
92  virtual bool canVetoProcessLevel() {
93  return JetMatchingMadgraph::canVetoProcessLevel();
94  }
95  virtual bool doVetoProcessLevel(Event& proc) {
96  return JetMatchingMadgraph::doVetoProcessLevel(proc);
97  }
98 
99  // Parton level vetos (before beam remnants and resonance decays).
100  virtual bool canVetoPartonLevelEarly() {
101  return JetMatchingMadgraph::canVetoPartonLevelEarly();
102  }
103  virtual bool doVetoPartonLevelEarly(const Event& proc) {
104  return JetMatchingMadgraph::doVetoPartonLevelEarly(proc);
105  }
106 
107 };
108 
109 //==========================================================================
110 
112 
113 public:
114 
115  // Constructor and destructor.
118 
119  // Return a hook relevant for combination of input and matching.
120  UserHooks* getHook(Pythia& pythia) {
121 
122  // Find input source and matching scheme.
123  bool isAlpgenFile = ( pythia.word("Alpgen:file") != "void" );
124  int scheme = pythia.mode("JetMatching:scheme");
125 
126  // Return relevant UserHooks.
127  if (isAlpgenFile) {
128  if (scheme == 2) return new JetMatchingAlpgenInputAlpgen(pythia);
129  if (scheme == 1) return new JetMatchingMadgraphInputAlpgen(pythia);
130  } else {
131  if (scheme == 2) return new JetMatchingAlpgen();
132  if (scheme == 1) return new JetMatchingMadgraph();
133  }
134 
135  // If fail then abort message and return VOID.
136  pythia.info.errorMsg("Abort from CombinedInputMatching::getHook: "
137  "settings unavailable");
138  return NULL;
139  }
140 
141 };
142 
143 //==========================================================================
144 
145 #endif // Pythia8_CombineMatchingInput_H