Belle II Software development
CRY.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/gearbox/Unit.h>
12
13#include <cry/CRYGenerator.h>
14#include <cry/CRYSetup.h>
15#include <VecGeom/volumes/UnplacedVolume.h>
16
17namespace Belle2 {
22 class MCParticleGraph;
28 class CRY final {
29 public:
30
34 CRY() = default;
35
37 ~CRY() = default;
38
42 void init();
43
47 void generateEvent(MCParticleGraph& mcGraph);
48
52 void setCosmicDataDir(const std::string& cosmicdatadir) { m_cosmicDataDir = cosmicdatadir; }
53
59 void setAcceptance(const std::vector<double>& size) { m_acceptSize = size; }
60
64 void setTimeOffset(double timeoffset) { m_timeOffset = timeoffset; }
65
69 void setKineticEnergyThreshold(double kineticenergythreshold) { m_kineticEnergyThreshold = kineticenergythreshold; }
70
74 void setDate(const std::string& date) { m_date = date; }
75
79 void setMaxTrials(int maxtrials) { m_maxTrials = maxtrials; }
80
90 void setBoxLength(double length) { m_subboxLength = length / Unit::m; }
91
96 void setReturnGammas(bool gammas) { m_returnGammas = gammas; }
97
102 void setReturnKaons(bool kaons) { m_returnKaons = kaons; }
103
108 void setReturnPions(bool pions) { m_returnPions = pions; }
109
114 void setReturnProtons(bool protons) { m_returnProtons = protons; }
115
120 void setReturnNeutrons(bool neutrons) { m_returnNeutrons = neutrons; }
121
126 void setReturnElectrons(bool electrons) { m_returnElectrons = electrons; }
127
132 void setReturnMuons(bool muons) { m_returnMuons = muons; }
133
138 void term();
139
140 protected:
141 std::string m_cosmicDataDir;
142 int m_subboxLength{100};
143 std::vector<double> m_acceptSize;
144 double m_timeOffset{0};
146 std::string m_date{"1-1-2019"};
147 int m_maxTrials{0};
149 bool m_returnGammas{true};
150 bool m_returnKaons{true};
151 bool m_returnPions{true};
152 bool m_returnProtons{true};
153 bool m_returnNeutrons{true};
154 bool m_returnElectrons{true};
155 bool m_returnMuons{true};
157 std::unique_ptr<CRYSetup> m_crySetup;
158 std::unique_ptr<CRYGenerator> m_cryGenerator;
159 std::unique_ptr<vecgeom::VUnplacedVolume> m_world;
160 std::unique_ptr<vecgeom::VUnplacedVolume> m_acceptance;
161 };
163} // end namespace Belle2
C++ Interface for the generator CRY.
Definition: CRY.h:28
void setReturnKaons(bool kaons)
Set whether or not CRY should return kaons.
Definition: CRY.h:102
void setDate(const std::string &date)
Sets the date used for generation (the cosmic-ray distribution is adjusted to account for the eleven ...
Definition: CRY.h:74
bool m_returnElectrons
Whether or not CRY should return electrons.
Definition: CRY.h:154
void setTimeOffset(double timeoffset)
Sets the time offset.
Definition: CRY.h:64
void setMaxTrials(int maxtrials)
Sets the maximum number of trials.
Definition: CRY.h:79
void setReturnProtons(bool protons)
Set whether or not CRY should return protons.
Definition: CRY.h:114
CRY()=default
Constructor.
std::string m_cosmicDataDir
directory that holds cosmic data files.
Definition: CRY.h:141
std::unique_ptr< vecgeom::VUnplacedVolume > m_acceptance
acceptance shape
Definition: CRY.h:160
bool m_returnKaons
Whether or not CRY should return kaons.
Definition: CRY.h:150
void setBoxLength(double length)
Set the size of the square nxn plane where CRY generates cosmics.
Definition: CRY.h:90
bool m_returnMuons
Whether or not CRY should return muons.
Definition: CRY.h:155
int m_subboxLength
length of the square n-n plane in Cry in meters
Definition: CRY.h:142
void setReturnGammas(bool gammas)
Set whether or not CRY should return gammas.
Definition: CRY.h:96
~CRY()=default
Destructor.
void setReturnElectrons(bool electrons)
Set whether or not CRY should return electrons.
Definition: CRY.h:126
bool m_returnGammas
Whether or not CRY should return gammas.
Definition: CRY.h:149
std::vector< double > m_acceptSize
Shape parameters for the acceptance shape.
Definition: CRY.h:143
void setCosmicDataDir(const std::string &cosmicdatadir)
Sets the directory that holds cosmic data.
Definition: CRY.h:52
std::string m_date
date used for generation (month-day-year).
Definition: CRY.h:146
std::unique_ptr< vecgeom::VUnplacedVolume > m_world
world box shape
Definition: CRY.h:159
void setReturnMuons(bool muons)
Set whether or not CRY should return muons.
Definition: CRY.h:132
void setReturnNeutrons(bool neutrons)
Set whether or not CRY should return neutrons.
Definition: CRY.h:120
double m_kineticEnergyThreshold
kinetic energy threshold.
Definition: CRY.h:145
double m_timeOffset
time offset in nanoseconds.
Definition: CRY.h:144
std::unique_ptr< CRYGenerator > m_cryGenerator
The CRY generator.
Definition: CRY.h:158
void setKineticEnergyThreshold(double kineticenergythreshold)
Sets the kinetic energy threshold, particles below that value will be ignored.
Definition: CRY.h:69
std::unique_ptr< CRYSetup > m_crySetup
The CRY generator setup.
Definition: CRY.h:157
void setReturnPions(bool pions)
Set whether or not CRY should return pions.
Definition: CRY.h:108
bool m_returnProtons
Whether or not CRY should return protons.
Definition: CRY.h:152
bool m_returnNeutrons
Whether or not CRY should return neutrons.
Definition: CRY.h:153
int m_totalTrials
total number of thrown events.
Definition: CRY.h:148
bool m_returnPions
Whether or not CRY should return pions.
Definition: CRY.h:151
void setAcceptance(const std::vector< double > &size)
Sets the size of the acceptance volume.
Definition: CRY.h:59
int m_maxTrials
number of trials per event.
Definition: CRY.h:147
Class to build, validate and sort a particle decay chain.
static const double m
[meters]
Definition: Unit.h:69
void init()
Initializes the generator.
Definition: CRY.cc:37
void generateEvent(MCParticleGraph &mcGraph)
Generates one single event.
Definition: CRY.cc:105
void term()
Terminates the generator.
Definition: CRY.cc:200
Abstract base class for different kinds of events.