Skip to content

Commit c8b72d2

Browse files
author
Brandon Gomes
authored
Merge pull request #63 from bhgomes/master
Update
2 parents 0db3f11 + a08d607 commit c8b72d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1051
-439
lines changed

CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ add_executable(simulation
4141
src/geometry/box/Scintillator.cc
4242

4343
src/geometry/Construction.cc
44+
src/geometry/Cavern.cc
4445
src/geometry/Earth.cc
4546
src/geometry/MuonMapper.cc
4647

@@ -86,5 +87,5 @@ target_include_directories(simulation PUBLIC
8687
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
8788
$<INSTALL_INTERFACE:${CMAKE_SOURCE_DIR}/include>)
8889

89-
install(DIRECTORY scripts DESTINATION bin)
90-
install(TARGETS simulation DESTINATION bin)
90+
install(DIRECTORY scripts DESTINATION bin/MATHUSLA)
91+
install(TARGETS simulation DESTINATION bin/MATHUSLA)

include/action.hh

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public:
7171
void GeneratePrimaries(G4Event* event);
7272
void SetNewValue(G4UIcommand* command, G4String value);
7373
static const Physics::Generator* GetGenerator();
74+
static Physics::ParticleVector GetLastEvent();
7475
static void SetGenerator(const std::string& generator);
7576

7677
private:

include/geometry/Box.hh

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public:
7676

7777
static G4VPhysicalVolume* Construct(G4LogicalVolume* world);
7878
static G4VPhysicalVolume* ConstructEarth(G4LogicalVolume* world);
79+
80+
static bool SaveAll;
7981
};
8082

8183
} /* namespace Box */ //////////////////////////////////////////////////////////////////////////

include/geometry/Cavern.hh

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/* include/geometry/Cavern.hh
2+
*
3+
* Copyright 2018 Brandon Gomes
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#ifndef MU__GEOMETRY_CAVERN_HH
19+
#define MU__GEOMETRY_CAVERN_HH
20+
#pragma once
21+
22+
#include "Earth.hh"
23+
24+
namespace MATHUSLA { namespace MU {
25+
26+
namespace Cavern { /////////////////////////////////////////////////////////////////////////////
27+
28+
//__Cavern Materials____________________________________________________________________________
29+
struct Material {
30+
static G4Material* Steel;
31+
static void Define();
32+
private:
33+
Material();
34+
};
35+
//----------------------------------------------------------------------------------------------
36+
37+
//__Cavern Dimensions___________________________________________________________________________
38+
constexpr auto SteelThickness = 1.85*m;
39+
constexpr auto DetectorLength = 40*m;
40+
constexpr auto DetectorRadius = 11*m;
41+
constexpr auto DetectorHeight = 11*m;
42+
constexpr auto TotalHeight = 35*m;
43+
constexpr auto BaseDepth = 92*m;
44+
constexpr auto TopDepth = BaseDepth - TotalHeight;
45+
constexpr auto CenterDepth = BaseDepth - 0.5 * TotalHeight;
46+
//----------------------------------------------------------------------------------------------
47+
48+
//__Cavern Logical Volumes______________________________________________________________________
49+
G4LogicalVolume* Volume();
50+
G4LogicalVolume* RingVolume();
51+
//----------------------------------------------------------------------------------------------
52+
53+
//__Construct Cavern and Earth__________________________________________________________________
54+
G4VPhysicalVolume* Construct(G4LogicalVolume* world);
55+
//----------------------------------------------------------------------------------------------
56+
57+
} /* namespace Cavern */ ///////////////////////////////////////////////////////////////////////
58+
59+
} } /* namespace MATHUSLA::MU */
60+
61+
#endif /* MU__GEOMETRY_CAVERN_HH */

include/geometry/Construction.hh

+15-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <Geant4/G4Transform3D.hh>
2828
#include <Geant4/G4Box.hh>
2929
#include <Geant4/G4Trap.hh>
30+
#include <Geant4/G4Tubs.hh>
3031
#include <Geant4/G4Material.hh>
3132
#include <Geant4/G4SystemOfUnits.hh>
3233

@@ -50,11 +51,16 @@ extern G4Material* Aluminum;
5051
extern G4Material* Iron;
5152
} /* namespace Material */ /////////////////////////////////////////////////////////////////////
5253

54+
//__Size of The World___________________________________________________________________________
55+
static constexpr const auto WorldLength = 1500*m;
56+
//----------------------------------------------------------------------------------------------
57+
5358
//__Geometry Builder Class______________________________________________________________________
5459
class Builder : public G4VUserDetectorConstruction, public G4UImessenger {
5560
public:
5661
Builder(const std::string& detector,
57-
const std::string& export_dir);
62+
const std::string& export_dir,
63+
const bool save_option);
5864
G4VPhysicalVolume* Construct();
5965
void ConstructSDandField();
6066

@@ -63,6 +69,7 @@ public:
6369
static const std::string MessengerDirectory;
6470

6571
static void SetDetector(const std::string& detector);
72+
static void SetSaveOption(const bool option);
6673

6774
static const std::string& GetDetectorName();
6875
static bool IsDetectorDataPerEvent();
@@ -104,6 +111,13 @@ G4Trap* Trap(const std::string& name,
104111
const double depth);
105112
//----------------------------------------------------------------------------------------------
106113

114+
//__Cylinder Builder____________________________________________________________________________
115+
G4Tubs* Cylinder(const std::string& name,
116+
const double height,
117+
const double inner_radius,
118+
const double outer_radius);
119+
//----------------------------------------------------------------------------------------------
120+
107121
//__Volume Builder______________________________________________________________________________
108122
G4LogicalVolume* Volume(const std::string& name,
109123
G4VSolid* solid,

include/geometry/Flat.hh

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ public:
112112

113113
static G4VPhysicalVolume* Construct(G4LogicalVolume* world);
114114
static G4VPhysicalVolume* ConstructEarth(G4LogicalVolume* world);
115+
116+
static bool SaveAll;
115117
};
116118

117119
} /* namespace Flat */ /////////////////////////////////////////////////////////////////////////

include/geometry/MuonMapper.hh

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public:
4646

4747
static G4VPhysicalVolume* Construct(G4LogicalVolume* world);
4848
static G4VPhysicalVolume* ConstructEarth(G4LogicalVolume* world);
49+
50+
static bool SaveAll;
4951
};
5052

5153
} /* namespace MuonMapper */ ///////////////////////////////////////////////////////////////////

include/geometry/Prototype.hh

+2
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ public:
207207

208208
static G4VPhysicalVolume* Construct(G4LogicalVolume* world);
209209
static G4VPhysicalVolume* ConstructEarth(G4LogicalVolume* world);
210+
211+
static bool SaveAll;
210212
};
211213

212214
} /* namespace Prototype */ ////////////////////////////////////////////////////////////////////

include/physics/CORSIKAReaderGenerator.hh

+6-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ struct CORSIKAEvent {
5555
double new_px,
5656
double new_py,
5757
double new_pz);
58+
void push_back(const Particle& particle);
5859
const Particle operator[](const std::size_t index) const;
5960
};
6061
//----------------------------------------------------------------------------------------------
@@ -69,6 +70,7 @@ public:
6970
CORSIKAReaderGenerator();
7071

7172
void GeneratePrimaryVertex(G4Event* event);
73+
// TODO: void GetLastEvent() const;
7274
void SetNewValue(G4UIcommand* command,
7375
G4String value);
7476
void SetFile(const std::string& path);
@@ -81,7 +83,10 @@ private:
8183
CORSIKAConfig _config;
8284
std::string _path;
8385
Command::StringArg* _read_file;
84-
// TODO: Command::StringArg* _read_directory;
86+
double _max_radius;
87+
double _time_block;
88+
Command::DoubleUnitArg* _set_max_radius;
89+
Command::DoubleUnitArg* _set_time_block;
8590
};
8691
//----------------------------------------------------------------------------------------------
8792

include/physics/Generator.hh

+5-108
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public:
8282
virtual ~Generator() = default;
8383

8484
virtual void GeneratePrimaryVertex(G4Event* event);
85+
virtual ParticleVector GetLastEvent() const;
8586
virtual void SetNewValue(G4UIcommand* command,
8687
G4String value);
8788
virtual std::ostream& Print(std::ostream& os=std::cout) const;
@@ -106,7 +107,9 @@ protected:
106107
Command::DoubleArg* _ui_eta;
107108
Command::DoubleUnitArg* _ui_phi;
108109
Command::DoubleUnitArg* _ui_ke;
109-
Command::ThreeVectorArg* _ui_p;
110+
Command::ThreeVectorUnitArg* _ui_p;
111+
Command::ThreeVectorArg* _ui_p_unit;
112+
Command::DoubleUnitArg* _ui_p_mag;
110113
Command::DoubleUnitArg* _ui_t0;
111114
Command::ThreeVectorUnitArg* _ui_vertex;
112115
};
@@ -126,6 +129,7 @@ public:
126129
virtual ~RangeGenerator() = default;
127130

128131
virtual void GeneratePrimaryVertex(G4Event* event);
132+
virtual ParticleVector GetLastEvent() const;
129133
virtual void SetNewValue(G4UIcommand* command,
130134
G4String value);
131135
virtual std::ostream& Print(std::ostream& os=std::cout) const;
@@ -150,113 +154,6 @@ protected:
150154
};
151155
//----------------------------------------------------------------------------------------------
152156

153-
154-
/*
155-
//__Default Range Particle Generator____________________________________________________________
156-
class RangeGenerator : public Generator {
157-
public:
158-
RangeGenerator(const std::string& name,
159-
const std::string& description,
160-
const int id,
161-
const double pT,
162-
const double eta,
163-
const double phi);
164-
165-
RangeGenerator(const std::string& name,
166-
const std::string& description,
167-
const int id,
168-
const double pT_min,
169-
const double pT_max,
170-
const double eta_min,
171-
const double eta_max,
172-
const double phi_min,
173-
const double phi_max);
174-
175-
RangeGenerator(const std::string& name,
176-
const std::string& description,
177-
const int id,
178-
const double pT,
179-
const double eta,
180-
const double phi,
181-
const G4ThreeVector& vertex);
182-
183-
RangeGenerator(const std::string& name,
184-
const std::string& description,
185-
const int id,
186-
const double pT_min,
187-
const double pT_max,
188-
const double eta_min,
189-
const double eta_max,
190-
const double phi_min,
191-
const double phi_max,
192-
const G4ThreeVector& vertex);
193-
194-
RangeGenerator(const std::string& name,
195-
const std::string& description,
196-
const int id,
197-
const double pT,
198-
const double eta,
199-
const double phi,
200-
const double t0,
201-
const G4ThreeVector& vertex);
202-
203-
RangeGenerator(const std::string& name,
204-
const std::string& description,
205-
const int id,
206-
const double pT_min,
207-
const double pT_max,
208-
const double eta_min,
209-
const double eta_max,
210-
const double phi_min,
211-
const double phi_max,
212-
const double t0,
213-
const G4ThreeVector& vertex);
214-
215-
virtual ~RangeGenerator() = default;
216-
217-
virtual void GeneratePrimaryVertex(G4Event* event);
218-
virtual void SetNewValue(G4UIcommand* command,
219-
G4String value);
220-
221-
double pT_min() const { return _pT_min; }
222-
double pT_max() const { return _pT_max; }
223-
double eta_min() const { return _eta_min; }
224-
double eta_max() const { return _eta_max; }
225-
double phi_min() const { return _phi_min; }
226-
double phi_max() const { return _phi_max; }
227-
double ke_min() const { return _ke_min; }
228-
double ke_max() const { return _ke_max; }
229-
230-
virtual std::ostream& Print(std::ostream& os=std::cout) const;
231-
virtual const Analysis::SimSettingList GetSpecification() const;
232-
233-
protected:
234-
double _pT_min;
235-
double _pT_max;
236-
double _eta_min;
237-
double _eta_max;
238-
double _phi_min;
239-
double _phi_max;
240-
241-
double _ke_min;
242-
double _ke_max;
243-
244-
bool _using_range_ke;
245-
246-
virtual void GenerateCommands();
247-
248-
Command::DoubleUnitArg* _ui_pT_min;
249-
Command::DoubleUnitArg* _ui_pT_max;
250-
Command::DoubleArg* _ui_eta_min;
251-
Command::DoubleArg* _ui_eta_max;
252-
Command::DoubleUnitArg* _ui_phi_min;
253-
Command::DoubleUnitArg* _ui_phi_max;
254-
Command::DoubleUnitArg* _ui_ke_min;
255-
Command::DoubleUnitArg* _ui_ke_max;
256-
};
257-
//----------------------------------------------------------------------------------------------
258-
*/
259-
260157
//__Stream Operator for Generators______________________________________________________________
261158
inline std::ostream& operator<<(std::ostream& os,
262159
const Generator& generator) {

include/physics/HepMCGenerator.hh

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ namespace MATHUSLA { namespace MU {
3030

3131
namespace Physics { ////////////////////////////////////////////////////////////////////////////
3232

33+
/*
34+
3335
class HepMCGenerator : public Generator {
3436
public:
3537
HepMCGenerator(const PropagationList& propagation,
@@ -52,6 +54,8 @@ protected:
5254
Command::StringArg* _read_file;
5355
};
5456
57+
*/
58+
5559
} /* namespace Physics */ //////////////////////////////////////////////////////////////////////
5660

5761
} } /* namespace MATHUSLA::MU */

include/physics/PythiaGenerator.hh

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public:
4646
PythiaGenerator(const std::string& path);
4747

4848
void GeneratePrimaryVertex(G4Event* event);
49+
ParticleVector GetLastEvent() const;
4950
void SetNewValue(G4UIcommand* command, G4String value);
5051
void SetPythia(Pythia8::Pythia* pythia);
5152
void SetPythia(const std::vector<std::string>& settings);
@@ -58,6 +59,7 @@ private:
5859
static G4ThreadLocal std::vector<std::string>* _pythia_settings;
5960
static G4ThreadLocal bool _settings_on;
6061
PropagationList _propagation_list;
62+
ParticleVector _last_event;
6163
std::uint_fast64_t _counter;
6264
std::string _path;
6365
Command::StringArg* _add_cut;

include/physics/Units.hh

+8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ inline void Define() {
6060
}
6161
//----------------------------------------------------------------------------------------------
6262

63+
//__Convert Unit To String______________________________________________________________________
64+
inline std::string to_string(double value,
65+
double unit,
66+
const std::string& string) {
67+
return std::to_string(value / unit) + " " + string;
68+
}
69+
//----------------------------------------------------------------------------------------------
70+
6371
} /* namespace Units */ ////////////////////////////////////////////////////////////////////////
6472

6573
} } /* namespace MATHUSLA::MU */

0 commit comments

Comments
 (0)