Belle II Software  release-08-01-10
BabayagaNLOInputModule.h
1 
2 /**************************************************************************
3  * basf2 (Belle II Analysis Software Framework) *
4  * Author: The Belle II Collaboration *
5  * *
6  * See git log for contributors and copyright holders. *
7  * This file is licensed under LGPL-3.0, see LICENSE.md. *
8  **************************************************************************/
9 
10 #pragma once
11 
12 #include <framework/logging/Logger.h>
13 
14 #include <generators/modules/GeneratorBaseModule.h>
15 #include <generators/babayaganlo/BabayagaNLO.h>
16 #include <generators/utilities/InitialParticleGeneration.h>
17 
18 #include <mdst/dataobjects/MCParticleGraph.h>
19 
20 #include <vector>
21 #include <TFile.h>
22 #include <TH1D.h>
23 
24 
25 namespace Belle2 {
39 
40  public:
41 
46  BabayagaNLOInputModule();//: Module(), m_initial(BeamParameters::c_smearALL) {}
47 
49  virtual ~BabayagaNLOInputModule();
50 
52  virtual void generatorInitialize() override;
53 
55  virtual void generatorEvent() override;
56 
58  virtual void terminate() override;
59 
61  static double generateCMSEnergy()
62  {
63  return s_initial.generate().getMass();
64  }
65 
66  protected:
67 
68  double getBeamEnergyCM(double e1, double e2, double angle);
71  std::string m_order;
72  std::string m_model;
73  std::string m_mode;
74  std::string m_vacPol;
75  std::string m_finalState;
76  double m_eMinFrac;
77  double m_eMin;
78  double m_epsilon;
80  double m_fMax;
82  int m_nPhot;
83  std::vector<double> m_ScatteringAngleRange;
84  std::string m_fileNameExtraInfo;
85  double m_Spread;
87  std::string m_NSKDataFile;
89  std::string m_userMode;
90  double m_eemin;
91  double m_temin;
92  double m_egmin;
93  double m_tgmin;
94  double m_eeveto;
95  double m_teveto;
96  double m_egveto;
97  double m_tgveto;
98  double m_maxprescale;
104  TH1D* m_th1dSDif;
106  template <typename T>
107  std::vector<T> make_vector(T const& t1, T const& t2);
109  template <typename T>
110  std::pair<T, T> vectorToPair(std::vector<T>& vec, const std::string& name = "");
111 
112  private:
114  void initializeGenerator();
115 
116  bool m_initialized{false};
121  };
122 
123 
124  template <typename T>
125  inline std::vector<T> BabayagaNLOInputModule::make_vector(T const& t1, T const& t2)
126  {
127  std::vector<T> v;
128  v.push_back(t1);
129  v.push_back(t2);
130  return v;
131  }
132 
133  template <typename T>
134  inline std::pair<T, T> BabayagaNLOInputModule::vectorToPair(std::vector<T>& vec, const std::string& name)
135  {
136  std::pair<T, T> p;
137  if (vec.size() != 2) {
138  B2ERROR("The parameter " + name + " has to have exactly 2 elements !");
139  } else {
140  p.first = vec[0];
141  p.second = vec[1];
142  }
143  return p;
144  }
145 
147 } // end namespace Belle2
The Babayaga.NLO Generator module.
double m_eeveto
Minimum CMS energy to veto e-/e+ (GeV).
std::string m_NSKDataFile
data file for the NSK VP data.
double m_tgveto
Maximum CMS angle between the gamma and -z axis (deg).
static InitialParticleGeneration s_initial
Initial particle for beam parameters, static because we need to call it from FORTRAN here.
double m_maxAcollinearity
maximum acollinearity angle between finale state leptons in degrees.
double m_maxprescale
Maximum prescale value.
DBObjPtr< BeamParameters > m_beamParams
BeamParameter.
bool m_initialized
True if generator has been initialized.
double m_Spread
TEMPORARY SOLUTION! Approximate energy spread per beam (CMS).
std::string m_order
Module parameters.
double m_tgmin
Minimum CMS angle between the gamma and -z axis (deg).
double m_epsilon
Soft/hard photon separator in units of CMS/2.
double m_teveto
Maximum CMS theta of e-/e+ in final state (deg).
virtual void terminate() override
Method is called at the end of the event processing.
double m_temin
Minimum CMS angle between the tagged e-/e+ and -z axis (deg).
std::string m_fileNameExtraInfo
Extra ROOT file that contains the weight distribution to check overweight bias.
std::string m_userMode
User mode similar to TEEGG: ETRON, EGAMMA, GAMMA or PRESCALE or NONE.
int m_nSearchMax
Events used to search maximum of differential cross section.
virtual ~BabayagaNLOInputModule()
Destructor.
int m_nPhot
fixed number of nphot (hard) photons are generated.
virtual void generatorInitialize() override
Initializes the module.
bool m_Uncertainty
vary all VP related parameters and extracted total uncertainty.
std::string m_vacPol
Vacuum polarization: off, hadr5 or hmnt.
double getBeamEnergyCM(double e1, double e2, double angle)
Get the CM energy from LER, HER and the crossing angle.
double m_egmin
Minimum CMS energy of the gamma (GeV).
double m_eMinFrac
Fractional energy (of cms energy) for leptons in the final state.
static double generateCMSEnergy()
Static method to get a random CMS energy (used via extern C from fortran).
double m_eemin
Minimum CMS energy of the tagged e-/e+ (GeV).
std::string m_finalState
Final state: ee, mm or gg.
MCParticleGraph m_mcGraph
The MCParticle graph object.
double m_egveto
Minimum CMS energy to veto gamma (GeV).
double m_eMin
Minimum energy for leptons in the final state, in GeV.
std::vector< double > m_ScatteringAngleRange
Min [0] and Max [1] value for the scat.
void initializeGenerator()
Method is called to initialize the generator.
std::string m_model
model: matched or ps.
std::string m_mode
mode: weighted or unweighted.
virtual void generatorEvent() override
Method is called for each event.
TH1D * m_th1dSDif
Histograms with the event weights.
double m_fMax
Maximum differential cross section weight.
C++ Interface for the Fortran Bhabha and exclusive two photon generator BABAYAGA.NLO.
Definition: BabayagaNLO.h:27
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
The base module for generator modules, which sets the generator information as EventExtraInfo.
double getMass() const
Get the invariant mass of the collision (= energy in CMS)
Class to build, validate and sort a particle decay chain.
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.
MCInitialParticles & generate()
Generate a new event.
Abstract base class for different kinds of events.