Belle II Software  release-05-02-19
CRY.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Torben Ferber *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/gearbox/Unit.h>
14 
15 #include <cry/CRYGenerator.h>
16 #include <cry/CRYSetup.h>
17 #include <VecGeom/volumes/UnplacedVolume.h>
18 
19 namespace Belle2 {
24  class MCParticleGraph;
30  class CRY final {
31  public:
32 
36  CRY() = default;
37 
39  ~CRY() = default;
40 
44  void init();
45 
49  void generateEvent(MCParticleGraph& mcGraph);
50 
54  void setCosmicDataDir(const std::string& cosmicdatadir) { m_cosmicDataDir = cosmicdatadir; }
55 
61  void setAcceptance(const std::vector<double>& size) { m_acceptSize = size; }
62 
66  void setTimeOffset(double timeoffset) { m_timeOffset = timeoffset; }
67 
71  void setKineticEnergyThreshold(double kineticenergythreshold) { m_kineticEnergyThreshold = kineticenergythreshold; }
72 
76  void setDate(std::string date) { m_date = date; }
77 
81  void setMaxTrials(int maxtrials) { m_maxTrials = maxtrials; }
82 
92  void setBoxLength(double length) { m_subboxLength = length / Unit::m; }
93 
98  void setReturnGammas(bool gammas) { m_returnGammas = gammas; }
99 
104  void setReturnKaons(bool kaons) { m_returnKaons = kaons; }
105 
110  void setReturnPions(bool pions) { m_returnPions = pions; }
111 
116  void setReturnProtons(bool protons) { m_returnProtons = protons; }
117 
122  void setReturnNeutrons(bool neutrons) { m_returnNeutrons = neutrons; }
123 
128  void setReturnElectrons(bool electrons) { m_returnElectrons = electrons; }
129 
134  void setReturnMuons(bool muons) { m_returnMuons = muons; }
135 
140  void term();
141 
142  protected:
143  std::string m_cosmicDataDir;
144  int m_subboxLength{100};
145  std::vector<double> m_acceptSize;
146  double m_timeOffset{0};
147  double m_kineticEnergyThreshold{0};
148  std::string m_date{"1-1-2019"};
149  int m_maxTrials{0};
150  int m_totalTrials{0};
151  bool m_returnGammas{true};
152  bool m_returnKaons{true};
153  bool m_returnPions{true};
154  bool m_returnProtons{true};
155  bool m_returnNeutrons{true};
156  bool m_returnElectrons{true};
157  bool m_returnMuons{true};
159  std::unique_ptr<CRYSetup> m_crySetup;
160  std::unique_ptr<CRYGenerator> m_cryGenerator;
161  std::unique_ptr<vecgeom::VUnplacedVolume> m_world;
162  std::unique_ptr<vecgeom::VUnplacedVolume> m_acceptance;
163  };
165 } // end namespace Belle2
Belle2::CRY::m_returnProtons
bool m_returnProtons
Whether or not CRY should return protons.
Definition: CRY.h:162
Belle2::CRY::setBoxLength
void setBoxLength(double length)
Set the size of the square nxn plane where CRY generates cosmics.
Definition: CRY.h:100
Belle2::CRY::setReturnNeutrons
void setReturnNeutrons(bool neutrons)
Set whether or not CRY should return neutrons.
Definition: CRY.h:130
Belle2::CRY::setKineticEnergyThreshold
void setKineticEnergyThreshold(double kineticenergythreshold)
Sets the kinetic energy threshold, particles below that value will be ignored.
Definition: CRY.h:79
Belle2::CRY::setReturnElectrons
void setReturnElectrons(bool electrons)
Set whether or not CRY should return electrons.
Definition: CRY.h:136
Belle2::CRY::m_cryGenerator
std::unique_ptr< CRYGenerator > m_cryGenerator
The CRY generator.
Definition: CRY.h:168
Belle2::CRY::setDate
void setDate(std::string date)
Sets the date used for generation (the cosmic-ray distribution is adjusted to account for the eleven ...
Definition: CRY.h:84
Belle2::CRY::m_acceptance
std::unique_ptr< vecgeom::VUnplacedVolume > m_acceptance
acceptance shape
Definition: CRY.h:170
Belle2::CRY::setReturnPions
void setReturnPions(bool pions)
Set whether or not CRY should return pions.
Definition: CRY.h:118
Belle2::CRY::setReturnGammas
void setReturnGammas(bool gammas)
Set whether or not CRY should return gammas.
Definition: CRY.h:106
Belle2::CRY::setReturnMuons
void setReturnMuons(bool muons)
Set whether or not CRY should return muons.
Definition: CRY.h:142
Belle2::CRY::m_returnElectrons
bool m_returnElectrons
Whether or not CRY should return electrons.
Definition: CRY.h:164
Belle2::CRY::setAcceptance
void setAcceptance(const std::vector< double > &size)
Sets the size of the acceptance volume.
Definition: CRY.h:69
Belle2::CRY::m_timeOffset
double m_timeOffset
time offset in nanoseconds.
Definition: CRY.h:154
Belle2::CRY::m_returnKaons
bool m_returnKaons
Whether or not CRY should return kaons.
Definition: CRY.h:160
Belle2::CRY::m_date
std::string m_date
date used for generation (month-day-year).
Definition: CRY.h:156
Belle2::CRY::generateEvent
void generateEvent(MCParticleGraph &mcGraph)
Generates one single event.
Definition: CRY.cc:91
Belle2::CRY::m_cosmicDataDir
std::string m_cosmicDataDir
directory that holds cosmic data files.
Definition: CRY.h:151
Belle2::CRY::m_maxTrials
int m_maxTrials
number of trials per event.
Definition: CRY.h:157
Belle2::CRY::term
void term()
Terminates the generator.
Definition: CRY.cc:191
Belle2::CRY::setReturnKaons
void setReturnKaons(bool kaons)
Set whether or not CRY should return kaons.
Definition: CRY.h:112
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CRY::m_acceptSize
std::vector< double > m_acceptSize
Shape parameters for the acceptance shape.
Definition: CRY.h:153
Belle2::CRY::init
void init()
Initializes the generator.
Definition: CRY.cc:43
Belle2::CRY::m_world
std::unique_ptr< vecgeom::VUnplacedVolume > m_world
world box shape
Definition: CRY.h:169
Belle2::CRY::m_crySetup
std::unique_ptr< CRYSetup > m_crySetup
The CRY generator setup.
Definition: CRY.h:167
Belle2::CRY::m_totalTrials
int m_totalTrials
total number of thrown events.
Definition: CRY.h:158
Belle2::CRY::setReturnProtons
void setReturnProtons(bool protons)
Set whether or not CRY should return protons.
Definition: CRY.h:124
Belle2::CRY::~CRY
~CRY()=default
Destructor.
Belle2::Unit::m
static const double m
[meters]
Definition: Unit.h:79
Belle2::CRY::m_returnPions
bool m_returnPions
Whether or not CRY should return pions.
Definition: CRY.h:161
Belle2::CRY::m_kineticEnergyThreshold
double m_kineticEnergyThreshold
kinetic energy threshold.
Definition: CRY.h:155
Belle2::CRY::setMaxTrials
void setMaxTrials(int maxtrials)
Sets the maximum number of trials.
Definition: CRY.h:89
Belle2::CRY::m_returnMuons
bool m_returnMuons
Whether or not CRY should return muons.
Definition: CRY.h:165
Belle2::CRY::m_subboxLength
int m_subboxLength
length of the square n-n plane in Cry in meters
Definition: CRY.h:152
Belle2::CRY::m_returnNeutrons
bool m_returnNeutrons
Whether or not CRY should return neutrons.
Definition: CRY.h:163
Belle2::CRY::setTimeOffset
void setTimeOffset(double timeoffset)
Sets the time offset.
Definition: CRY.h:74
Belle2::CRY::m_returnGammas
bool m_returnGammas
Whether or not CRY should return gammas.
Definition: CRY.h:159
Belle2::CRY::CRY
CRY()=default
Constructor.
Belle2::CRY::setCosmicDataDir
void setCosmicDataDir(const std::string &cosmicdatadir)
Sets the directory that holds cosmic data.
Definition: CRY.h:62