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 {
24
29
30 public:
31
36
41 virtual void initialize() override;
42
46 virtual void event() override;
47
52 virtual void terminate() override;
53
54 private:
55
60 int generateEntry() const;
61
65 struct SADTree {
66 double s = 0;
67 double x = 0;
68 double px = 0;
69 double y = 0;
70 double py = 0;
71 double E = 0;
72 double rate = 0;
73 double ss = 0;
74 int nturn = 0;
75 double sraw = 0;
76 double ssraw = 0;
77 double xraw = 0;
78 double yraw = 0;
79 double r = 0;
80 double rr = 0;
81 double dp_over_p0 = 0;
82 double watt = 0;
83 };
84
85 std::string m_fileName;
86 std::string m_treeName;
87 std::string m_ringName;
88 double m_realTime = 0;
89
90 TFile* m_file = 0;
91 TTree* m_tree = 0;
93 ROOT::Math::RotationY m_rotation;
95 int m_ring = 0 ;
96 std::vector<int> m_sectionOrdering;
97
98 std::vector<double> m_rates;
99 int m_numEvents = 0 ;
101 std::vector<int> m_counters;
102
103 };
104
106} // Belle2 namespace
107
std::vector< int > m_counters
counters: how many times SAD particles are used
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
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]
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
Module()
Constructor.
Definition Module.cc:30
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 E
E at lost position [GeV] (in fact momentum magnitude!)
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]