IAP GITLAB

Skip to content
Snippets Groups Projects
Commit c177275b authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

"no-op" boundary crossing process

parent ceaadbd8
No related branches found
No related tags found
2 merge requests!91Resolve "define further classes of processes (MaintenanceProcess?)",!76Resolve "Handling of boundary crossings in geometry tree"
Pipeline #336 failed
...@@ -214,6 +214,18 @@ public: ...@@ -214,6 +214,18 @@ public:
HEPEnergyType GetEmEnergy() const { return fEmEnergy; } HEPEnergyType GetEmEnergy() const { return fEmEnergy; }
}; };
struct MyBoundaryCrossingProcess
: public BoundaryCrossingProcess<MyBoundaryCrossingProcess> {
template <typename Particle>
EProcessReturn DoBoundaryCrossing(Particle&, environment::BaseNodeType const& from,
environment::BaseNodeType const& to) {
std::cout << "boundary crossing! from:" << &from << "; to: " << &to << std::endl;
return EProcessReturn::eOk;
}
void Init() {}
};
// //
// The example main program for a particle cascade // The example main program for a particle cascade
// //
...@@ -226,21 +238,33 @@ int main() { ...@@ -226,21 +238,33 @@ int main() {
environment::Environment env; environment::Environment env;
auto& universe = *(env.GetUniverse()); auto& universe = *(env.GetUniverse());
auto theMedium = environment::Environment::CreateNode<Sphere>( auto outerMedium = environment::Environment::CreateNode<Sphere>(
Point{env.GetCoordinateSystem(), 0_m, 0_m, 0_m}, Point{env.GetCoordinateSystem(), 0_m, 0_m, 0_m},
1_km * std::numeric_limits<double>::infinity()); 1_km * std::numeric_limits<double>::infinity());
// fraction of oxygen // fraction of oxygen
const float fox = 0.20946; const float fox = 0.20946;
using MyHomogeneousModel = environment::HomogeneousMedium<environment::IMediumModel>; using MyHomogeneousModel = environment::HomogeneousMedium<environment::IMediumModel>;
theMedium->SetModelProperties<MyHomogeneousModel>( outerMedium->SetModelProperties<MyHomogeneousModel>(
1_kg / (1_m * 1_m * 1_m), 1_kg / (1_m * 1_m * 1_m),
environment::NuclearComposition( environment::NuclearComposition(
std::vector<particles::Code>{particles::Code::Nitrogen, std::vector<particles::Code>{particles::Code::Nitrogen,
particles::Code::Oxygen}, particles::Code::Oxygen},
std::vector<float>{(float)1. - fox, fox})); std::vector<float>{(float)1. - fox, fox}));
universe.AddChild(std::move(theMedium)); auto innerMedium = environment::Environment::CreateNode<Sphere>(
Point{env.GetCoordinateSystem(), 0_m, 0_m, 0_m}, 10_m);
innerMedium->SetModelProperties<MyHomogeneousModel>(
1_kg / (1_m * 1_m * 1_m),
environment::NuclearComposition(
std::vector<particles::Code>{particles::Code::Nitrogen,
particles::Code::Oxygen},
std::vector<float>{(float)1. - fox, fox}));
outerMedium->AddChild(std::move(innerMedium));
universe.AddChild(std::move(outerMedium));
const CoordinateSystem& rootCS = env.GetCoordinateSystem(); const CoordinateSystem& rootCS = env.GetCoordinateSystem();
...@@ -254,15 +278,15 @@ int main() { ...@@ -254,15 +278,15 @@ int main() {
process::sibyll::Decay decay; process::sibyll::Decay decay;
ProcessCut cut(20_GeV); ProcessCut cut(20_GeV);
// random::RNGManager::GetInstance().RegisterRandomStream("HadronicElasticModel"); random::RNGManager::GetInstance().RegisterRandomStream("HadronicElasticModel");
// process::HadronicElasticModel::HadronicElasticInteraction process::HadronicElasticModel::HadronicElasticInteraction hadronicElastic(env);
// hadronicElastic(env);
process::TrackWriter::TrackWriter trackWriter("tracks.dat"); process::TrackWriter::TrackWriter trackWriter("tracks.dat");
// assemble all processes into an ordered process list // assemble all processes into an ordered process list
// auto sequence = p0 << sibyll << decay << hadronicElastic << cut << trackWriter; // auto sequence = p0 << sibyll << decay << hadronicElastic << cut << trackWriter;
auto sequence = p0 << sibyll << sibyllNuc << decay << cut << trackWriter; auto sequence = p0 << sibyll << sibyllNuc << decay << cut << MyBoundaryCrossingProcess()
<< trackWriter;
// setup particle stack, and add primary particle // setup particle stack, and add primary particle
setup::Stack stack; setup::Stack stack;
...@@ -272,10 +296,8 @@ int main() { ...@@ -272,10 +296,8 @@ int main() {
const int nuclZ = int(nuclA / 2.15 + 0.7); const int nuclZ = int(nuclA / 2.15 + 0.7);
const HEPMassType mass = particles::Proton::GetMass() * nuclZ + const HEPMassType mass = particles::Proton::GetMass() * nuclZ +
(nuclA - nuclZ) * particles::Neutron::GetMass(); (nuclA - nuclZ) * particles::Neutron::GetMass();
const HEPEnergyType E0 = const HEPEnergyType E0 = nuclA * 100_GeV;
nuclA * double theta = 27.234;
100_GeV; // 1_PeV crashes with bad COMboost in second interaction (crash later)
double theta = 0.;
double phi = 0.; double phi = 0.;
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment