IAP GITLAB

Commit 234500f5 authored by Matthieu Carrere's avatar Matthieu Carrere Committed by Ralf Ulrich

Replace vertical_EAS.cpp

parent 284271b7
...@@ -91,6 +91,10 @@ void registerRandomStreams(const int seed) { ...@@ -91,6 +91,10 @@ void registerRandomStreams(const int seed) {
template <typename T> template <typename T>
using MyExtraEnv = MediumPropertyModel<UniformMagneticField<T>>; using MyExtraEnv = MediumPropertyModel<UniformMagneticField<T>>;
// argv : 1.number of nucleons, 2.number of protons,
// 3.total energy in GeV, 4.number of showers,
// 5.seed (0 by default to generate random values for all)
int main(int argc, char** argv) { int main(int argc, char** argv) {
corsika_logger->set_pattern("[%n:%^%-8l%$] %s:%#: %v"); corsika_logger->set_pattern("[%n:%^%-8l%$] %s:%#: %v");
...@@ -108,7 +112,11 @@ int main(int argc, char** argv) { ...@@ -108,7 +112,11 @@ int main(int argc, char** argv) {
feenableexcept(FE_INVALID); feenableexcept(FE_INVALID);
int seed = 0; int seed = 0;
if (argc > 4) seed = std::stoi(std::string(argv[4])); int number_showers= std::stoi(std::string(argv[4]));
if (argc > 5){
seed = std::stoi(std::string(argv[5]));
}
// initialize random number sequence(s) // initialize random number sequence(s)
registerRandomStreams(seed); registerRandomStreams(seed);
...@@ -150,6 +158,20 @@ int main(int argc, char** argv) { ...@@ -150,6 +158,20 @@ int main(int argc, char** argv) {
fmt::ptr(env.getUniverse()->getContainingNode( fmt::ptr(env.getUniverse()->getContainingNode(
Point(rootCS, {constants::EarthRadius::Mean + 2_km, 0_m, 0_m})))); Point(rootCS, {constants::EarthRadius::Mean + 2_km, 0_m, 0_m}))));
string output_dir="example_outputs";
for(int i_shower=1;i_shower<number_showers+1;i_shower++){
// directory for outputs
string labHist_dir=output_dir+"/inthist_lab_verticalEAS_"+to_string(i_shower)+".npz";
string cMSHist_dir=output_dir+"/inthist_cms_verticalEAS_"+to_string(i_shower)+".npz";
string longprof_dir=output_dir+"/longprof_verticalEAS_"+to_string(i_shower)+".txt";
string tracks_dir=output_dir+"/tracks_"+to_string(i_shower)+".dat";
string particles_dir=output_dir+"/particles_"+to_string(i_shower)+".dat";
std::cout << std::endl;
std::cout << "Shower "<<i_shower<<"/"<<number_showers<<std::endl;
// setup particle stack, and add primary particle // setup particle stack, and add primary particle
setup::Stack stack; setup::Stack stack;
stack.clear(); stack.clear();
...@@ -261,13 +283,13 @@ int main(int argc, char** argv) { ...@@ -261,13 +283,13 @@ int main(int argc, char** argv) {
InteractionCounter emCascadeCounted(emCascade); InteractionCounter emCascadeCounted(emCascade);
OnShellCheck reset_particle_mass(1.e-3, 1.e-1, false); OnShellCheck reset_particle_mass(1.e-3, 1.e-1, false);
TrackWriter trackWriter("tracks.dat"); TrackWriter trackWriter(tracks_dir);
LongitudinalProfile longprof{showerAxis}; LongitudinalProfile longprof{showerAxis};
Plane const obsPlane(showerCore, DirectionVector(rootCS, {0., 0., 1.})); Plane const obsPlane(showerCore, DirectionVector(rootCS, {0., 0., 1.}));
ObservationPlane observationLevel(obsPlane, DirectionVector(rootCS, {1., 0., 0.}), ObservationPlane observationLevel(obsPlane, DirectionVector(rootCS, {1., 0., 0.}),
"particles.dat"); particles_dir);
corsika::urqmd::UrQMD urqmd; corsika::urqmd::UrQMD urqmd;
InteractionCounter urqmdCounted{urqmd}; InteractionCounter urqmdCounted{urqmd};
...@@ -316,7 +338,9 @@ int main(int argc, char** argv) { ...@@ -316,7 +338,9 @@ int main(int argc, char** argv) {
auto const hists = sibyllCounted.getHistogram() + sibyllNucCounted.getHistogram() + auto const hists = sibyllCounted.getHistogram() + sibyllNucCounted.getHistogram() +
urqmdCounted.getHistogram(); urqmdCounted.getHistogram();
save_hist(hists.labHist(), "inthist_lab_verticalEAS.npz", true); save_hist(hists.labHist(), labHist_dir, true);
save_hist(hists.CMSHist(), "inthist_cms_verticalEAS.npz", true); save_hist(hists.CMSHist(), cMSHist_dir, true);
longprof.save("longprof_verticalEAS.txt"); longprof.save(longprof_dir);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment