From 73383da7a8de38b7c91d63816c38e0634f76736a Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Tue, 7 Jul 2020 16:11:26 +0200
Subject: [PATCH] proper dynamic arrays with unique_ptr

---
 Processes/CONEXSourceCut/CONEXSourceCut.cc | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/Processes/CONEXSourceCut/CONEXSourceCut.cc b/Processes/CONEXSourceCut/CONEXSourceCut.cc
index 9c83af267..89eaf0f7b 100644
--- a/Processes/CONEXSourceCut/CONEXSourceCut.cc
+++ b/Processes/CONEXSourceCut/CONEXSourceCut.cc
@@ -106,9 +106,19 @@ void CONEXSourceCut::SolveCE() {
   int iSec = 0;
 
   const int maxX = nX;
-  float X[maxX], H[maxX], D[maxX], N[maxX], dEdX[maxX],
-    Mu[maxX], dMu[maxX], Gamma[maxX], Electrons[maxX], Hadrons[maxX],
-    EGround[3], fitpars[13], currlgE, Xmx, Nmx, XmxdEdX, dEdXmx ;
+  
+  auto X = std::make_unique<float[]>(maxX);
+  auto H = std::make_unique<float[]>(maxX);
+  auto D = std::make_unique<float[]>(maxX);
+  auto N = std::make_unique<float[]>(maxX);
+  auto dEdX = std::make_unique<float[]>(maxX);
+  auto Mu = std::make_unique<float[]>(maxX);
+  auto dMu = std::make_unique<float[]>(maxX);
+  auto Gamma = std::make_unique<float[]>(maxX);
+  auto Electrons = std::make_unique<float[]>(maxX);
+  auto Hadrons = std::make_unique<float[]>(maxX);  
+  
+  float EGround[3], fitpars[13], currlgE, Xmx, Nmx, XmxdEdX, dEdXmx ;
   
   conex::get_shower_data_(icut, iSec, nX, X[0], N[0], fitpars[0], H[0], D[0]);
   conex::get_shower_edep_(icut, nX, dEdX[0], EGround[0]);
-- 
GitLab