From 1ab99a5f878f5c8c5e72304ea7b343e08a0c7ccc Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Tue, 11 Dec 2018 16:42:45 +0100
Subject: [PATCH] a few fixes

---
 Documentation/Examples/cascade_example.cc  |  9 ++++++---
 Processes/Sibyll/ProcessDecay.h            |  1 +
 Processes/StackInspector/StackInspector.cc | 11 ++++++-----
 Processes/StackInspector/StackInspector.h  |  1 +
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc
index f34f09449..e6e2fe483 100644
--- a/Documentation/Examples/cascade_example.cc
+++ b/Documentation/Examples/cascade_example.cc
@@ -125,7 +125,7 @@ public:
   }
 
   template <typename Particle, typename Stack>
-  EProcessReturn DoContinuous(Particle& p, setup::Trajectory& t, Stack& s) const {
+  EProcessReturn DoContinuous(Particle&, setup::Trajectory&, Stack&) const {
     // cout << "ProcessCut: DoContinous: " << p.GetPID() << endl;
     // cout << " is em: " << isEmParticle( p.GetPID() ) << endl;
     // cout << " is inv: " << isInvisible( p.GetPID() ) << endl;
@@ -148,7 +148,7 @@ public:
   }
 
   template <typename Particle, typename Stack>
-  void DoDiscrete(Particle& p, Stack& s) const {
+  void DoDiscrete(Particle& p, Stack&) const {
     cout << "ProcessCut: DoDiscrete: " << p.GetPID() << endl;
     const Code pid = p.GetPID();
     if (isEmParticle(pid)) {
@@ -499,7 +499,7 @@ int main() {
   ProcessSplit p1;
   corsika::process::sibyll::ProcessDecay p2;
   ProcessEMCut p3;
-  const auto sequence = p0 + p1 + p2 + p3;
+  const auto sequence = /*p0 +*/ p1 + p2 + p3;
   setup::Stack stack;
 
   corsika::cascade::Cascade EAS(tracking, sequence, stack);
@@ -513,6 +513,9 @@ int main() {
   particle.SetEnergy(E0);
   particle.SetMomentum(plab);
   particle.SetPID(Code::Proton);
+  particle.SetTime(0_ns);
+  Point p(rootCS, 0_m, 0_m, 0_m);
+  particle.SetPosition(p);
   EAS.Init();
   EAS.Run();
   cout << "Result: E0=" << E0 / 1_GeV
diff --git a/Processes/Sibyll/ProcessDecay.h b/Processes/Sibyll/ProcessDecay.h
index 31c05bff4..e828ca9ae 100644
--- a/Processes/Sibyll/ProcessDecay.h
+++ b/Processes/Sibyll/ProcessDecay.h
@@ -95,6 +95,7 @@ namespace corsika::process {
         const double gamma = E / m;
 
         TimeType t0 = GetLifetime(p.GetPID());
+	cout << "ProcessDecay: code: " << (p.GetPID()) << endl;
         cout << "ProcessDecay: MinStep: t0: " << t0 << endl;
         cout << "ProcessDecay: MinStep: gamma: " << gamma << endl;
         cout << "ProcessDecay: MinStep: density: " << density << endl;
diff --git a/Processes/StackInspector/StackInspector.cc b/Processes/StackInspector/StackInspector.cc
index b0acefc4a..949cfd025 100644
--- a/Processes/StackInspector/StackInspector.cc
+++ b/Processes/StackInspector/StackInspector.cc
@@ -26,7 +26,7 @@ using namespace corsika::process::stack_inspector;
 
 template <typename Stack>
 StackInspector<Stack>::StackInspector(const bool aReport)
-    : fReport(aReport) {}
+  : fReport(aReport), fCountStep(0) {}
 
 template <typename Stack>
 StackInspector<Stack>::~StackInspector() {}
@@ -34,7 +34,6 @@ StackInspector<Stack>::~StackInspector() {}
 template <typename Stack>
 process::EProcessReturn StackInspector<Stack>::DoContinuous(Particle&, setup::Trajectory&,
                                                             Stack& s) const {
-  static int countStep = 0;
   if (!fReport) return EProcessReturn::eOk;
   [[maybe_unused]] int i = 0;
   EnergyType Etot = 0_GeV;
@@ -49,8 +48,8 @@ process::EProcessReturn StackInspector<Stack>::DoContinuous(Particle&, setup::Tr
          << iterP.GetPID() << " E=" << setw(15) << scientific << (E / 1_GeV) << " GeV, "
          << " pos=" << pos << endl;
   }
-  countStep++;
-  cout << "StackInspector: nStep=" << countStep << " stackSize=" << s.GetSize()
+  fCountStep++;
+  cout << "StackInspector: nStep=" << fCountStep << " stackSize=" << s.GetSize()
        << " Estack=" << Etot / 1_GeV << " GeV" << endl;
   return EProcessReturn::eOk;
 }
@@ -61,7 +60,9 @@ void StackInspector<Stack>::MinStepLength(Particle&, setup::Trajectory&) const {
 }
 
 template <typename Stack>
-void StackInspector<Stack>::Init() {}
+void StackInspector<Stack>::Init() {
+  fCountStep = 0;
+}
 
 #include <corsika/setup/SetupStack.h>
 
diff --git a/Processes/StackInspector/StackInspector.h b/Processes/StackInspector/StackInspector.h
index 7b68d92d3..dddb7e4f6 100644
--- a/Processes/StackInspector/StackInspector.h
+++ b/Processes/StackInspector/StackInspector.h
@@ -40,6 +40,7 @@ namespace corsika::process {
 
     private:
       bool fReport;
+      mutable int fCountStep = 0;
     };
 
   } // namespace stack_inspector
-- 
GitLab