Belle II Software development
BeamBkgGeneratorModule.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 <vector>
14#include <TFile.h>
15#include <TTree.h>
16#include <Math/RotationY.h>
17#include <generators/SAD/ReaderSAD.h>
18
19namespace Belle2 {
29
30 public:
31
36
41
46 virtual void initialize() override;
47
52 virtual void beginRun() override;
53
57 virtual void event() override;
58
63 virtual void endRun() override;
64
69 virtual void terminate() override;
70
71 private:
72
77 int generateEntry() const;
78
82 struct SADTree {
83 double s = 0;
84 double x = 0;
85 double px = 0;
86 double y = 0;
87 double py = 0;
88 double E = 0;
89 double rate = 0;
90 double ss = 0;
91 int nturn = 0;
92 double sraw = 0;
93 double ssraw = 0;
94 double xraw = 0;
95 double yraw = 0;
96 double r = 0;
97 double rr = 0;
98 double dp_over_p0 = 0;
99 double watt = 0;
100 };
101
102 std::string m_fileName;
103 std::string m_treeName;
104 std::string m_ringName;
105 double m_realTime = 0;
107 TFile* m_file = 0;
108 TTree* m_tree = 0;
110 ROOT::Math::RotationY m_rotation;
112 int m_ring = 0 ;
113 std::vector<int> m_sectionOrdering;
115 std::vector<double> m_rates;
116 int m_numEvents = 0 ;
118 std::vector<int> m_counters;
120 };
121
123} // Belle2 namespace
124
R E
internal precision of FFTW codelets
Beam background generator based on SAD files.
std::vector< int > m_counters
counters: how many times SAD particles are used
virtual void initialize() override
Initialize the Module.
virtual ~BeamBkgGeneratorModule()
Destructor.
virtual void event() override
Event processor.
virtual void endRun() override
End-of-run action.
ReaderSAD m_readerSAD
the transformation from SAD to Belle II system for the far beamline
std::vector< double > m_rates
cumulative rates of SAD particles [Hz]
virtual void terminate() override
Termination action.
ROOT::Math::RotationY m_rotation
rotation from SAD to Belle II frame
std::string m_fileName
name of the SAD file converted to root
int generateEntry() const
Pick up particle randomly from the SAD file according to its rate.
int m_ring
ring number, 1-HER, 2-LER
int m_numEvents
number of events to generate
double m_realTime
equivalent SuperKEKB running time in [ns]
virtual void beginRun() override
Called when entering a new run.
std::vector< int > m_sectionOrdering
superKEKB section ordering
std::string m_ringName
name of the superKEKB ring (LER or HER)
std::string m_treeName
name of the TTree in the SAD file
Base class for Modules.
Definition: Module.h:72
Class to read files that have been created by SAD and store their content in a MCParticle graph.
Definition: ReaderSAD.h:35
Abstract base class for different kinds of events.
Structure of the TTree in the SAD file.
int nturn
number of turns from scattered to lost
double sraw
s at lost position [m] before matching G4 beam pipe inner surface
double ss
scattered position (|s|<Ltot/2) [m]
double yraw
y at lost position [m] before matching G4 beam pipe inner surface
double rr
sqrt(xraw*xraw+yraw*yraw) [m]
double dp_over_p0
momentum deviation of the lost particle
double xraw
x at lost position [m] before matching G4 beam pipe inner surface
double s
lost position measured from IP along the ring [m]