File: SubProcessHandler.cc

package info (click to toggle)
thepeg 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 9,312 kB
  • ctags: 11,509
  • sloc: cpp: 57,129; sh: 11,315; java: 3,212; lisp: 1,402; makefile: 830; ansic: 58; perl: 3
file content (186 lines) | stat: -rw-r--r-- 6,843 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// -*- C++ -*-
//
// SubProcessHandler.cc is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SubProcessHandler class.
//

#include "SubProcessHandler.h"
#include "ThePEG/PDF/PartonExtractor.h"
#include "ThePEG/Handlers/Hint.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Handlers/CascadeHandler.h"
#include "ThePEG/Handlers/MultipleInteractionHandler.h"
#include "ThePEG/Handlers/HadronizationHandler.h"
#include "ThePEG/Handlers/DecayHandler.h"
#include "ThePEG/Cuts/Cuts.h"
#include "ThePEG/Interface/RefVector.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/EventRecord/Particle.h"
#include "ThePEG/MatrixElement/MEBase.h"
#include "ThePEG/MatrixElement/ReweightBase.h"

using namespace ThePEG;

SubProcessHandler::~SubProcessHandler() {}

SubProcessHandler::SubProcessHandler() {
  setupGroups();
}

SubProcessHandler::SubProcessHandler(const SubProcessHandler & sph)
  : HandlerBase(sph),
    thePartonExtractor(sph.thePartonExtractor), theMEs(sph.theMEs),
    theCuts(sph.theCuts), theSubprocessGroup(sph.theSubprocessGroup),
    theCascadeGroup(sph.theCascadeGroup), theMultiGroup(sph.theMultiGroup),
    theHadronizationGroup(sph.theHadronizationGroup),
    theDecayGroup(sph.theDecayGroup),
    reweights(sph.reweights), preweights(sph.preweights) {
  setupGroups();
}

void SubProcessHandler::setupGroups() {
  theGroups.clear();
  theGroups.push_back(&theSubprocessGroup);
  theGroups.push_back(&theCascadeGroup);
  theGroups.push_back(&theMultiGroup);
  theGroups.push_back(&theHadronizationGroup);
  theGroups.push_back(&theDecayGroup);
}

IBPtr SubProcessHandler::clone() const {
  return new_ptr(*this);
}

IBPtr SubProcessHandler::fullclone() const {
  return new_ptr(*this);
}

const HandlerGroupBase &
SubProcessHandler::handlerGroup(Group::Handler group) const {
  return *(theGroups[group]);
}

tCascHdlPtr SubProcessHandler::CKKWHandler() const {
  return dynamic_ptr_cast<tCascHdlPtr>(theCascadeGroup.defaultHandler());
}

void SubProcessHandler::persistentOutput(PersistentOStream & os) const {
  os << thePartonExtractor << theCuts << theSubprocessGroup << theCascadeGroup
     << theMultiGroup << theHadronizationGroup << theDecayGroup
     << theMEs << reweights << preweights;
}

void SubProcessHandler::persistentInput(PersistentIStream & is, int) {
  is >> thePartonExtractor >> theCuts >> theSubprocessGroup >> theCascadeGroup
     >> theMultiGroup >> theHadronizationGroup >> theDecayGroup
     >> theMEs >> reweights >> preweights;
}

void SubProcessHandler::doinit() {
  for ( MEVector::iterator me = theMEs.begin(); me != theMEs.end(); ++me ) {
    (**me).init();
    for ( ReweightVector::iterator i = reweights.begin();
	  i != reweights.end(); ++i ) (**me).addReweighter(*i);
    for ( ReweightVector::iterator i = preweights.begin();
	  i != preweights.end(); ++i ) (**me).addPreweighter(*i);
  }
  HandlerBase::doinit();
}

void SubProcessHandler::doinitrun() {
  HandlerBase::doinitrun();
  pExtractor()->initrun();
  for ( MEVector::iterator me = theMEs.begin(); me != theMEs.end(); ++me )
    (**me).initrun();
  for ( ReweightVector::iterator i = reweights.begin();
	i != reweights.end(); ++i ) (**i).initrun();
  for ( ReweightVector::iterator i = preweights.begin();
	i != preweights.end(); ++i ) (**i).initrun();
}

ClassDescription<SubProcessHandler> SubProcessHandler::initSubProcessHandler;

void SubProcessHandler::Init() {

  static ClassDocumentation<SubProcessHandler> documentation
    ("This object contains information about a set of possible sub-processes "
     "to be generated from inside ThePEG. It must contain a "
     "<interface>PartonExtractor</interface> do describe how the partons "
     "entering into the hard sub-process are extracted from the beam "
     "particles. It must also include at least one matrix element object "
     "in <interface>MatrixElements</interface> and a "
     "<interface>Cuts</interface> object describing the kinematical cuts "
     "imposed on the sub-process generation.");

  static Reference<SubProcessHandler,PartonExtractor> interfacePartonExtractor
    ("PartonExtractor",
     "The PartonExtractor object to describe the way partons are extracted "
     "from the incoming particles.",
     &SubProcessHandler::thePartonExtractor, false, false, true, false);

  static RefVector<SubProcessHandler,MEBase> interfaceMEs
    ("MatrixElements",
     "A list of MEBase objects describing the \\f$2\\rightarrow n\\f$ hard "
     "matrix elements.",
     &SubProcessHandler::theMEs, 0, false, false, true, false);

  static Reference<SubProcessHandler,Cuts> interfaceCuts
    ("Cuts",
     "Common kinematical cuts for this SubProcessHandler. These cuts "
     "overides those in a EventHandler.",
     &SubProcessHandler::theCuts, false, false, true, true);

  static RefVector<SubProcessHandler,ReweightBase> interfaceReweights
    ("Reweights",
     "A list of ThePEG::ReweightBase objects to modify all matrix elements "
     "in this SubProcessHandler.",
     &SubProcessHandler::reweights, 0, false, false, true, false);

  static RefVector<SubProcessHandler,ReweightBase> interfacePreweights
    ("Preweights",
     "A list of ThePEG::ReweightBase objects to bias the phase space for all "
     "matrix elements without in this SubProcessHandler influencing the "
     "actual cross section.",
     &SubProcessHandler::preweights, 0, false, false, true, false);

  ThePEG_DECLARE_PREPOST_OBJECTS(SubProcessHandler, SubProcessHandler,
				  Post, after);

  ThePEG_DECLARE_GROUPINTERFACE_OBJECTS(SubProcessHandler, CascadeHandler);
  ThePEG_DECLARE_GROUPINTERFACE_OBJECTS(SubProcessHandler,
					 MultipleInteractionHandler);
  ThePEG_DECLARE_GROUPINTERFACE_OBJECTS(SubProcessHandler,
					 HadronizationHandler);
  ThePEG_DECLARE_GROUPINTERFACE_OBJECTS(SubProcessHandler, DecayHandler);

  interfacePartonExtractor.rank(10);
  interfaceMEs.rank(9);
  interfaceCuts.rank(8);

}


ThePEG_IMPLEMENT_PREPOST_GROUP(SubProcessHandler,SubProcessHandler,
				theSubprocessGroup,Post)\

ThePEG_IMPLEMENT_GROUPINTERFACE(SubProcessHandler,CascadeHandler,
				 theCascadeGroup,CascHdlPtr) \

ThePEG_IMPLEMENT_GROUPINTERFACE(SubProcessHandler,MultipleInteractionHandler,
				 theMultiGroup,MIHdlPtr)  \

ThePEG_IMPLEMENT_GROUPINTERFACE(SubProcessHandler,HadronizationHandler,
				 theHadronizationGroup,HadrHdlPtr) \

ThePEG_IMPLEMENT_GROUPINTERFACE(SubProcessHandler,DecayHandler,
				 theDecayGroup,DecayHdlPtr) \