From 3cb79140628e149490d48cbbb71baa95cfcce970 Mon Sep 17 00:00:00 2001
From: Charlie Paxman <cp00474@surrey.ac.uk>
Date: Wed, 9 Feb 2022 16:05:50 +0000
Subject: [PATCH] * e793s - tweak

---
 Projects/e793s/macro/CS2.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Projects/e793s/macro/CS2.h b/Projects/e793s/macro/CS2.h
index e3f0e915b..c2c1880a3 100644
--- a/Projects/e793s/macro/CS2.h
+++ b/Projects/e793s/macro/CS2.h
@@ -1,3 +1,4 @@
+/* Predefine functions */
 vector<vector<double>> ExpDiffCross(double Energy);
 TH1F* PullThetaLabHist(int i, double minTheta, double gatesize);
 void Scale(TGraph* g , TGraphErrors* ex);
@@ -5,11 +6,13 @@ TGraph* TWOFNR(double E, double J0, double J, double n, double l, double j);
 double ToMininize(const double* parameter);
 TGraph* FindNormalisation(TGraph* theory, TGraphErrors* experiment);
 
+/* Global variables */
 vector<Double_t> anglecentres, anglewidth;
 TGraph* currentThry;
 TGraphErrors* staticExp;
-
 int indexE;
+
+/* Output volume toggle */
 bool loud = 0;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -21,6 +24,12 @@ void CS(double Energy, double Spin, double spdf, double angmom, double nodes){
   // J0 is incident spin, which is 47K g.s. therefore J0 = 1/2
   double J0 = 0.5;
 
+  /* Clean global variables, in case of multiple runs */
+  indexE = 100;
+  anglecentres.clear();
+  anglewidth.clear();
+
+
   /* Retrieve array index of the entered peak energy */
   /* numpeaks and Energy[] defined globally in KnownPeakFitter.h */
   bool found = 0;
-- 
GitLab