Belle II Software  release-08-01-10
BHWideInputModule.h
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 #pragma once
10 
11 #include <framework/core/Module.h>
12 #include <framework/logging/Logger.h>
13 
14 #include <generators/bhwide/BHWide.h>
15 
16 #include <mdst/dataobjects/MCParticleGraph.h>
17 
18 #include <generators/utilities/InitialParticleGeneration.h>
19 
20 #include <vector>
21 
22 namespace Belle2 {
32  class BHWideInputModule : public Module {
33 
34  public:
35 
41 
43  virtual ~BHWideInputModule();
44 
46  virtual void initialize() override;
47 
49  virtual void event() override;
50 
52  virtual void terminate() override;
53 
54  protected:
55 
56  double getBeamEnergyCM(double e1, double e2, double angle);
59  std::vector<double>
61  std::vector<double>
65  std::string m_vacPolString;
67  double m_eMin;
69  double m_wtMax;
75  template <typename T>
76  std::vector<T> make_vector(T const& t1, T const& t2);
78  template <typename T>
79  std::pair<T, T> vectorToPair(std::vector<T>& vec, const std::string& name = "");
80 
81  private:
82 
84  void initializeGenerator();
85 
86  bool m_initialized{false};
91  };
93  template <typename T>
94  inline std::vector<T> BHWideInputModule::make_vector(T const& t1, T const& t2)
95  {
96  std::vector<T> v;
97  v.push_back(t1);
98  v.push_back(t2);
99  return v;
100  }
101 
102  template <typename T>
103  inline std::pair<T, T> BHWideInputModule::vectorToPair(std::vector<T>& vec, const std::string& name)
104  {
105  std::pair<T, T> p;
106  if (vec.size() != 2) {
107  B2ERROR("The parameter " + name + " has to have exactly 2 elements !");
108  } else {
109  p.first = vec[0];
110  p.second = vec[1];
111  }
112  return p;
113  }
114 
116 } // end namespace Belle2
The BHWide Generator module.vectorToPair.
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.
double getBeamEnergyCM(double e1, double e2, double angle)
Get CM beam energy from LER, HER and crossing angle.
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).
C++ Interface for the Fortran Bhabha scattering generator BHWide.
Definition: BHWide.h:32
PhotonVacPolarization
Call photon polarization.
Definition: BHWide.h:61
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Class to build, validate and sort a particle decay chain.
Base class for Modules.
Definition: Module.h:72
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.