cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
TauolaFilter.cpp
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2019-2022 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#include <Tauola/Log.h>
20
#include <Tauola/Tauola.h>
21
#include <Tauola/TauolaEvent.h>
22
#include <Tauola/TauolaHepMC3Event.h>
23
24
#include "
CepGen/Core/Exception.h
"
25
#include "
CepGen/Core/ParametersList.h
"
26
#include "
CepGen/Event/Event.h
"
27
#include "
CepGen/EventFilter/EventModifier.h
"
28
#include "
CepGen/Modules/EventModifierFactory.h
"
29
#include "
CepGen/Physics/PDG.h
"
30
#include "
CepGen/Utils/String.h
"
31
#include "
CepGenAddOns/HepMC3Wrapper/HepMC3EventInterface.h
"
32
33
using namespace
Tauolapp;
34
35
namespace
cepgen
{
36
namespace
hadr {
38
class
TauolaFilter
:
public
EventModifier
{
39
public
:
40
explicit
TauolaFilter
(
const
ParametersList
&);
41
~TauolaFilter
();
42
43
void
initialise
()
override
;
44
bool
run
(
Event
& ev,
double
& weight,
bool
fast)
override
;
45
46
static
ParametersDescription
description
();
47
48
private
:
49
const
ParametersList
pol_states_, rad_states_;
50
};
51
52
TauolaFilter::TauolaFilter
(
const
ParametersList
& params)
53
:
EventModifier
(params),
54
pol_states_(steer<
ParametersList
>(
"polarisations"
)),
55
rad_states_(steer<
ParametersList
>(
"radiations"
)) {
56
if
(steer<bool>(
"debug"
))
57
Log::LogAll(
true
);
58
}
59
60
TauolaFilter::~TauolaFilter
() { Log::SummaryAtExit(); }
61
62
void
TauolaFilter::initialise
() {
63
Tauola::setUnits(Tauola::GEV, Tauola::MM);
64
Tauola::initialize();
65
Tauola::setSeed(
seed_
, 2. *
seed_
, 4. *
seed_
);
66
Tauola::momentum_conservation_threshold = 1.e-6;
67
if
(!Tauola::getIsTauolaIni())
68
throw
CG_FATAL
(
"TauolaFilter:init"
) <<
"Tauola was not properly initialised!"
;
69
70
//--- spin correlations
71
if
(pol_states_.
has
<
bool
>(
"full"
))
72
Tauola::spin_correlation.setAll(pol_states_.
get
<
bool
>(
"full"
));
73
pol_states_.
fill
<
bool
>(
"GAMMA"
, Tauola::spin_correlation.GAMMA);
74
pol_states_.
fill
<
bool
>(
"Z0"
, Tauola::spin_correlation.Z0);
75
pol_states_.
fill
<
bool
>(
"HIGGS"
, Tauola::spin_correlation.HIGGS);
76
pol_states_.
fill
<
bool
>(
"HIGGS_H"
, Tauola::spin_correlation.HIGGS_H);
77
pol_states_.
fill
<
bool
>(
"HIGGS_A"
, Tauola::spin_correlation.HIGGS_A);
78
pol_states_.
fill
<
bool
>(
"HIGGS_PLUS"
, Tauola::spin_correlation.HIGGS_PLUS);
79
pol_states_.
fill
<
bool
>(
"HIGGS_MINUS"
, Tauola::spin_correlation.HIGGS_MINUS);
80
pol_states_.
fill
<
bool
>(
"W_PLUS"
, Tauola::spin_correlation.W_PLUS);
81
pol_states_.
fill
<
bool
>(
"W_MINUS"
, Tauola::spin_correlation.W_MINUS);
82
83
//--- radiation states
84
if
(rad_states_.
has
<
bool
>(
"enable"
))
85
Tauola::setRadiation(rad_states_.
get
<
bool
>(
"enable"
));
86
const
auto
rad_cutoff = rad_states_.
get
<
double
>(
"cutoff"
, 0.01);
87
if
(rad_cutoff > 0.)
88
Tauola::setRadiationCutOff(rad_cutoff);
// default energy is 0.01 (in units of half the decaying particle mass)
89
90
//--- default parameters
91
Tauola::setSameParticleDecayMode(steer<int>(
"sameParticleDecayMode"
));
92
Tauola::setOppositeParticleDecayMode(steer<int>(
"oppositeParticleDecayMode"
));
93
94
//--- list of tau decay branching fractions
95
for
(
const
auto
& br_per_mode : steer<std::vector<ParametersList> >(
"branchingRatios"
)) {
96
const
auto
mode = br_per_mode.get<
int
>(
"mode"
);
97
const
auto
br = br_per_mode.get<
double
>(
"branchingRatio"
);
98
Tauola::setTauBr(mode, br);
99
CG_DEBUG
(
"TauolaFilter:init"
) <<
"Branching ratio for mode "
<< mode <<
" set to "
<< br <<
"."
;
100
}
101
}
102
103
bool
TauolaFilter::run
(
Event
& ev,
double
& weight,
bool
/*fast*/
) {
104
weight = 1.;
105
106
HepMC3::CepGenEvent
hepmc_evt(ev);
107
TauolaHepMC3Event evt(&hepmc_evt);
108
evt.decayTaus();
109
//hepmc_evt.dump();
110
hepmc_evt.
merge
(ev);
111
112
return
true
;
113
}
114
115
ParametersDescription
TauolaFilter::description
() {
116
auto
desc =
EventModifier::description
();
117
desc.setDescription(
"Tauola interface"
);
118
desc.add<
bool
>(
"debug"
,
false
).setDescription(
"debugging mode"
);
119
120
auto
pol_desc =
ParametersDescription
();
121
pol_desc.add<
bool
>(
"full"
,
true
);
122
pol_desc.add<
bool
>(
"GAMMA"
, Tauola::spin_correlation.GAMMA);
123
pol_desc.add<
bool
>(
"Z0"
, Tauola::spin_correlation.Z0);
124
pol_desc.add<
bool
>(
"HIGGS"
, Tauola::spin_correlation.HIGGS);
125
pol_desc.add<
bool
>(
"HIGGS_H"
, Tauola::spin_correlation.HIGGS_H);
126
pol_desc.add<
bool
>(
"HIGGS_A"
, Tauola::spin_correlation.HIGGS_A);
127
pol_desc.add<
bool
>(
"HIGGS_PLUS"
, Tauola::spin_correlation.HIGGS_PLUS);
128
pol_desc.add<
bool
>(
"HIGGS_MINUS"
, Tauola::spin_correlation.HIGGS_MINUS);
129
pol_desc.add<
bool
>(
"W_PLUS"
, Tauola::spin_correlation.W_PLUS);
130
pol_desc.add<
bool
>(
"W_MINUS"
, Tauola::spin_correlation.W_MINUS);
131
desc.add<
ParametersDescription
>(
"polarisations"
, pol_desc);
132
133
auto
rad_desc =
ParametersDescription
();
134
rad_desc.
add
<
bool
>(
"enable"
,
false
);
135
rad_desc.
add
<
double
>(
"cutoff"
, -1.);
136
desc.
add
<
ParametersDescription
>(
"radiations"
, rad_desc);
137
138
desc.
add
<
int
>(
"sameParticleDecayMode"
, -1);
139
desc.
add
<
int
>(
"oppositeParticleDecayMode"
, -1);
140
141
auto
br_desc =
ParametersDescription
();
142
br_desc.add<
int
>(
"mode"
, -1).setDescription(
"decay mode"
);
143
br_desc.add<
double
>(
"branchingRatio"
, 0.).setDescription(
"branching fraction"
);
144
desc.addParametersDescriptionVector(
"branchingRatios"
, br_desc, {});
145
return
desc;
146
}
147
}
// namespace hadr
148
}
// namespace cepgen
149
150
// register event modifier
151
typedef
cepgen::hadr::TauolaFilter
TauolaFilter
;
152
REGISTER_MODIFIER
(
"tauola"
,
TauolaFilter
);
EventModifierFactory.h
REGISTER_MODIFIER
#define REGISTER_MODIFIER(name, obj)
Add a generic event modification module definition to the factory.
Definition
EventModifierFactory.h:25
EventModifier.h
Event.h
Exception.h
CG_FATAL
#define CG_FATAL(mod)
Definition
Exception.h:61
HepMC3EventInterface.h
CG_DEBUG
#define CG_DEBUG(mod)
Definition
Message.h:220
PDG.h
ParametersList.h
String.h
TauolaFilter
cepgen::hadr::TauolaFilter TauolaFilter
Definition
TauolaFilter.cpp:151
HepMC3::CepGenEvent
Interfacing between CepGen and HepMC event definitions.
Definition
HepMC3EventInterface.h:35
HepMC3::CepGenEvent::merge
void merge(cepgen::Event &) const
Merge this event with another CepGen event record.
Definition
HepMC3EventInterface.cpp:198
cepgen::EventModifier
Class template to interface (external/internal) events modification algorithms.
Definition
EventModifier.h:29
cepgen::EventModifier::description
static ParametersDescription description()
Definition
EventModifier.cpp:42
cepgen::EventModifier::seed_
long long seed_
Random numbers generator seed fed to the algorithm.
Definition
EventModifier.h:51
cepgen::Event
Container for the information on the in- and outgoing particles' kinematics.
Definition
Event.h:28
cepgen::ParametersDescription
A description object for parameters collection.
Definition
ParametersDescription.h:26
cepgen::ParametersDescription::add
ParametersDescription & add(const std::string &name, const T &def)
Add the description to a new parameter.
Definition
ParametersDescription.h:59
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::ParametersList::has
bool has(const std::string &key) const
Check if a given parameter is handled in this list.
Definition
ParametersList.cpp:386
cepgen::ParametersList::get
T get(const std::string &key, const T &def=default_arg< T >::get()) const
Get a parameter value.
Definition
ParametersList.cpp:391
cepgen::ParametersList::fill
const ParametersList & fill(const std::string &key, T &value) const
Fill a variable with the key content if exists.
Definition
ParametersList.h:92
cepgen::hadr::TauolaFilter
Interface to the Tauola decay routine.
Definition
TauolaFilter.cpp:38
cepgen::hadr::TauolaFilter::TauolaFilter
TauolaFilter(const ParametersList &)
Definition
TauolaFilter.cpp:52
cepgen::hadr::TauolaFilter::~TauolaFilter
~TauolaFilter()
Definition
TauolaFilter.cpp:60
cepgen::hadr::TauolaFilter::run
bool run(Event &ev, double &weight, bool fast) override
Modify an event.
Definition
TauolaFilter.cpp:103
cepgen::hadr::TauolaFilter::description
static ParametersDescription description()
Definition
TauolaFilter.cpp:115
cepgen::hadr::TauolaFilter::initialise
void initialise() override
Definition
TauolaFilter.cpp:62
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
CepGenAddOns
PhotosTauolaWrapper
TauolaFilter.cpp
Generated on Mon Jul 29 2024 for CepGen by
1.9.7