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
53{
54
55}
56
57
59{
60 StoreArray<MCParticle> mcparticle;
61 mcparticle.registerInDataStore();
62
63 //Beam Parameters, initial particle - BHWIDE cannot handle beam energy spread
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
90 m_generator.generateEvent(m_mcGraph, vertex, boost);
92}
93
94
95
97{
99
100 B2RESULT("BHWideInputModule: Total cross section: " << m_generator.getCrossSection() * 0.001 << " nb +- " <<
102 m_generator.getCrossSectionError() * 0.001 << " nb");
103}
104
106{
107 const BeamParameters& nominal = m_initial.getBeamParameters();
108 double ecm = nominal.getMass();
109
112
117
118 if (m_weakCorrections == 0) {
120 } else {
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 }
135 else B2FATAL("BHWideInputModule: Vacuum Polarization option does not exist: " << m_vacPolString);
137
139
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.
BHWide m_generator
Variables.
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).
void init()
Initializes the generator.
Definition: BHWide.cc:108
void generateEvent(MCParticleGraph &mcGraph, ROOT::Math::XYZVector vertex, ROOT::Math::LorentzRotation boost)
Generates one single event.
Definition: BHWide.cc:116
void setMaxRejectionWeight(double maxRejectionWeight)
Sets the max weight at which events are rejected.
Definition: BHWide.h:157
void enableWeakCorrections(bool weakCorrections=true)
Enable the use of weak corrections.
Definition: BHWide.h:102
void setScatAnglePositron(std::pair< double, double > angleRange)
Sets the theta scattering angle range for the scattered positron.
Definition: BHWide.h:127
@ 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
void setCMSEnergy(double cmsEnergy)
Sets the CMS energy.
Definition: BHWide.h:122
void term()
Terminates the generator.
Definition: BHWide.cc:138
void setPhotonVacPolarization(PhotonVacPolarization photonVacPol)
Set the model for the photon vacuum polarization.
Definition: BHWide.h:117
void setMinEnergyFinalStateElc(double minEnergyFinalStateElc)
Sets the minimal energy for the scattered electron.
Definition: BHWide.h:142
void setMinEnergyFinalStatePos(double minEnergyFinalStatePos)
Sets the minimal energy for the scattered positron.
Definition: BHWide.h:137
double getCrossSection()
Returns the total cross section of the generated process.
Definition: BHWide.h:205
double getCrossSectionError()
Returns the error on the total cross section of the generated process.
Definition: BHWide.h:210
void setScatAngleElectron(std::pair< double, double > angleRange)
Sets the theta scattering angle range for the scattered electron.
Definition: BHWide.h:132
void setMaxAcollinearity(double maxAcollinearity)
Sets the max acollinearity angle.
Definition: BHWide.h:147
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
const BeamParameters & getBeamParameters() const
Return reference to nominal beam parameters.
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 generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
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:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
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.
void initialize()
function to be executed on initialize()
MCInitialParticles & generate()
Generate a new event.
void clear()
Reset particles and decay information to make the class reusable.
Abstract base class for different kinds of events.
STL namespace.