9 #include <generators/modules/cryinput/CRYInputModule.h>
11 #include <framework/datastore/StoreArray.h>
12 #include <framework/gearbox/Unit.h>
13 #include <framework/utilities/FileSystem.h>
35 setDescription(R
"DOC(Generates cosmic showers with CRY.
37 The showers will be generated in the xz plane in a square plane of n bt n meters
38 centered at the IP (n can be choosen with the boxLength parameter). Then the
39 cosmics will be propagated from there to the boundary of the detector world volume.
41 Finally, if the track would intersect with the acceptance volume the track is
42 kept. The acceptance volume can be either a sphere, a cylinder or a box centered
43 at the IP. This depends on how many values are given to the acceptance parameter.
45 addParam("CosmicDataDir", m_cosmicdatadir, R
"DOC(Directory that holds the cosmic
46 data for CRY. Empty string will look in the default location)DOC", std::string(""));
47 addParam(
"acceptance", m_acceptance, R
"DOC(Size of the acceptance volume.
48 This can be either be:
50 1. one value being the radius of a sphere
51 2. two values for the radius (in xy) and the half-length (in z) of a cylinder
52 3. three values for x,y,z half-length of a box
54 All volumes are centered around the IP. All values are in cm)DOC", m_acceptance);
55 addParam("maxTrials", m_maxTrials,
"Maximum number of trials per event", m_maxTrials);
56 addParam(
"kineticEnergyThreshold", m_kineticEnergyThreshold,
57 "Energy threshold [GeV]", m_kineticEnergyThreshold);
58 addParam(
"timeOffset", m_timeOffset,
"Time offset [s]", m_timeOffset);
59 addParam(
"boxLength", m_boxLength, R
"DOC(Length of the side of the square in
60 the xz plane in which CRY will generate cosmics in cm. Will be rounded down to
61 meters. According to the CRY documentation good values are 1, 3, 10, 30, 100 and
62 300m but anything in between should work as well. The default is 100m and should
63 be fine for almost all use cases.)DOC", m_boxLength);
64 addParam("date", m_date, R
"DOC(Date used for the generation: a string in the form of
65 'month-date-year'. The cosmic-ray distribution is adjusted to account for the eleven
66 year, sunspot cycle (the default solar minimum date is January 1, 2008).)DOC", m_date);
67 addParam("returnGammas", m_returnGammas,
68 "Whether or not CRY should return gammas", m_returnGammas);
69 addParam(
"returnKaons", m_returnKaons,
70 "Whether or not CRY should return kaons", m_returnKaons);
71 addParam(
"returnPions", m_returnPions,
72 "Whether or not CRY should return pions", m_returnPions);
73 addParam(
"returnProtons", m_returnProtons,
74 "Whether or not CRY should return protons", m_returnProtons);
75 addParam(
"returnNeutrons", m_returnNeutrons,
76 "Whether or not CRY should return neutrons", m_returnNeutrons);
77 addParam(
"returnElectrons", m_returnElectrons,
78 "Whether or not CRY should return electrons", m_returnElectrons);
79 addParam(
"returnMuons", m_returnMuons,
80 "Whether or not CRY should return muons", m_returnMuons);
83 void CRYInputModule::initialize()
85 if (m_cosmicdatadir.empty()) {
86 m_cosmicdatadir = FileSystem::findFile(
"data/generators/modules/cryinput/");
89 if (m_boxLength < 100 or m_boxLength > 30000) {
90 B2FATAL(
"Box length should be between 100 and 30000 cm (1 to 300 m)");
96 m_generator.setCosmicDataDir(m_cosmicdatadir);
97 m_generator.setAcceptance(m_acceptance);
98 m_generator.setMaxTrials(m_maxTrials);
99 m_generator.setKineticEnergyThreshold(m_kineticEnergyThreshold);
100 m_generator.setTimeOffset(m_timeOffset);
101 m_generator.setBoxLength(m_boxLength);
102 m_generator.setDate(m_date);
103 m_generator.setReturnGammas(m_returnGammas);
104 m_generator.setReturnKaons(m_returnKaons);
105 m_generator.setReturnPions(m_returnPions);
106 m_generator.setReturnProtons(m_returnProtons);
107 m_generator.setReturnNeutrons(m_returnNeutrons);
108 m_generator.setReturnElectrons(m_returnElectrons);
109 m_generator.setReturnMuons(m_returnMuons);
113 void CRYInputModule::event()
116 m_generator.generateEvent(m_mcGraph);
117 m_mcGraph.generateList();
120 void CRYInputModule::terminate()
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.