From eada4d862d349c2db1e0ea2919e8d1c1ecf78e12 Mon Sep 17 00:00:00 2001
From: adrien-matta <a.matta@surrey.ac.uk>
Date: Thu, 2 Apr 2015 14:15:43 +0100
Subject: [PATCH] * Adding build_dict script

---
 Inputs/DetectorConfiguration/MUGAST.detector |  4 +-
 NPAnalysis/macros/GeometricalEfficiency.C    |  5 +-
 NPLib/scripts/build_dict.sh                  | 73 ++++++++++++++++++++
 3 files changed, 79 insertions(+), 3 deletions(-)
 create mode 100755 NPLib/scripts/build_dict.sh

diff --git a/Inputs/DetectorConfiguration/MUGAST.detector b/Inputs/DetectorConfiguration/MUGAST.detector
index 1431a269f..0dc16eae8 100644
--- a/Inputs/DetectorConfiguration/MUGAST.detector
+++ b/Inputs/DetectorConfiguration/MUGAST.detector
@@ -64,7 +64,7 @@ GPDTrapezoid
    VIS= all
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 Barrel
-GPDRectangle
+GPDSquare
    X1_Y1=     -132.251  58.314   53.5
    X128_Y1=    -61.823 128.742   53.5
    X1_Y128=   -132.251 58.314   -58.5
@@ -74,7 +74,7 @@ GPDRectangle
    THIRDSTAGE= 0
    VIS= all
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2
-GPDRectangle
+GPDSquare
    X1_Y1=     -134.75  -52.319  53.5
    X128_Y1=   -134.75   47.281  53.5
    X1_Y128=   -134.75  -52.319 -58.5
diff --git a/NPAnalysis/macros/GeometricalEfficiency.C b/NPAnalysis/macros/GeometricalEfficiency.C
index 33abe7a17..d3ec1b9e4 100644
--- a/NPAnalysis/macros/GeometricalEfficiency.C
+++ b/NPAnalysis/macros/GeometricalEfficiency.C
@@ -86,7 +86,9 @@ void GeometricalEfficiency(const char * fname = "myResult"){
       hDetecThetaCM->Fill(initCond->GetThetaCM(0));
     }
   }
-  
+   TCanvas *c0 = new TCanvas("c0", "Distrib",800,800);
+  hEmittTheta->Draw("");
+  hDetecTheta->Draw("same");
   // efficiency in lab frame in %
   TCanvas *c = new TCanvas("c", "efficiency",800,800);
   c->SetTopMargin(0.01);
@@ -111,4 +113,5 @@ void GeometricalEfficiency(const char * fname = "myResult"){
   TF1* f = new TF1("f",Form("2 * %f * sin(x*%f/180.) *1*%f/180.",M_PI,M_PI,M_PI),0,180);
   f->Draw("SAME");
   c4->Update();
+
 }
diff --git a/NPLib/scripts/build_dict.sh b/NPLib/scripts/build_dict.sh
new file mode 100755
index 000000000..847732736
--- /dev/null
+++ b/NPLib/scripts/build_dict.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+# This script detect the root version and call the command necessary to build 
+# a Dictionnary, rootmap and pcm file accordingly
+
+# Checking that enought argument are given
+if [ "$#" -lt 4 ]
+  then
+    echo "Dictionnary Generation in : $PWD"
+    echo "Incorrect argument number : 1.Header 2.DictName 3.Rootmap 4.LibName (optional)5.LinkDefFile"
+    echo "Arguments are : $@"
+    exit 1
+fi
+
+# Modify the lib name according to the system
+lib_ext=.so
+system=$(uname -a)
+system="${system/%\ */}"
+if [ "$system" == "Darwin" ]
+  then
+    lib_ext=.dylib
+fi
+
+lib_name=$4
+lib_name="${lib_name%.*}"
+lib_name="$lib_name$lib_ext"
+
+# Detect the Root
+is_root=$(which root-config)
+
+# Detect the version
+if [ $is_root != "" ]; 
+  then
+    version=$(root-config --version)
+  else 
+    echo  "root-config not found"
+    exit 1
+fi
+
+# Get the Major version
+version_major="${version%.*}"
+
+# if before version 4, exit
+if [ $version_major -lt 5 ]
+  then
+    echo "Root version too old, min. version 5" 
+    exit 1
+fi
+
+# Version 5 : generate the dictionnary then the libmap
+if [ $version_major -eq 5 ]
+  then
+    rootcint -f $2 -I../Core -c $1
+    if [ "$#" -eq 4 ]
+      then
+        rlibmap -c $1 -o $3 -l $lib_name
+    fi
+    
+    if [ "$#" -eq 5 ]
+      then
+        rlibmap -o $3 -l $lib_name -c $5
+    fi
+fi
+
+# Version 6 or more : generate both at once
+if [ $version_major -gt 5 ]
+  then
+   rootcint -f $2 -rmf $3 -rml $lib_name -I../Core $1 $5
+fi
+
+
+
+
-- 
GitLab