Belle II Software development
CosmicsModule.cc
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#include <generators/modules/CosmicsModule.h>
10#include <framework/datastore/StoreArray.h>
11#include <boost/assign/std/vector.hpp>
12
13using namespace std;
14using namespace Belle2;
15using namespace boost::assign;
16
17//-----------------------------------------------------------------
18// Register the Module
19//-----------------------------------------------------------------
20REG_MODULE(Cosmics);
21
22//-----------------------------------------------------------------
23// Implementation
24//-----------------------------------------------------------------
25
27{
28 // Set module properties
29 setDescription("cosmics generator to generate cosmic ray tracks");
31 // Set default values for parameters
34 m_parameters.ipdr = 3.; // Only relevant for ipRequirement = 1
35 m_parameters.ipdz = 3.; // Only relevant for ipRequirement = 1
36 m_parameters.ptmin = 0.7;
38
39 // Parameter definition
41 "level of the generator (1 or 2 with slightly different kinematic distributions and mu+/mu- ratio), default is 1",
43 addParam("ipRequirement", m_parameters.ipRequirement,
44 "Radial and longitudinal constraints near the Interaction Point can be required (ipRequirement == 1), default is 0 (no additional IP requirements)",
47 "Constraint on the radial distance from the IP in cm, default is 3.", m_parameters.ipdr);
49 "Constraint on the longitudinal distance from the IP in cm, default is 3, default is 3.", m_parameters.ipdz);
51 "Minimal value of the transverse momentum in GeV, default is 0.7", m_parameters.ptmin);
52 addParam("cylindricalR", m_parameters.cylindricalR,
53 "Radius of tube around detector at whose surface particles are generated (in cm), default is 125, but this does not include whole Belle 2 detector!",
55}
56
58{
59 // Initialize MCParticle collection
60 StoreArray<MCParticle> mcparticle;
61 mcparticle.registerInDataStore();
62
64}
65
66
68{
69 try {
73 } catch (runtime_error& e) {
74 B2ERROR(e.what());
75 }
76}
77
SGCosmic m_cosmics
Instance of the cosmics generator.
Definition: CosmicsModule.h:55
CosmicsModule()
Constructor.
MCParticleGraph m_particleGraph
Particle graph to generate MCParticle list.
Definition: CosmicsModule.h:63
void initialize() override
Initializes the module.
void event() override
Method is called for each event.
SGCosmic::Parameters m_parameters
Instance of parameters.
Definition: CosmicsModule.h:59
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_Input
This module is an input module (reads data).
Definition: Module.h:78
bool generateEvent(MCParticleGraph &graph)
Generates the next event and store the result in the given MCParticle graph.
Definition: SGCosmic.cc:74
bool setParameters(const Parameters &parameters)
Sets the parameters for generating the Particles.
Definition: SGCosmic.cc:44
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
void clear()
Reset particles and decay information to make the class reusable.
Abstract base class for different kinds of events.
STL namespace.
int ipRequirement
Restrict the vertex to IP or not (default)
Definition: SGCosmic.h:38
double ipdr
Vertex restriction in the radial direction.
Definition: SGCosmic.h:42
double cylindricalR
Cylindrical radius of generation.
Definition: SGCosmic.h:54
double ptmin
Minimum value of the transverse momentum.
Definition: SGCosmic.h:50
int level
Generator version: level 1 (default) or 2.
Definition: SGCosmic.h:34
double ipdz
Vertex restriction in z direction.
Definition: SGCosmic.h:46