Belle II Software  release-05-02-19
OpticalGunModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marko Staric *
7  * Stefano Lacaprara *
8  * Umberto Tamponi *
9  * *
10  * This software is provided "as is" without any warranty. *
11  **************************************************************************/
12 
13 #pragma once
14 
15 #include <framework/core/Module.h>
16 #include <string>
17 #include <TVector3.h>
18 #include <TRotation.h>
19 #include <TF1.h>
20 
21 // DataStore
22 #include <framework/datastore/StoreArray.h>
23 #include <mdst/dataobjects/MCParticle.h>
24 #include <top/dataobjects/TOPSimCalPulse.h>
25 
26 namespace Belle2 {
47  class OpticalGunModule : public Module {
48 
49  public:
50 
55 
59  virtual ~OpticalGunModule();
60 
65  virtual void initialize() override;
66 
71  virtual void beginRun() override;
72 
76  virtual void event() override;
77 
82  virtual void endRun() override;
83 
88  virtual void terminate() override;
89 
93  void printModuleParams() const;
94 
95  private:
96 
97  // steering parameters
98  double m_x = 0;
99  double m_y = 0;
100  double m_z = 0;
101  double m_diameter = 0;
102  double m_maxAlpha = 0;
103  double m_minAlpha = 0;
104  double m_na = 0;
105  double m_wavelength = 0;
106  double m_phi = 0;
107  double m_theta = 0;
108  double m_psi = 0;
109  double m_startTime = 0;
110  double m_pulseWidth = 0;
111  double m_numPhotons = 0;
112  int m_slotID = 0;
113  double m_slitDX = 0;
114  double m_slitDY = 0;
115  double m_slitX0 = 0;
116  double m_slitY0 = 0;
117  double m_slitZ = 0;
118  std::string
121  // others
122  double m_cosMinAlpha =
123  0;
124  double m_cosMaxAlpha =
125  0;
127  double m_energy = 0;
129  TVector3 m_translate;
130  TRotation m_rotate;
131  TRotation m_rotateBar;
133  TF1* m_customDistribution = 0;
135  // data store objects
145  bool isInsideSlit(const TVector3& point, const TVector3& direction) const;
146 
151  TVector3 getDirectionGaussian() const;
152 
157  TVector3 getDirectionUniform() const;
158 
163  TVector3 getDirectionLambertian() const;
164 
168  TVector3 getDirectionUniformRingAngle() const;
169 
173  TVector3 getDirectionCustom() const;
174 
175  };
176 
178 } // Belle2 namespace
179 
Belle2::OpticalGunModule::m_slotID
int m_slotID
TOP slot ID.
Definition: OpticalGunModule.h:122
Belle2::OpticalGunModule::m_y
double m_y
source position in y
Definition: OpticalGunModule.h:109
Belle2::OpticalGunModule::m_angularDistribution
std::string m_angularDistribution
emission angular distribution.
Definition: OpticalGunModule.h:129
Belle2::OpticalGunModule::m_minAlpha
double m_minAlpha
minimum emission angle
Definition: OpticalGunModule.h:113
Belle2::OpticalGunModule::m_pulseWidth
double m_pulseWidth
pulse duration (Gaussian sigma)
Definition: OpticalGunModule.h:120
Belle2::OpticalGunModule::m_slitZ
double m_slitZ
slit distance from source
Definition: OpticalGunModule.h:127
Belle2::OpticalGunModule::m_cosMinAlpha
double m_cosMinAlpha
for conveniency we calculate the cos of m_minAlpha only once, and then re-use it in several members
Definition: OpticalGunModule.h:132
Belle2::OpticalGunModule::m_wavelength
double m_wavelength
source wavelenght [nm]
Definition: OpticalGunModule.h:115
Belle2::OpticalGunModule::m_MCParticles
StoreArray< MCParticle > m_MCParticles
MC particles collection.
Definition: OpticalGunModule.h:146
Belle2::OpticalGunModule::getDirectionCustom
TVector3 getDirectionCustom() const
Return photon direction according to a a custom distribution of theta.
Definition: OpticalGunModule.cc:312
Belle2::OpticalGunModule::m_phi
double m_phi
first rotation angle (around z) [deg]
Definition: OpticalGunModule.h:116
Belle2::OpticalGunModule::m_slitDX
double m_slitDX
slit size in x
Definition: OpticalGunModule.h:123
Belle2::OpticalGunModule::event
virtual void event() override
Event processor.
Definition: OpticalGunModule.cc:174
Belle2::OpticalGunModule::terminate
virtual void terminate() override
Termination action.
Definition: OpticalGunModule.cc:253
Belle2::OpticalGunModule::m_x
double m_x
source position in x
Definition: OpticalGunModule.h:108
Belle2::OpticalGunModule::~OpticalGunModule
virtual ~OpticalGunModule()
Destructor.
Definition: OpticalGunModule.cc:90
Belle2::OpticalGunModule::m_rotateBar
TRotation m_rotateBar
rotation of a bar
Definition: OpticalGunModule.h:141
Belle2::OpticalGunModule::beginRun
virtual void beginRun() override
Called when entering a new run.
Definition: OpticalGunModule.cc:170
Belle2::OpticalGunModule::m_cosMaxAlpha
double m_cosMaxAlpha
for conveniency we calculate the cos of m_minAlpha only once, and then re-use it in several members
Definition: OpticalGunModule.h:134
Belle2::OpticalGunModule::m_diameter
double m_diameter
source diameter
Definition: OpticalGunModule.h:111
Belle2::OpticalGunModule::m_customDistribution
TF1 * m_customDistribution
Custom angular distribution, that uses m_angularDistribution as formula.
Definition: OpticalGunModule.h:143
Belle2::OpticalGunModule::m_rotate
TRotation m_rotate
rotation to Belle II frame
Definition: OpticalGunModule.h:140
Belle2::OpticalGunModule::m_simCalPulses
StoreArray< TOPSimCalPulse > m_simCalPulses
simulated cal pulse collection
Definition: OpticalGunModule.h:147
Belle2::OpticalGunModule::printModuleParams
void printModuleParams() const
Prints module parameters.
Definition: OpticalGunModule.cc:257
Belle2::OpticalGunModule::getDirectionGaussian
TVector3 getDirectionGaussian() const
Return photon direction according to a projected 2D gaussian distribution based on numerical aperture...
Definition: OpticalGunModule.cc:280
Belle2::OpticalGunModule::m_energy
double m_energy
photon energy (from wavelength)
Definition: OpticalGunModule.h:137
Belle2::OpticalGunModule::getDirectionUniform
TVector3 getDirectionUniform() const
Return photon direction according to a projected uniform distribution with opening angle alpha.
Definition: OpticalGunModule.cc:295
Belle2::OpticalGunModule::m_startTime
double m_startTime
start time
Definition: OpticalGunModule.h:119
Belle2::OpticalGunModule::m_maxAlpha
double m_maxAlpha
maximum emission angle
Definition: OpticalGunModule.h:112
Belle2::OpticalGunModule::endRun
virtual void endRun() override
End-of-run action.
Definition: OpticalGunModule.cc:249
Belle2::OpticalGunModule::getDirectionUniformRingAngle
TVector3 getDirectionUniformRingAngle() const
Return photon direction according to a uniform distribution within m_minAlpha and m_maxAlpha.
Belle2::OpticalGunModule::m_psi
double m_psi
third rotation angle (around z) [deg]
Definition: OpticalGunModule.h:118
Belle2::OpticalGunModule::m_na
double m_na
source numerical aperture.
Definition: OpticalGunModule.h:114
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::OpticalGunModule::m_theta
double m_theta
second rotation angle (around x) [deg]
Definition: OpticalGunModule.h:117
Belle2::OpticalGunModule::isInsideSlit
bool isInsideSlit(const TVector3 &point, const TVector3 &direction) const
Checks if photon flies through the slit.
Definition: OpticalGunModule.cc:261
Belle2::OpticalGunModule::m_slitY0
double m_slitY0
slit y-offset in respect to source
Definition: OpticalGunModule.h:126
Belle2::OpticalGunModule::m_z
double m_z
source position in z
Definition: OpticalGunModule.h:110
Belle2::OpticalGunModule::m_numPhotons
double m_numPhotons
average number of photons in a pulse
Definition: OpticalGunModule.h:121
Belle2::OpticalGunModule::OpticalGunModule
OpticalGunModule()
Constructor.
Definition: OpticalGunModule.cc:51
Belle2::OpticalGunModule::m_translate
TVector3 m_translate
translation to Belle II frame
Definition: OpticalGunModule.h:139
Belle2::OpticalGunModule::initialize
virtual void initialize() override
Initialize the Module.
Definition: OpticalGunModule.cc:95
Belle2::OpticalGunModule::m_slitX0
double m_slitX0
slit x-offset in respect to source
Definition: OpticalGunModule.h:125
Belle2::StoreArray< MCParticle >
Belle2::OpticalGunModule::m_slitDY
double m_slitDY
slit size in y
Definition: OpticalGunModule.h:124
Belle2::OpticalGunModule::getDirectionLambertian
TVector3 getDirectionLambertian() const
Return photon direction according to a lambertian distribution with opening angle alpha.
Definition: OpticalGunModule.cc:303