From b083bce7d0005f58eeab5fc769bff14eadecca24 Mon Sep 17 00:00:00 2001
From: rulrich <ralf.m.ulrich@kit.edu>
Date: Wed, 15 Jul 2020 07:42:18 +0200
Subject: [PATCH] format and conex-target

---
 Data                                   |   2 +-
 Documentation/Examples/vertical_EAS.cc |  10 +-
 Processes/QGSJetII/testQGSJetII.cc     |  20 ++--
 Processes/UrQMD/UrQMD.h                | 134 ++++++++++++-------------
 ThirdParty/CMakeLists.txt              |  29 +++---
 5 files changed, 96 insertions(+), 99 deletions(-)

diff --git a/Data b/Data
index 7c276813d..54b995350 160000
--- a/Data
+++ b/Data
@@ -1 +1 @@
-Subproject commit 7c276813de7b4f7635eb024b3806936a4bc9c770
+Subproject commit 54b995350fafa9fcaf0c2a09501940ddb428053f
diff --git a/Documentation/Examples/vertical_EAS.cc b/Documentation/Examples/vertical_EAS.cc
index 6c7e19d62..f96362add 100644
--- a/Documentation/Examples/vertical_EAS.cc
+++ b/Documentation/Examples/vertical_EAS.cc
@@ -18,10 +18,10 @@
 #include <corsika/geometry/Sphere.h>
 #include <corsika/process/ProcessSequence.h>
 #include <corsika/process/StackProcess.h>
+#include <corsika/process/conex_source_cut/CONEXSourceCut.h>
 #include <corsika/process/energy_loss/EnergyLoss.h>
 #include <corsika/process/interaction_counter/InteractionCounter.h>
 #include <corsika/process/longitudinal_profile/LongitudinalProfile.h>
-#include <corsika/process/conex_source_cut/CONEXSourceCut.h>
 #include <corsika/process/observation_plane/ObservationPlane.h>
 #include <corsika/process/on_shell_check/OnShellCheck.h>
 #include <corsika/process/particle_cut/ParticleCut.h>
@@ -193,13 +193,13 @@ int main(int argc, char** argv) {
   Plane const obsPlane(showerCore, Vector<dimensionless_d>(rootCS, {0., 0., 1.}));
   process::observation_plane::ObservationPlane observationLevel(obsPlane,
                                                                 "particles.dat");
-  
+
   process::UrQMD::UrQMD urqmd;
   process::interaction_counter::InteractionCounter urqmdCounted{urqmd};
-  
+
   sibyllNuc.Init();
   sibyll.Init();
-                                                                
+
   process::conex_source_cut::CONEXSourceCut conexSource(
       center, showerAxis, t, injectionHeight, E0,
       particles::GetPDG(particles::Code::Proton));
@@ -211,7 +211,7 @@ int main(int argc, char** argv) {
                                                        55_GeV);
   auto decaySequence = decayPythia << decaySibyll;
 
-  auto sequence = switchProcess << reset_particle_mass << decaySequence << longprof
+	  auto sequence = switchProcess << reset_particle_mass << decaySequence << conexSource << longprof
                                 << eLoss << cut << observationLevel;
 
   // define air shower object, run simulation
diff --git a/Processes/QGSJetII/testQGSJetII.cc b/Processes/QGSJetII/testQGSJetII.cc
index ef22b9dd3..a7652d8d6 100644
--- a/Processes/QGSJetII/testQGSJetII.cc
+++ b/Processes/QGSJetII/testQGSJetII.cc
@@ -42,7 +42,6 @@ auto sumMomentum(TStackView const& view, geometry::CoordinateSystem const& vCS)
   return sum;
 }
 
-
 TEST_CASE("QgsjetII", "[processes]") {
 
   SECTION("QgsjetII -> Corsika") {
@@ -130,10 +129,9 @@ TEST_CASE("QgsjetIIInterface", "[processes]") {
         sqrt(E0 * E0 - particles::Proton::GetMass() * particles::Proton::GetMass());
     auto plab = corsika::stack::MomentumVector(cs, {0_GeV, 0_GeV, -P0});
     geometry::Point pos(cs, 0_m, 0_m, 0_m);
-    auto particle =
-        stack.AddParticle(std::tuple<particles::Code, units::si::HEPEnergyType,
-                                     corsika::stack::MomentumVector, geometry::Point,
-                                     units::si::TimeType>{
+    auto particle = stack.AddParticle(
+        std::tuple<particles::Code, units::si::HEPEnergyType,
+                   corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{
             particles::Code::Proton, E0, plab, pos, 0_ns});
 
     particle.SetNode(nodePtr);
@@ -146,14 +144,12 @@ TEST_CASE("QgsjetIIInterface", "[processes]") {
     [[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(projectile);
     [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle);
 
-    REQUIRE( length/(1_g / square(1_cm)) == Approx(93.47).margin(0.1) );
-    REQUIRE( view.GetSize() == 13 );
+    REQUIRE(length / (1_g / square(1_cm)) == Approx(93.47).margin(0.1));
+    REQUIRE(view.GetSize() == 13);
     /*REQUIRE( sumCharge(view) ==
       1 + particles::GetChargeNumber(particles::Code::Oxygen) );*/
-    auto const secMomSum =
-      sumMomentum(view, projectileMomentum.GetCoordinateSystem());
-    REQUIRE( (secMomSum - projectileMomentum).norm() / projectileMomentum.norm() ==
-	     Approx(0).margin(1e-2));
-
+    auto const secMomSum = sumMomentum(view, projectileMomentum.GetCoordinateSystem());
+    REQUIRE((secMomSum - projectileMomentum).norm() / projectileMomentum.norm() ==
+            Approx(0).margin(1e-2));
   }
 }
diff --git a/Processes/UrQMD/UrQMD.h b/Processes/UrQMD/UrQMD.h
index ef1f0909d..ac24beb6f 100644
--- a/Processes/UrQMD/UrQMD.h
+++ b/Processes/UrQMD/UrQMD.h
@@ -77,74 +77,74 @@ namespace corsika::process::UrQMD {
   using nmaxDoubleArray = nmaxArray<double>;
 
   extern "C" {
-    // FORTRAN functions defined in UrQMD
-    void iniurqmdc8_();
-    double ranf_(int&);
-    void cascinit_(int const&, int const&, int const&);
-    double nucrad_(int const&);
-    void urqmd_(int&);
-    int pdgid_(int const&, int const&);
-    double sigtot_(int&, int&, double&);
-    int collclass_(int&, int&, int&, int&);
-    double crossx_(int const&, double const&, int const&, int const&, double const&,
-		   int const&, int const&, double const&, double&);
-    int readsigmaln_(int const&, int const&, int const&);
-    
-    // defined in coms.f
-    extern struct {
-      int npart, nbar, nmes, ctag, nsteps, uid_cnt, ranseed, event;
-      int Ap; // projectile mass number (in case of nucleus)
-      int At; // target mass number (in case of nucleus)
-      int Zp; // projectile charge number (in case of nucleus)
-      int Zt; // target charge number (in case of nucleus)
-      int eos, dectag, NHardRes, NSoftRes, NDecRes, NElColl, NBlColl;
-    } sys_;
-    
-    extern struct {
-      double time, acttime, bdist, bimp, bmin;
-      double ebeam; // lab-frame energy of projectile
-      double ecm;
-    } rsys_;
-    
-    // defined in coms.f
-    extern struct {
-      nmaxIntArray spin, ncoll, charge, ityp, lstcoll, iso3, origin, strid, uid;
-    } isys_;
-    
-    // defined in coor.f
-    extern struct {
-      nmaxDoubleArray r0, rx, ry, rz, p0, px, py, pz, fmass, rww, dectime;
-    } coor_;
-    
-    // defined in inputs.f
-    extern struct {
-      int nevents;
-      std::array<int, 2> spityp; // particle codes of: [0]: projectile, [1]: target
-      int prspflg;               // projectile special flag
-      int trspflg; // target special flag, set to 1 unless target is nucleus > H
-      std::array<int, 2> spiso3; // particle codes of: [0]: projectile, [1]: target
-      int outsteps, bflag, srtflag, efuncflag, nsrt, npb, firstev;
-    } inputs_;
-    
-    // defined in inputs.f
-    extern struct {
-      double srtmin, srtmax, pbeam, betann, betatar, betapro, pbmin, pbmax;
-    } input2_;
-    
-    // defined in options.f
-    extern struct {
-      std::array<double, details::constants::numcto> CTOption;
-      std::array<double, details::constants::numctp> CTParam;
-    } options_;
-    
-    extern struct {
-      int fixedseed, bf13, bf14, bf15, bf16, bf17, bf18, bf19, bf20;
-    } loptions_;
-    
-    // defined in urqmdInterface.F
-    extern struct { std::array<double, 3> xs, bim; } cxs_u2_;
+  // FORTRAN functions defined in UrQMD
+  void iniurqmdc8_();
+  double ranf_(int&);
+  void cascinit_(int const&, int const&, int const&);
+  double nucrad_(int const&);
+  void urqmd_(int&);
+  int pdgid_(int const&, int const&);
+  double sigtot_(int&, int&, double&);
+  int collclass_(int&, int&, int&, int&);
+  double crossx_(int const&, double const&, int const&, int const&, double const&,
+                 int const&, int const&, double const&, double&);
+  int readsigmaln_(int const&, int const&, int const&);
+
+  // defined in coms.f
+  extern struct {
+    int npart, nbar, nmes, ctag, nsteps, uid_cnt, ranseed, event;
+    int Ap; // projectile mass number (in case of nucleus)
+    int At; // target mass number (in case of nucleus)
+    int Zp; // projectile charge number (in case of nucleus)
+    int Zt; // target charge number (in case of nucleus)
+    int eos, dectag, NHardRes, NSoftRes, NDecRes, NElColl, NBlColl;
+  } sys_;
+
+  extern struct {
+    double time, acttime, bdist, bimp, bmin;
+    double ebeam; // lab-frame energy of projectile
+    double ecm;
+  } rsys_;
+
+  // defined in coms.f
+  extern struct {
+    nmaxIntArray spin, ncoll, charge, ityp, lstcoll, iso3, origin, strid, uid;
+  } isys_;
+
+  // defined in coor.f
+  extern struct {
+    nmaxDoubleArray r0, rx, ry, rz, p0, px, py, pz, fmass, rww, dectime;
+  } coor_;
+
+  // defined in inputs.f
+  extern struct {
+    int nevents;
+    std::array<int, 2> spityp; // particle codes of: [0]: projectile, [1]: target
+    int prspflg;               // projectile special flag
+    int trspflg; // target special flag, set to 1 unless target is nucleus > H
+    std::array<int, 2> spiso3; // particle codes of: [0]: projectile, [1]: target
+    int outsteps, bflag, srtflag, efuncflag, nsrt, npb, firstev;
+  } inputs_;
+
+  // defined in inputs.f
+  extern struct {
+    double srtmin, srtmax, pbeam, betann, betatar, betapro, pbmin, pbmax;
+  } input2_;
+
+  // defined in options.f
+  extern struct {
+    std::array<double, details::constants::numcto> CTOption;
+    std::array<double, details::constants::numctp> CTParam;
+  } options_;
+
+  extern struct {
+    int fixedseed, bf13, bf14, bf15, bf16, bf17, bf18, bf19, bf20;
+  } loptions_;
+
+  // defined in urqmdInterface.F
+  extern struct { std::array<double, 3> xs, bim; } cxs_u2_;
   }
-  
+
   /**
    * convert CORSIKA code to UrQMD code tuple
    *
diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt
index 58d65940d..4acaaed0f 100644
--- a/ThirdParty/CMakeLists.txt
+++ b/ThirdParty/CMakeLists.txt
@@ -239,15 +239,6 @@ if ("x_${USE_CONEX_C8}" STREQUAL "x_SYSTEM")
   
   find_package (CONEX REQUIRED) 
   message (STATUS "Using system-level CONEX version at ${CONEX_INCLUDE_DIR}")
-  set_target_properties (
-    C8::ext::conex PROPERTIES
-    IMPORTED_LOCATION ${CONEX_PREFIX}/lib/${CMAKE_SYSTEM_NAME}/libCONEXsibyll.a
-    IMPORTED_NO_SONAME 1
-    SKIP_BUILD_RPATH FALSE
-    IMPORTED_LINK_INTERFACE_LIBRARIES ${boost_lib}
-    INTERFACE_INCLUDE_DIRECTORIES
-     $<BUILD_INTERFACE:${CONEX_INCLUDE_DIR}>    
-    )
   set (CONEX_FOUND 1 PARENT_SCOPE)
 
 else ()
@@ -283,16 +274,26 @@ else ()
 
   # create include directory at config time
   file (MAKE_DIRECTORY ${CONEX_INCLUDE_DIR})
+    
+endif ()
 
+if (Boost_iostreams_FOUND)
   set_target_properties (
     C8::ext::conex PROPERTIES
     IMPORTED_LOCATION ${CONEX_PREFIX}/lib/${CMAKE_SYSTEM_NAME}/libCONEXsibyll.a
     IMPORTED_NO_SONAME 1
     SKIP_BUILD_RPATH FALSE
-    IMPORTED_LINK_INTERFACE_LIBRARIES  ${boost_lib}
+    IMPORTED_LINK_INTERFACE_LIBRARIES boost_iostreams
     INTERFACE_INCLUDE_DIRECTORIES
-     $<BUILD_INTERFACE:${CONEX_INCLUDE_DIR}>    
+    $<BUILD_INTERFACE:${CONEX_INCLUDE_DIR}>    
     )
-    
-endif ()
-
+else (Boost_iostreams_FOUND)
+  set_target_properties (
+    C8::ext::conex PROPERTIES
+    IMPORTED_LOCATION ${CONEX_PREFIX}/lib/${CMAKE_SYSTEM_NAME}/libCONEXsibyll.a
+    IMPORTED_NO_SONAME 1
+    SKIP_BUILD_RPATH FALSE
+    INTERFACE_INCLUDE_DIRECTORIES
+    $<BUILD_INTERFACE:${CONEX_INCLUDE_DIR}>    
+    )
+endif (Boost_iostreams_FOUND)
-- 
GitLab