Skip to content

Commit

Permalink
Merge pull request #63 from bhgomes/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
Brandon Gomes authored Jan 25, 2019
2 parents 0db3f11 + a08d607 commit c8b72d2
Show file tree
Hide file tree
Showing 47 changed files with 1,051 additions and 439 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ add_executable(simulation
src/geometry/box/Scintillator.cc

src/geometry/Construction.cc
src/geometry/Cavern.cc
src/geometry/Earth.cc
src/geometry/MuonMapper.cc

Expand Down Expand Up @@ -86,5 +87,5 @@ target_include_directories(simulation PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_SOURCE_DIR}/include>)

install(DIRECTORY scripts DESTINATION bin)
install(TARGETS simulation DESTINATION bin)
install(DIRECTORY scripts DESTINATION bin/MATHUSLA)
install(TARGETS simulation DESTINATION bin/MATHUSLA)
1 change: 1 addition & 0 deletions include/action.hh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public:
void GeneratePrimaries(G4Event* event);
void SetNewValue(G4UIcommand* command, G4String value);
static const Physics::Generator* GetGenerator();
static Physics::ParticleVector GetLastEvent();
static void SetGenerator(const std::string& generator);

private:
Expand Down
2 changes: 2 additions & 0 deletions include/geometry/Box.hh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public:

static G4VPhysicalVolume* Construct(G4LogicalVolume* world);
static G4VPhysicalVolume* ConstructEarth(G4LogicalVolume* world);

static bool SaveAll;
};

} /* namespace Box */ //////////////////////////////////////////////////////////////////////////
Expand Down
61 changes: 61 additions & 0 deletions include/geometry/Cavern.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* include/geometry/Cavern.hh
*
* Copyright 2018 Brandon Gomes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef MU__GEOMETRY_CAVERN_HH
#define MU__GEOMETRY_CAVERN_HH
#pragma once

#include "Earth.hh"

namespace MATHUSLA { namespace MU {

namespace Cavern { /////////////////////////////////////////////////////////////////////////////

//__Cavern Materials____________________________________________________________________________
struct Material {
static G4Material* Steel;
static void Define();
private:
Material();
};
//----------------------------------------------------------------------------------------------

//__Cavern Dimensions___________________________________________________________________________
constexpr auto SteelThickness = 1.85*m;
constexpr auto DetectorLength = 40*m;
constexpr auto DetectorRadius = 11*m;
constexpr auto DetectorHeight = 11*m;
constexpr auto TotalHeight = 35*m;
constexpr auto BaseDepth = 92*m;
constexpr auto TopDepth = BaseDepth - TotalHeight;
constexpr auto CenterDepth = BaseDepth - 0.5 * TotalHeight;
//----------------------------------------------------------------------------------------------

//__Cavern Logical Volumes______________________________________________________________________
G4LogicalVolume* Volume();
G4LogicalVolume* RingVolume();
//----------------------------------------------------------------------------------------------

//__Construct Cavern and Earth__________________________________________________________________
G4VPhysicalVolume* Construct(G4LogicalVolume* world);
//----------------------------------------------------------------------------------------------

} /* namespace Cavern */ ///////////////////////////////////////////////////////////////////////

} } /* namespace MATHUSLA::MU */

#endif /* MU__GEOMETRY_CAVERN_HH */
16 changes: 15 additions & 1 deletion include/geometry/Construction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <Geant4/G4Transform3D.hh>
#include <Geant4/G4Box.hh>
#include <Geant4/G4Trap.hh>
#include <Geant4/G4Tubs.hh>
#include <Geant4/G4Material.hh>
#include <Geant4/G4SystemOfUnits.hh>

Expand All @@ -50,11 +51,16 @@ extern G4Material* Aluminum;
extern G4Material* Iron;
} /* namespace Material */ /////////////////////////////////////////////////////////////////////

//__Size of The World___________________________________________________________________________
static constexpr const auto WorldLength = 1500*m;
//----------------------------------------------------------------------------------------------

//__Geometry Builder Class______________________________________________________________________
class Builder : public G4VUserDetectorConstruction, public G4UImessenger {
public:
Builder(const std::string& detector,
const std::string& export_dir);
const std::string& export_dir,
const bool save_option);
G4VPhysicalVolume* Construct();
void ConstructSDandField();

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

static void SetDetector(const std::string& detector);
static void SetSaveOption(const bool option);

static const std::string& GetDetectorName();
static bool IsDetectorDataPerEvent();
Expand Down Expand Up @@ -104,6 +111,13 @@ G4Trap* Trap(const std::string& name,
const double depth);
//----------------------------------------------------------------------------------------------

//__Cylinder Builder____________________________________________________________________________
G4Tubs* Cylinder(const std::string& name,
const double height,
const double inner_radius,
const double outer_radius);
//----------------------------------------------------------------------------------------------

//__Volume Builder______________________________________________________________________________
G4LogicalVolume* Volume(const std::string& name,
G4VSolid* solid,
Expand Down
2 changes: 2 additions & 0 deletions include/geometry/Flat.hh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public:

static G4VPhysicalVolume* Construct(G4LogicalVolume* world);
static G4VPhysicalVolume* ConstructEarth(G4LogicalVolume* world);

static bool SaveAll;
};

} /* namespace Flat */ /////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions include/geometry/MuonMapper.hh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public:

static G4VPhysicalVolume* Construct(G4LogicalVolume* world);
static G4VPhysicalVolume* ConstructEarth(G4LogicalVolume* world);

static bool SaveAll;
};

} /* namespace MuonMapper */ ///////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions include/geometry/Prototype.hh
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ public:

static G4VPhysicalVolume* Construct(G4LogicalVolume* world);
static G4VPhysicalVolume* ConstructEarth(G4LogicalVolume* world);

static bool SaveAll;
};

} /* namespace Prototype */ ////////////////////////////////////////////////////////////////////
Expand Down
7 changes: 6 additions & 1 deletion include/physics/CORSIKAReaderGenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct CORSIKAEvent {
double new_px,
double new_py,
double new_pz);
void push_back(const Particle& particle);
const Particle operator[](const std::size_t index) const;
};
//----------------------------------------------------------------------------------------------
Expand All @@ -69,6 +70,7 @@ public:
CORSIKAReaderGenerator();

void GeneratePrimaryVertex(G4Event* event);
// TODO: void GetLastEvent() const;
void SetNewValue(G4UIcommand* command,
G4String value);
void SetFile(const std::string& path);
Expand All @@ -81,7 +83,10 @@ private:
CORSIKAConfig _config;
std::string _path;
Command::StringArg* _read_file;
// TODO: Command::StringArg* _read_directory;
double _max_radius;
double _time_block;
Command::DoubleUnitArg* _set_max_radius;
Command::DoubleUnitArg* _set_time_block;
};
//----------------------------------------------------------------------------------------------

Expand Down
113 changes: 5 additions & 108 deletions include/physics/Generator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public:
virtual ~Generator() = default;

virtual void GeneratePrimaryVertex(G4Event* event);
virtual ParticleVector GetLastEvent() const;
virtual void SetNewValue(G4UIcommand* command,
G4String value);
virtual std::ostream& Print(std::ostream& os=std::cout) const;
Expand All @@ -106,7 +107,9 @@ protected:
Command::DoubleArg* _ui_eta;
Command::DoubleUnitArg* _ui_phi;
Command::DoubleUnitArg* _ui_ke;
Command::ThreeVectorArg* _ui_p;
Command::ThreeVectorUnitArg* _ui_p;
Command::ThreeVectorArg* _ui_p_unit;
Command::DoubleUnitArg* _ui_p_mag;
Command::DoubleUnitArg* _ui_t0;
Command::ThreeVectorUnitArg* _ui_vertex;
};
Expand All @@ -126,6 +129,7 @@ public:
virtual ~RangeGenerator() = default;

virtual void GeneratePrimaryVertex(G4Event* event);
virtual ParticleVector GetLastEvent() const;
virtual void SetNewValue(G4UIcommand* command,
G4String value);
virtual std::ostream& Print(std::ostream& os=std::cout) const;
Expand All @@ -150,113 +154,6 @@ protected:
};
//----------------------------------------------------------------------------------------------


/*
//__Default Range Particle Generator____________________________________________________________
class RangeGenerator : public Generator {
public:
RangeGenerator(const std::string& name,
const std::string& description,
const int id,
const double pT,
const double eta,
const double phi);
RangeGenerator(const std::string& name,
const std::string& description,
const int id,
const double pT_min,
const double pT_max,
const double eta_min,
const double eta_max,
const double phi_min,
const double phi_max);
RangeGenerator(const std::string& name,
const std::string& description,
const int id,
const double pT,
const double eta,
const double phi,
const G4ThreeVector& vertex);
RangeGenerator(const std::string& name,
const std::string& description,
const int id,
const double pT_min,
const double pT_max,
const double eta_min,
const double eta_max,
const double phi_min,
const double phi_max,
const G4ThreeVector& vertex);
RangeGenerator(const std::string& name,
const std::string& description,
const int id,
const double pT,
const double eta,
const double phi,
const double t0,
const G4ThreeVector& vertex);
RangeGenerator(const std::string& name,
const std::string& description,
const int id,
const double pT_min,
const double pT_max,
const double eta_min,
const double eta_max,
const double phi_min,
const double phi_max,
const double t0,
const G4ThreeVector& vertex);
virtual ~RangeGenerator() = default;
virtual void GeneratePrimaryVertex(G4Event* event);
virtual void SetNewValue(G4UIcommand* command,
G4String value);
double pT_min() const { return _pT_min; }
double pT_max() const { return _pT_max; }
double eta_min() const { return _eta_min; }
double eta_max() const { return _eta_max; }
double phi_min() const { return _phi_min; }
double phi_max() const { return _phi_max; }
double ke_min() const { return _ke_min; }
double ke_max() const { return _ke_max; }
virtual std::ostream& Print(std::ostream& os=std::cout) const;
virtual const Analysis::SimSettingList GetSpecification() const;
protected:
double _pT_min;
double _pT_max;
double _eta_min;
double _eta_max;
double _phi_min;
double _phi_max;
double _ke_min;
double _ke_max;
bool _using_range_ke;
virtual void GenerateCommands();
Command::DoubleUnitArg* _ui_pT_min;
Command::DoubleUnitArg* _ui_pT_max;
Command::DoubleArg* _ui_eta_min;
Command::DoubleArg* _ui_eta_max;
Command::DoubleUnitArg* _ui_phi_min;
Command::DoubleUnitArg* _ui_phi_max;
Command::DoubleUnitArg* _ui_ke_min;
Command::DoubleUnitArg* _ui_ke_max;
};
//----------------------------------------------------------------------------------------------
*/

//__Stream Operator for Generators______________________________________________________________
inline std::ostream& operator<<(std::ostream& os,
const Generator& generator) {
Expand Down
4 changes: 4 additions & 0 deletions include/physics/HepMCGenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ namespace MATHUSLA { namespace MU {

namespace Physics { ////////////////////////////////////////////////////////////////////////////

/*
class HepMCGenerator : public Generator {
public:
HepMCGenerator(const PropagationList& propagation,
Expand All @@ -52,6 +54,8 @@ protected:
Command::StringArg* _read_file;
};
*/

} /* namespace Physics */ //////////////////////////////////////////////////////////////////////

} } /* namespace MATHUSLA::MU */
Expand Down
2 changes: 2 additions & 0 deletions include/physics/PythiaGenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public:
PythiaGenerator(const std::string& path);

void GeneratePrimaryVertex(G4Event* event);
ParticleVector GetLastEvent() const;
void SetNewValue(G4UIcommand* command, G4String value);
void SetPythia(Pythia8::Pythia* pythia);
void SetPythia(const std::vector<std::string>& settings);
Expand All @@ -58,6 +59,7 @@ private:
static G4ThreadLocal std::vector<std::string>* _pythia_settings;
static G4ThreadLocal bool _settings_on;
PropagationList _propagation_list;
ParticleVector _last_event;
std::uint_fast64_t _counter;
std::string _path;
Command::StringArg* _add_cut;
Expand Down
8 changes: 8 additions & 0 deletions include/physics/Units.hh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ inline void Define() {
}
//----------------------------------------------------------------------------------------------

//__Convert Unit To String______________________________________________________________________
inline std::string to_string(double value,
double unit,
const std::string& string) {
return std::to_string(value / unit) + " " + string;
}
//----------------------------------------------------------------------------------------------

} /* namespace Units */ ////////////////////////////////////////////////////////////////////////

} } /* namespace MATHUSLA::MU */
Expand Down
Loading

0 comments on commit c8b72d2

Please sign in to comment.