Belle II Software development
BHWideInputModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <generators/modules/bhwideinput/BHWideInputModule.h>
10
11#include <framework/datastore/StoreArray.h>
12
13#include <Math/Vector3D.h>
14
15using namespace std;
16using namespace Belle2;
17
18//-----------------------------------------------------------------
19// Register the Module
20//-----------------------------------------------------------------
21REG_MODULE(BHWideInput);
22
23//-----------------------------------------------------------------
24// Implementation
25//-----------------------------------------------------------------
26
28{
29 //Set module properties
30 setDescription("Generates radiative BhaBha scattering events with BHWide.");
31
32 //Parameter definition
33 addParam("ScatteringAngleRangePositron", m_ScatteringAngleRangePositron,
34 "Min [0] and Max [1] value for the scattering angle [deg] of the positron.", make_vector(15.0, 165.0));
35 addParam("ScatteringAngleRangeElectron", m_ScatteringAngleRangeElectron,
36 "Min [0] and Max [1] value for the scattering angle [deg] of the electron.", make_vector(15.0, 165.0));
37 addParam("MaxAcollinearity", m_maxAcollinearity, "Maximum acollinearity angle between finale state leptons/photons [degree]",
38 180.0);
39 addParam("MinEnergy", m_eMin, "Minimum energy for electrons in the final state [GeV] (default: 0.2 GeV)", 0.2);
40 addParam("VacuumPolarization", m_vacPolString,
41 "Vacuum polarization: off (off - EW off, too), Burkhardt89 (bhlumi), Eidelman/Jegerlehner95 (eidelman) or Burkhardt/Pietrzyk95 (burkhardt)",
42 std::string("burkhardt"));
43 addParam("WtMax", m_wtMax, "Maximum of weight (wtmax, default: 3.0), if <0: internal maximum search", 3.);
44 addParam("WeakCorrections", m_weakCorrections, "EW correction ON/OFF", true);
45
46 //initialize member variables
48
49}
50
51
56
57
59{
60 StoreArray<MCParticle> mcparticle;
61 mcparticle.registerInDataStore();
62
63 //Beam Parameters, initial particle - BHWIDE cannot handle beam energy spread
64 m_initial.initialize();
65
66}
67
68
70{
71 // Check if the BeamParameters have changed (if they do, abort the job! otherwise cross section calculation will be a nightmare.)
72 if (m_beamParams.hasChanged()) {
73 if (!m_initialized) {
75 } else {
76 B2FATAL("BHWideInputModule::event(): BeamParameters have changed within a job, this is not supported for BHWide!");
77 }
78 }
79
80 // initial particle from beam parameters
81 const MCInitialParticles& initial = m_initial.generate();
82
83 // true boost
84 ROOT::Math::LorentzRotation boost = initial.getCMSToLab();
85
86 // vertex
87 ROOT::Math::XYZVector vertex = initial.getVertex();
88
89 m_mcGraph.clear();
90 m_generator.generateEvent(m_mcGraph, vertex, boost);
92}
93
94
95
97{
98 m_generator.term();
99
100 B2RESULT("BHWideInputModule: Total cross section: " << m_generator.getCrossSection() * 0.001 << " nb +- " <<
101 m_generator.getCrossSection() *
102 m_generator.getCrossSectionError() * 0.001 << " nb");
103}
104
106{
107 const BeamParameters& nominal = m_initial.getBeamParameters();
108 double ecm = nominal.getMass();
109
110 m_generator.setScatAnglePositron(vectorToPair(m_ScatteringAngleRangePositron, "ScatteringAngleRangePositron"));
111 m_generator.setScatAngleElectron(vectorToPair(m_ScatteringAngleRangeElectron, "ScatteringAngleRangeElectron"));
112
113 m_generator.setMinEnergyFinalStatePos(m_eMin);
114 m_generator.setMinEnergyFinalStateElc(m_eMin);
115 m_generator.setMaxAcollinearity(m_maxAcollinearity);
116 m_generator.setMaxRejectionWeight(m_wtMax);
117
118 if (m_weakCorrections == 0) {
119 m_generator.enableWeakCorrections(0);
120 } else {
121 m_generator.enableWeakCorrections(1);
122 }
123
124 //vacuum polarization (BHWide::PhotonVacPolarization)
125 if (m_vacPolString == "off") {
127 //need to switch off weak correction, otherwise BHWide will abort
128 if (m_weakCorrections == 1) {
129 B2INFO("BHWideInputModule: Switching OFF EW corrections");
130 }
131 m_generator.enableWeakCorrections(0);
135 else B2FATAL("BHWideInputModule: Vacuum Polarization option does not exist: " << m_vacPolString);
136 m_generator.setPhotonVacPolarization(m_vacPol);
137
138 m_generator.setCMSEnergy(ecm);
139
140 m_generator.init();
141
142 m_initialized = true;
143
144}
std::string m_vacPolString
Vacuum polarization as string.
double m_maxAcollinearity
maximum acollinearity angle between finale state leptons in degrees.
DBObjPtr< BeamParameters > m_beamParams
BeamParameter.
bool m_initialized
True if generator has been initialized.
std::vector< double > m_ScatteringAngleRangeElectron
Min [0] and Max [1] value for the scattering angle [deg] of the electron.
virtual void initialize() override
Initializes the module.
virtual void event() override
Method is called for each event.
virtual void terminate() override
Method is called at the end of the event processing.
std::vector< double > m_ScatteringAngleRangePositron
Module parameters.
bool m_weakCorrections
EW corrections on/off.
BHWide::PhotonVacPolarization m_vacPol
Vacuum polarization.
virtual ~BHWideInputModule()
Destructor.
MCParticleGraph m_mcGraph
The MCParticle graph object.
double m_eMin
Minimum energy for leptons in the final state, in GeV.
InitialParticleGeneration m_initial
initial particle used by BeamParameter class
void initializeGenerator()
Method is called to initialize the generator.
double m_wtMax
Maximum weight (wtmax).
@ PP_BURKHARDT
Burkhardt and Pietrzyk 1995 (Moriond).
Definition BHWide.h:65
@ PP_BHLUMI
Burkhardt et.al.
Definition BHWide.h:63
@ PP_EIDELMAN
S.
Definition BHWide.h:64
@ PP_OFF
Photon vacuum polarization is off.
Definition BHWide.h:62
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
This class contains the initial state for the given event.
const ROOT::Math::LorentzRotation & getCMSToLab() const
Return the LorentzRotation to convert from CMS to lab frame.
const ROOT::Math::XYZVector & getVertex() const
Get the position of the collision.
@ c_checkCyclic
Check for cyclic dependencies.
@ c_setDecayInfo
Set decay time and vertex.
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
Module()
Constructor.
Definition Module.cc:30
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
std::pair< T, T > vectorToPair(std::vector< T > &vec, const std::string &name="")
std::vector< T > make_vector(T const &t1, T const &t2)
make_vector.
Abstract base class for different kinds of events.
STL namespace.