From 0aa3e8e98e225f6feaed93035400802b2b7f883d Mon Sep 17 00:00:00 2001 From: Charlie Paxman <cp00474@surrey.ac.uk> Date: Fri, 18 Jun 2021 09:21:08 +0100 Subject: [PATCH] * e793s gating macro improvements --- Projects/e793s/macro/DrawPlots.C | 239 +++++++++++++++++++++++-------- 1 file changed, 179 insertions(+), 60 deletions(-) diff --git a/Projects/e793s/macro/DrawPlots.C b/Projects/e793s/macro/DrawPlots.C index d8d416d71..5dbaac8bb 100755 --- a/Projects/e793s/macro/DrawPlots.C +++ b/Projects/e793s/macro/DrawPlots.C @@ -1,5 +1,9 @@ //void AddTiStates(double E); #include "NPReaction.h" +#include <string> +#include <sstream> + +using namespace std; //TCutG* ETOF=NULL; //TCutG* EDE=NULL; @@ -30,58 +34,140 @@ TChain* Chain(std::string TreeName, std::vector<std::string>& file, bool EventLi return chain; } //////////////////////////////////////////////////////////////////////////////// - void LoadChainNP(){ - vector<string> files; - //files.push_back("../../Outputs/Analysis/47K_Part_25Mar.root"); - //files.push_back("../../Outputs/Analysis/47K_Full_24Mar.root"); - //files.push_back("../../Outputs/Analysis/test_09Apr_newPhiAnalysis.root"); -// files.push_back("../../Outputs/Analysis/47K_Full_23Apr.root"); - files.push_back("../../../Outputs/Analysis/47K_RawEnergyBranch_Run63_May11.root"); - + files.push_back("../../../Outputs/Analysis/47K_Full_09June_MG3_Target.root"); chain = Chain("PhysicsTree",files,true); - // chain = new TChain("PhysicsTree"); - // chain->Add("NPOutput/PhyAllCom2019_256_AL.root"); - // chain->Add("NPOutput/PhyAllCom2019_257_AL.root"); - //chain->Add("NPOutput/PhyAllCom2019_257.root"); -} -////////////////////////////////////////////////////////////////////////////////// -void LoadEventList(){ } void plot_kine(NPL::Reaction r, double Ex,Color_t c,int w, int s){ r.SetExcitation4(Ex); - TGraph* g= r.GetKinematicLine3(); g->SetLineColor(c) ; g->SetLineStyle(s) ; g->SetLineWidth(w) ; - g->Draw("c"); } -//////////////////////////////////////////////////////////////////////////////// + void plot_state(double Ex,double max,Color_t c,int w, int s){ TLine* line = new TLine(Ex,0,Ex,max) ; line->SetLineColor(c) ; line->SetLineStyle(s) ; line->SetLineWidth(w) ; line->Draw(); - } void AddTiStates(double E){ - NPL::Reaction Ti("47Ti(d,p)48Ti@362"); - // Ti states Ti.SetExcitationHeavy(E); auto g = Ti.GetKinematicLine3(); g->SetLineWidth(1); g->SetLineStyle(2); g->Draw("c"); - +} +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +void Draw_1DGamma(){ + TCanvas *cEg = new TCanvas("cEg","cEg",1000,1000); + chain->Draw("AddBack_EDC>>Eg(2500,0,5)","abs(T_MUGAST_VAMOS-2777)<600"); + TH1F* Eg = (TH1F*) gDirectory->Get("Eg"); + Eg->SetTitle("Egamma (using 09Jun Full run)"); + Eg->GetXaxis()->SetTitle("Eg [MeV]"); +} +///////////////////////////////////// +void Draw_1DParticle(){ + TCanvas *cEx = new TCanvas("cEx","cEx",1000,1000); + chain->Draw("Ex>>Ep(220,-1,10)","abs(T_MUGAST_VAMOS-2777)<600"); + TH1F* Ep = (TH1F*) gDirectory->Get("Ep"); + Ep->SetTitle("Ex (using 09Jun Full run)"); + Ep->GetXaxis()->SetTitle("Ex [MeV]"); +} +///////////////////////////////////// +void Draw_2DParticleGamma(){ + TCanvas *cExEg = new TCanvas("cExEg","cExEg",1000,1000); + chain->Draw("AddBack_EDC:Ex>>ExEg(100,-1,5,2500,0,5)","abs(T_MUGAST_VAMOS-2777)<600","colz"); + TH1F* ExEg = (TH1F*) gDirectory->Get("ExEg"); + ExEg->SetTitle("Ex-Egamma (using 09Jun Full run)"); + ExEg->GetXaxis()->SetTitle("Ex [MeV]"); + ExEg->GetYaxis()->SetTitle("Eg [MeV]"); + TLine *XeqY = new TLine(0,0,9,9); + XeqY->SetLineColor(kRed); + XeqY->Draw(); +} +/////////////////////////////////// +void GateOnGamma(double gamma, double width){ + string gating = "abs(T_MUGAST_VAMOS-2777)<600 && abs(AddBack_EDC-" + + to_string(gamma) + + ")<" + + to_string(sigma); + + TCanvas *cEx_Gate = new TCanvas("cEx_Gate","cEx_Gate",1000,1000); + chain->Draw("Ex>>ExGate(220,-1,10)",gating.c_str(),"colz"); + TH1F* ExGate = (TH1F*) gDirectory->Get("ExGate"); + //ExGate->SetTitle("Ex gated on (using 09Jun Full run)"); + ExGate->GetXaxis()->SetTitle("Ex [MeV]"); + ExGate->GetYaxis()->SetTitle("Counts / 0.05 MeV"); +} +/////////////////////////////////// +void GateOnParticle(double particle, double width){ + string gating = "abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-" + + to_string(particle) + + ")<" + + to_string(sigma); + + TCanvas *cEg_Gate = new TCanvas("cEg_Gate","cEg_Gate",1000,1000); + chain->Draw("AddBack_EDC>>EgGate(10000,0,10)",gating.c_str(),"colz"); + TH1F* EgGate = (TH1F*) gDirectory->Get("EgGate"); + //ExGate->SetTitle("Ex gated on (using 09Jun Full run)"); + EgGate->GetXaxis()->SetTitle("Eg [MeV]"); + EgGate->GetYaxis()->SetTitle("Counts / 1 keV"); +} +void CompareExsAt4MeV(){ + TCanvas *cExCompare = new TCanvas("cExCompare","cExCompare",1000,1000); + chain->Draw("AddBack_EDC>>gate3p0(1000,0,10)", + "abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-3.0)<0.1","same"); + chain->Draw("AddBack_EDC>>gate3p5(1000,0,10)", + "abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-3.5)<0.1","same"); + chain->Draw("AddBack_EDC>>gate3p9(1000,0,10)", + "abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-3.9)<0.1","same"); + chain->Draw("AddBack_EDC>>gate4p3(1000,0,10)", + "abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-4.3)<0.1","same"); + + //cExCompare->Divide(4,1); + + //cExCompare->cd(1); + TH1F* gate3p0 = (TH1F*) gDirectory->Get("gate3p0"); + gate3p0->GetXaxis()->SetTitle("Egamma [MeV]"); + gate3p0->GetYaxis()->SetTitle("Counts"); + gate3p0->SetLineColor(kRed); + + //cExCompare->cd(2); + TH1F* gate3p5 = (TH1F*) gDirectory->Get("gate3p5"); + gate3p5->SetLineColor(kBlue); + + //cExCompare->cd(3); + TH1F* gate3p9 = (TH1F*) gDirectory->Get("gate3p9"); + gate3p9->SetLineColor(kGreen); + + //cExCompare->cd(4); + TH1F* gate4p3 = (TH1F*) gDirectory->Get("gate4p3"); + gate4p3->SetLineColor(kViolet); + gate4p3->GetXaxis()->SetRangeUser(0.,5.); + + cout << " 3.0 - Red" << endl; + cout << " 3.5 - Blue" << endl; + cout << " 3.9 - Green" << endl; + cout << " 4.3 - Violet" << endl; } +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// void DrawPlots(){ gStyle->SetOptStat("nei"); @@ -98,6 +184,30 @@ void DrawPlots(){ NPL::Reaction Ti12C12C("47Ti(12C,12C)47Ti@362"); + + cout << " AVAILABLE FUNCTIONS:: " << endl; + cout << "\t\t- Draw_2DParticleGamma() "<< endl; + cout << "\t\t- Draw_1DGamma() "<< endl; + cout << "\t\t- Draw_1DParticle() "<< endl; + cout << "\t\t- GateOnGamma(gamma, width) "<< endl; + cout << "\t\t- GateOnParticle(particle, width) "<< endl; + cout << "\t\t- CompareExsAt4MeV() "<< endl; + + + + + /*** Functions for drawing ***/ + + //Draw_1DGamma(); + //Draw_2DParticleGamma(); + + //GateOnGamma(0.1426, 0.0015); + //GateOnGamma(1.2680, 0.0193); + //GateOnGamma(1.8382, 0.0062); + //GateOnGamma(3.5179, 0.0109); + + /*****************************/ + /* TCanvas *cF = new TCanvas("cF","cF",1000,1000); gPad->SetLogz(); @@ -222,10 +332,11 @@ void DrawPlots(){ // hcG_T5->GetXaxis()->SetRangeUser(-3.,7.); - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* // MUGAST Displacement Ex histogram // - TCanvas *cG = new TCanvas("cG","cG",1000,1000); + TCanvas *cMisaligned = new TCanvas("cMisaligned","cMisaligned",1000,1000); // chain->Draw("Ex>>hcG(200,-3,7)",""); chain->Draw("Ex>>hcG_T1(200,-3,7)","abs(T_MUGAST_VAMOS-2777)<600 && Mugast.TelescopeNumber==1",""); chain->Draw("Ex>>hcG_T2(200,-3,7)","abs(T_MUGAST_VAMOS-2777)<600 && Mugast.TelescopeNumber==2","same"); @@ -242,31 +353,32 @@ void DrawPlots(){ hcG_T1->GetXaxis()->SetTitle("E_{x} [MeV]"); hcG_T1->GetYaxis()->SetTitle("Counts / (50 keV)"); hcG_T1->SetLineColor(kRed); - hcG_T1->SetFillStyle(3001); + hcG_T1->SetFillStyle(3244); hcG_T1->SetFillColor(kRed); + hcG_T1->GetYaxis()->SetRangeUser(0.,200.); TH1F* hcG_T2 = (TH1F*) gDirectory->Get("hcG_T2"); hcG_T2->SetLineColor(kOrange); - hcG_T2->SetFillStyle(3001); + hcG_T2->SetFillStyle(3344); hcG_T2->SetFillColor(kOrange); TH1F* hcG_T3 = (TH1F*) gDirectory->Get("hcG_T3"); hcG_T3->SetLineColor(kGreen); - hcG_T3->SetFillStyle(3001); + hcG_T3->SetFillStyle(3444); hcG_T3->SetFillColor(kGreen); TH1F* hcG_T4 = (TH1F*) gDirectory->Get("hcG_T4"); hcG_T4->SetLineColor(kTeal); - hcG_T4->SetFillStyle(3001); + hcG_T4->SetFillStyle(3544); hcG_T4->SetFillColor(kTeal); TH1F* hcG_T5 = (TH1F*) gDirectory->Get("hcG_T5"); hcG_T5->SetLineColor(kBlue); - hcG_T5->SetFillStyle(3001); + hcG_T5->SetFillStyle(3644); hcG_T5->SetFillColor(kBlue); TH1F* hcG_T7 = (TH1F*) gDirectory->Get("hcG_T7"); hcG_T7->SetLineColor(kViolet); - hcG_T7->SetFillStyle(3001); + hcG_T7->SetFillStyle(3644); hcG_T7->SetFillColor(kViolet); - hcG_T7->GetYaxis()->SetRangeUser(0.,500.); +// hcG_T7->GetYaxis()->SetRangeUser(0.,750.); - TLine *line = new TLine(0,0,0,500); + TLine *line = new TLine(0,0,0,200); line->SetLineColor(kBlack); line->Draw(); @@ -279,6 +391,10 @@ void DrawPlots(){ legend->AddEntry(hcG_T7,"MUGAST 7","f"); legend->Draw(); +*/ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /* ORIGINAL - DO NOT EDIT TCanvas *cG = new TCanvas("cG","cG",1000,1000); @@ -293,7 +409,8 @@ void DrawPlots(){ */ /* ORIGINAL 4-PLOT KINEMATIC SCREEN */ -/* TCanvas *c0 = new TCanvas("c0", "Kinematics", 1000, 1000); +/* + TCanvas *c0 = new TCanvas("c0", "Kinematics", 1000, 1000); c0->Divide(2,2); c0->cd(1); gPad->SetLogz(); @@ -361,9 +478,10 @@ void DrawPlots(){ line->SetLineColor(kRed); line->Draw(); */ -/* + // plot_state(0.143, ymax, kYellow, 2, 9); +/* c0->cd(4); chain->Draw("AddBack_EDC>>hEg(4000,0,4)","abs(T_MUGAST_VAMOS-2777)<600"); TH1F* hEg = (TH1F*) gDirectory->Get("hEg"); @@ -396,38 +514,39 @@ void DrawPlots(){ - /* - TCanvas *c1 = new TCanvas("c1", "EDC with gates on Ex", 700, 1000); +/* + TCanvas *c1 = new TCanvas("c1", "Egamma, gated on Ex", 1000, 1000); c1->Divide(2,2); c1->cd(1); - chain->Draw("AddBack_EDC>>hEg_0(4000,0,4)","abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex)<0.5"); - TH1F* hEg_0 = (TH1F*) gDirectory->Get("hEg_0"); - hEg_0->GetXaxis()->SetTitle("E_{#gamma} [MeV]"); - hEg_0->GetYaxis()->SetTitle("Counts / (1 keV)"); - hEg_0->SetLineColor(kBlack); - - c1->cd(1); - chain->Draw("AddBack_EDC>>hEg_1(4000,0,4)","abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-1)<0.5"); - TH1F* hEg_1 = (TH1F*) gDirectory->Get("hEg_1"); - hEg_1->GetXaxis()->SetTitle("E_{#gamma} [MeV]"); - hEg_1->GetYaxis()->SetTitle("Counts / (1 keV)"); - hEg_1->SetLineColor(kBlack); - + chain->Draw("AddBack_EDC>>hEg_0p143(800,0,4)","abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-0.143)<0.1"); + TH1F* hEg_0p143 = (TH1F*) gDirectory->Get("hEg_0p143"); + hEg_0p143->GetXaxis()->SetTitle("E_{#gamma} [MeV]"); + hEg_0p143->GetYaxis()->SetTitle("Counts / (5 keV)"); + hEg_0p143->SetLineColor(kBlack); c1->cd(2); - chain->Draw("AddBack_EDC>>hEg_2(4000,0,4)","abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-2)<0.5"); - TH1F* hEg_2 = (TH1F*) gDirectory->Get("hEg_2"); - hEg_2->GetXaxis()->SetTitle("E_{#gamma} [MeV]"); - hEg_2->GetYaxis()->SetTitle("Counts / (1 keV)"); - hEg_2->SetLineColor(kBlack); + chain->Draw("AddBack_EDC>>hEg_1p275(800,0,4)","abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-1.275)<0.1"); + TH1F* hEg_1p275 = (TH1F*) gDirectory->Get("hEg_1p275"); + hEg_1p275->GetXaxis()->SetTitle("E_{#gamma} [MeV]"); + hEg_1p275->GetYaxis()->SetTitle("Counts / (5 keV)"); + hEg_1p275->SetLineColor(kBlack); c1->cd(3); - chain->Draw("AddBack_EDC>>hEg_3(4000,0,4)","abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-4)<0.5"); - TH1F* hEg_3 = (TH1F*) gDirectory->Get("hEg_3"); - hEg_3->GetXaxis()->SetTitle("E_{#gamma} [MeV]"); - hEg_3->GetYaxis()->SetTitle("Counts / (1 keV)"); - hEg_3->SetLineColor(kBlack); - */ + chain->Draw("AddBack_EDC>>hEg_1p822(800,0,4)","abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-1.822)<0.1"); + TH1F* hEg_1p822 = (TH1F*) gDirectory->Get("hEg_1p822"); + hEg_1p822->GetXaxis()->SetTitle("E_{#gamma} [MeV]"); + hEg_1p822->GetYaxis()->SetTitle("Counts / (5 keV)"); + hEg_1p822->SetLineColor(kBlack); + + c1->cd(4); + chain->Draw("AddBack_EDC>>hEg_3p609(800,0,4)","abs(T_MUGAST_VAMOS-2777)<600 && abs(Ex-3.609)<0.1"); + TH1F* hEg_3p609 = (TH1F*) gDirectory->Get("hEg_3p609"); + hEg_3p609->GetXaxis()->SetTitle("E_{#gamma} [MeV]"); + hEg_3p609->GetYaxis()->SetTitle("Counts / (5 keV)"); + hEg_3p609->SetLineColor(kBlack); + +*/ + // K states /*auto gr = K.GetKinematicLine3(); -- GitLab