From 65f839013ee19414d4587d448498e9e700620e8a Mon Sep 17 00:00:00 2001
From: adrien-matta <a.matta@surrey.ac.uk>
Date: Fri, 5 Jun 2015 17:14:44 +0100
Subject: [PATCH] * Adding an optional nptool style for figures in root

---
 NPLib/scripts/NPToolLogon.C  | 11 ++++-
 NPLib/scripts/Style_nptool.C | 82 ++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 2 deletions(-)
 create mode 100644 NPLib/scripts/Style_nptool.C

diff --git a/NPLib/scripts/NPToolLogon.C b/NPLib/scripts/NPToolLogon.C
index 1a0adcb64..2cc2fbe20 100644
--- a/NPLib/scripts/NPToolLogon.C
+++ b/NPLib/scripts/NPToolLogon.C
@@ -49,13 +49,20 @@ std::string LOGON_LIB_EXTENSION = ".so";
 #endif
 
 
-void NPToolLogon(){
+//#include "Style_nptool.C"
+
+void NPToolLogon(){ 
+  // Create the NPTool Stype
+  TString NPLPath = gSystem->Getenv("NPTOOL");  
+  gROOT->ProcessLine(Form(".x %s/NPLib/scripts/Style_nptool.C",NPLPath.Data()));
+
+
   // Change the standard random generator to TRandom2
   gRandom = new TRandom2();
 
   TString currentpath = gSystem->Getenv("PWD");
   TString path = gSystem->Getenv("NPTOOL");
-
+ 
   // Add include path
   gROOT->ProcessLine(Form(".include %s/NPLib/include", path.Data()));
 
diff --git a/NPLib/scripts/Style_nptool.C b/NPLib/scripts/Style_nptool.C
new file mode 100644
index 000000000..d6960b6cd
--- /dev/null
+++ b/NPLib/scripts/Style_nptool.C
@@ -0,0 +1,82 @@
+#include "TStyle.h"
+#include "TColor.h"
+void Style_nptool(){
+  //-----------------------------------
+  // standardised nptool root style
+  // produce minimalist publication ready
+  // outlook with nptool color scheme
+  //-----------------------------------
+  TStyle* style_nptool = new TStyle("nptool", "style_nptool");
+
+  //General 
+  style_nptool->SetFrameFillColor(kWhite);	
+  style_nptool->SetFrameBorderMode(0);	
+  style_nptool->SetFrameLineColor(kBlack);
+  style_nptool->SetStatColor(kWhite);	
+  style_nptool->SetFillColor(kWhite); 
+  style_nptool->SetTitleFillColor(kWhite);  
+
+  // Canvas
+  style_nptool->SetCanvasColor(kWhite);	
+  style_nptool->SetCanvasDefH(800);
+  style_nptool->SetCanvasDefW(800);
+  style_nptool->SetCanvasBorderMode(0);	
+
+  // Pad
+  style_nptool->SetPadBottomMargin(0.15);
+  style_nptool->SetPadLeftMargin(0.15);
+  style_nptool->SetPadTopMargin(0.05);
+  style_nptool->SetPadRightMargin(0.10);
+  style_nptool->SetPadBorderMode(0);	
+  style_nptool->SetPadBorderSize(1);
+  style_nptool->SetPadColor(kWhite);		
+  style_nptool->SetPadTickX(1);
+  style_nptool->SetPadTickY(1);
+
+  // Desable stat title and fit  
+  style_nptool->SetOptStat(0);
+  style_nptool->SetOptTitle(0);
+  style_nptool->SetOptFit(0);		
+
+  // x axis
+  style_nptool->SetTitleXSize(0.06);     
+  style_nptool->SetTitleXOffset(1.0);     
+  style_nptool->SetLabelOffset(0.1,"X");   
+  style_nptool->SetLabelSize(0.04,"X");
+  style_nptool->SetLabelOffset(0.006,"X");
+
+  // y axis
+  style_nptool->SetTitleYSize(0.06);  
+  style_nptool->SetTitleYOffset(1.1);  
+  style_nptool->SetLabelOffset(0.1,"Y");
+  style_nptool->SetLabelSize(0.04,"Y");
+  style_nptool->SetLabelOffset(0.006,"Y");
+
+  // z axis
+  style_nptool->SetLabelSize(0.04,"Z");
+  style_nptool->SetLabelOffset(0.006,"Z");
+
+
+  // Histogramm
+  style_nptool->SetHistLineColor(kAzure+7);
+  style_nptool->SetHistFillStyle(1001);
+  style_nptool->SetHistFillColor(kAzure+7);
+  style_nptool->SetMarkerColor(kOrange+7);
+  style_nptool->SetMarkerStyle(20);
+  style_nptool->SetLineColor(kOrange+7);
+  style_nptool->SetLineWidth(2);
+  style_nptool->SetFuncColor(kOrange+7);
+  style_nptool->SetFuncWidth(2);
+
+  style_nptool->SetTitlePS("nptool");
+
+  const UInt_t Number = 4;
+  Double_t Red[Number]    = { 0,0.22,  0.5*0,     0   };
+  Double_t Green[Number]  = { 0,0.22,  0.5*0.8,   0.8 };
+  Double_t Blue[Number]   = { 0,0.22,  0.5*1.00,  1.00 };
+
+  Double_t Length[Number] = { 0, 0.5,0.5,1.00 };
+  Int_t nb=255;
+  TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
+  style_nptool->SetNumberContours(99);
+}
-- 
GitLab