Belle II Software  release-06-00-14
OpticalGunModule.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 <string>
13 #include <TVector3.h>
14 #include <TRotation.h>
15 #include <TF1.h>
16 
17 // DataStore
18 #include <framework/datastore/StoreArray.h>
19 #include <mdst/dataobjects/MCParticle.h>
20 #include <top/dataobjects/TOPSimCalPulse.h>
21 
22 namespace Belle2 {
43  class OpticalGunModule : public Module {
44 
45  public:
46 
51 
55  virtual ~OpticalGunModule();
56 
61  virtual void initialize() override;
62 
67  virtual void beginRun() override;
68 
72  virtual void event() override;
73 
78  virtual void endRun() override;
79 
84  virtual void terminate() override;
85 
89  void printModuleParams() const;
90 
91  private:
92 
93  // steering parameters
94  double m_x = 0;
95  double m_y = 0;
96  double m_z = 0;
97  double m_diameter = 0;
98  double m_maxAlpha = 0;
99  double m_minAlpha = 0;
100  double m_na = 0;
101  double m_wavelength = 0;
102  double m_phi = 0;
103  double m_theta = 0;
104  double m_psi = 0;
105  double m_startTime = 0;
106  double m_pulseWidth = 0;
107  double m_numPhotons = 0;
108  int m_slotID = 0;
109  double m_slitDX = 0;
110  double m_slitDY = 0;
111  double m_slitX0 = 0;
112  double m_slitY0 = 0;
113  double m_slitZ = 0;
114  std::string
117  // others
118  double m_cosMinAlpha =
119  0;
120  double m_cosMaxAlpha =
121  0;
123  double m_energy = 0;
125  TVector3 m_translate;
126  TRotation m_rotate;
127  TRotation m_rotateBar;
131  // data store objects
141  bool isInsideSlit(const TVector3& point, const TVector3& direction) const;
142 
147  TVector3 getDirectionGaussian() const;
148 
153  TVector3 getDirectionUniform() const;
154 
159  TVector3 getDirectionLambertian() const;
160 
165 
169  TVector3 getDirectionCustom() const;
170 
171  };
172 
174 } // Belle2 namespace
175 
Base class for Modules.
Definition: Module.h:72
Source of optical photons for the simulation of the TOP laser system.
std::string m_angularDistribution
emission angular distribution.
double m_minAlpha
minimum emission angle
TRotation m_rotate
rotation to Belle II frame
TVector3 m_translate
translation to Belle II frame
TF1 * m_customDistribution
Custom angular distribution, that uses m_angularDistribution as formula.
double m_slitZ
slit distance from source
TRotation m_rotateBar
rotation of a bar
double m_cosMinAlpha
for conveniency we calculate the cos of m_minAlpha only once, and then re-use it in several members
StoreArray< TOPSimCalPulse > m_simCalPulses
simulated cal pulse collection
double m_slitDX
slit size in x
double m_wavelength
source wavelenght [nm]
double m_cosMaxAlpha
for conveniency we calculate the cos of m_minAlpha only once, and then re-use it in several members
double m_slitDY
slit size in y
double m_slitX0
slit x-offset in respect to source
double m_na
source numerical aperture.
double m_slitY0
slit y-offset in respect to source
double m_phi
first rotation angle (around z) [deg]
double m_x
source position in x
TVector3 getDirectionUniformRingAngle() const
Return photon direction according to a uniform distribution within m_minAlpha and m_maxAlpha.
double m_theta
second rotation angle (around x) [deg]
double m_startTime
start time
double m_maxAlpha
maximum emission angle
double m_energy
photon energy (from wavelength)
double m_diameter
source diameter
double m_psi
third rotation angle (around z) [deg]
double m_z
source position in z
double m_y
source position in y
double m_pulseWidth
pulse duration (Gaussian sigma)
double m_numPhotons
average number of photons in a pulse
StoreArray< MCParticle > m_MCParticles
MC particles collection.
virtual ~OpticalGunModule()
Destructor.
TVector3 getDirectionLambertian() const
Return photon direction according to a lambertian distribution with opening angle alpha.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
virtual void endRun() override
End-of-run action.
virtual void terminate() override
Termination action.
TVector3 getDirectionGaussian() const
Return photon direction according to a projected 2D gaussian distribution based on numerical aperture...
virtual void beginRun() override
Called when entering a new run.
TVector3 getDirectionUniform() const
Return photon direction according to a projected uniform distribution with opening angle alpha.
void printModuleParams() const
Prints module parameters.
TVector3 getDirectionCustom() const
Return photon direction according to a a custom distribution of theta.
bool isInsideSlit(const TVector3 &point, const TVector3 &direction) const
Checks if photon flies through the slit.
Abstract base class for different kinds of events.