From 82841748298ffa1b4579d274dce429116b09b5ea Mon Sep 17 00:00:00 2001 From: prokscha Date: Tue, 10 Oct 2017 19:11:13 +0200 Subject: [PATCH] Get it running under root 6 --- run/macros/NewSpec.C | 108 ++++++++++++++++++++++++++++--------------- run/macros/NewSpec.h | 8 ++++ 2 files changed, 80 insertions(+), 36 deletions(-) diff --git a/run/macros/NewSpec.C b/run/macros/NewSpec.C index c3f279a..c6484cb 100644 --- a/run/macros/NewSpec.C +++ b/run/macros/NewSpec.C @@ -10,6 +10,10 @@ #include #include +void NewSpec::Loop() +{ +} + void NewSpec::CreateIO( Bool_t FigFlag, Double_t eCut ) { // Double_t eCut = 0.7; //minimum energy deposition in scintillators [MeV] @@ -157,6 +161,9 @@ void NewSpec::CreateIO( Bool_t FigFlag, Double_t eCut ) } else { hAsyFB -> Fit("pol0","NQ","",0.6, 13.); } + + TF1 *pol0; + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); Double_t chi2=pol0->GetChisquare(); Double_t p1=pol0->GetParameter(0); Double_t e1=pol0->GetParError(0); @@ -291,6 +298,9 @@ void NewSpec::CoinIO( Bool_t FigFlag, Double_t eCut ) } else { hAsyFB -> Fit("pol0","NQ","",0.6, 13.); } + + TF1 *pol0; + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); Double_t chi2=pol0->GetChisquare(); Double_t p1=pol0->GetParameter(0); Double_t e1=pol0->GetParError(0); @@ -434,6 +444,9 @@ void NewSpec::CoinIOUD( Bool_t FigFlag, Double_t eCut ) } else { hAsyFB -> Fit("pol0","NQ","",0.6, 13.); } + + TF1 *pol0; + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); Double_t chi2=pol0->GetChisquare(); Double_t p1=pol0->GetParameter(0); Double_t e1=pol0->GetParError(0); @@ -620,6 +633,9 @@ void NewSpec::TBLRCoinIO( Bool_t FigFlag, Double_t eCut ) hSumLR->Add(hLtemp,hRtemp,1., 1.); hAsyLR->Divide(hDifLR,hSumLR,1.,1.); + TF1 *pol0; + Double_t TBp1,TBe1,LRp1,LRe1,TBchi2,LRchi2; + if (FigFlag) { // Top - Bottom TCanvas* c1= new TCanvas("c1","canvas 1"); @@ -632,9 +648,10 @@ void NewSpec::TBLRCoinIO( Bool_t FigFlag, Double_t eCut ) hAsyTB->Draw(); hAsyTB -> Fit("pol0","Q","",0.6, 13.); // Top - Bottom - Double_t TBchi2=pol0->GetChisquare(); - Double_t TBp1=pol0->GetParameter(0); - Double_t TBe1=pol0->GetParError(0); + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); + TBchi2 = pol0->GetChisquare(); + TBp1 = pol0->GetParameter(0); + TBe1 = pol0->GetParError(0); gStyle->SetOptStat(1001111); gStyle->SetOptFit(0001); gStyle->SetLineColor(2); @@ -652,9 +669,9 @@ void NewSpec::TBLRCoinIO( Bool_t FigFlag, Double_t eCut ) hAsyLR->Draw(); hAsyLR -> Fit("pol0","Q","",0.6, 13.); // Left - Right - Double_t LRchi2=pol0->GetChisquare(); - Double_t LRp1=pol0->GetParameter(0); - Double_t LRe1=pol0->GetParError(0); + LRchi2 = pol0->GetChisquare(); + LRp1 = pol0->GetParameter(0); + LRe1 = pol0->GetParError(0); gStyle->SetOptStat(1001111); gStyle->SetOptFit(0001); gStyle->SetLineColor(2); @@ -663,15 +680,17 @@ void NewSpec::TBLRCoinIO( Bool_t FigFlag, Double_t eCut ) } else { hAsyTB -> Fit("pol0","NQ","",0.6, 13.); // Top - Bottom - Double_t TBchi2=pol0->GetChisquare(); - Double_t TBp1=pol0->GetParameter(0); - Double_t TBe1=pol0->GetParError(0); + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); + TBchi2 = pol0->GetChisquare(); + TBp1 = pol0->GetParameter(0); + TBe1 = pol0->GetParError(0); hAsyLR -> Fit("pol0","NQ","",0.6, 13.); // Left - Right - Double_t LRchi2=pol0->GetChisquare(); - Double_t LRp1=pol0->GetParameter(0); - Double_t LRe1=pol0->GetParError(0); + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); + LRchi2 = pol0->GetChisquare(); + LRp1 = pol0->GetParameter(0); + LRe1 = pol0->GetParError(0); } Double_t NDet=hDetz->GetSum(); @@ -862,6 +881,9 @@ void NewSpec::TBLRCoinDown( Bool_t FigFlag, Double_t eCut ) hSumLR->Add(hLtemp,hRtemp,1., 1.); hAsyLR->Divide(hDifLR,hSumLR,1.,1.); + TF1 *pol0; + Double_t TBp1,TBe1,LRp1,LRe1,TBchi2,LRchi2; + if (FigFlag) { // Top - Bottom TCanvas* c1= new TCanvas("c1","canvas 1"); @@ -874,9 +896,10 @@ void NewSpec::TBLRCoinDown( Bool_t FigFlag, Double_t eCut ) hAsyTB->Draw(); hAsyTB -> Fit("pol0","Q","",0.6, 13.); // Top - Bottom - Double_t TBchi2=pol0->GetChisquare(); - Double_t TBp1=pol0->GetParameter(0); - Double_t TBe1=pol0->GetParError(0); + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); + TBchi2 = pol0->GetChisquare(); + TBp1 = pol0->GetParameter(0); + TBe1 = pol0->GetParError(0); gStyle->SetOptStat(1001111); gStyle->SetOptFit(0001); gStyle->SetLineColor(2); @@ -894,9 +917,9 @@ void NewSpec::TBLRCoinDown( Bool_t FigFlag, Double_t eCut ) hAsyLR->Draw(); hAsyLR -> Fit("pol0","Q","",0.6, 13.); // Left - Right - Double_t LRchi2=pol0->GetChisquare(); - Double_t LRp1=pol0->GetParameter(0); - Double_t LRe1=pol0->GetParError(0); + LRchi2 = pol0->GetChisquare(); + LRp1 = pol0->GetParameter(0); + LRe1 = pol0->GetParError(0); gStyle->SetOptStat(1001111); gStyle->SetOptFit(0001); gStyle->SetLineColor(2); @@ -905,15 +928,16 @@ void NewSpec::TBLRCoinDown( Bool_t FigFlag, Double_t eCut ) } else { hAsyTB -> Fit("pol0","NQ","",0.6, 13.); // Top - Bottom - Double_t TBchi2=pol0->GetChisquare(); - Double_t TBp1=pol0->GetParameter(0); - Double_t TBe1=pol0->GetParError(0); + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); + TBchi2 = pol0->GetChisquare(); + TBp1 = pol0->GetParameter(0); + TBe1 = pol0->GetParError(0); hAsyLR -> Fit("pol0","NQ","",0.6, 13.); // Left - Right - Double_t LRchi2=pol0->GetChisquare(); - Double_t LRp1=pol0->GetParameter(0); - Double_t LRe1=pol0->GetParError(0); + LRchi2 = pol0->GetChisquare(); + LRp1 = pol0->GetParameter(0); + LRe1 = pol0->GetParError(0); } Double_t NDet=hDetz->GetSum(); @@ -1105,6 +1129,9 @@ void NewSpec::TBLRCoinUp( Bool_t FigFlag, Double_t eCut ) hSumLR->Add(hLtemp,hRtemp,1., 1.); hAsyLR->Divide(hDifLR,hSumLR,1.,1.); + TF1 *pol0; + Double_t TBp1,TBe1,LRp1,LRe1,TBchi2,LRchi2; + if (FigFlag) { // Top - Bottom TCanvas* c1= new TCanvas("c1","canvas 1"); @@ -1117,9 +1144,10 @@ void NewSpec::TBLRCoinUp( Bool_t FigFlag, Double_t eCut ) hAsyTB->Draw(); hAsyTB -> Fit("pol0","Q","",0.6, 13.); // Top - Bottom - Double_t TBchi2=pol0->GetChisquare(); - Double_t TBp1=pol0->GetParameter(0); - Double_t TBe1=pol0->GetParError(0); + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); + TBchi2 = pol0->GetChisquare(); + TBp1 = pol0->GetParameter(0); + TBe1 = pol0->GetParError(0); gStyle->SetOptStat(1001111); gStyle->SetOptFit(0001); gStyle->SetLineColor(2); @@ -1137,9 +1165,9 @@ void NewSpec::TBLRCoinUp( Bool_t FigFlag, Double_t eCut ) hAsyLR->Draw(); hAsyLR -> Fit("pol0","Q","",0.6, 13.); // Left - Right - Double_t LRchi2=pol0->GetChisquare(); - Double_t LRp1=pol0->GetParameter(0); - Double_t LRe1=pol0->GetParError(0); + LRchi2 = pol0->GetChisquare(); + LRp1 = pol0->GetParameter(0); + LRe1 = pol0->GetParError(0); gStyle->SetOptStat(1001111); gStyle->SetOptFit(0001); gStyle->SetLineColor(2); @@ -1148,15 +1176,16 @@ void NewSpec::TBLRCoinUp( Bool_t FigFlag, Double_t eCut ) } else { hAsyTB -> Fit("pol0","NQ","",0.6, 13.); // Top - Bottom - Double_t TBchi2=pol0->GetChisquare(); - Double_t TBp1=pol0->GetParameter(0); - Double_t TBe1=pol0->GetParError(0); + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); + TBchi2 = pol0->GetChisquare(); + TBp1 = pol0->GetParameter(0); + TBe1 = pol0->GetParError(0); hAsyLR -> Fit("pol0","NQ","",0.6, 13.); // Left - Right - Double_t LRchi2=pol0->GetChisquare(); - Double_t LRp1=pol0->GetParameter(0); - Double_t LRe1=pol0->GetParError(0); + LRchi2 = pol0->GetChisquare(); + LRp1 = pol0->GetParameter(0); + LRe1 = pol0->GetParError(0); } Double_t NDet=hDetz->GetSum(); @@ -1195,6 +1224,11 @@ void NewSpec::SCoinIO( Bool_t FigFlag, Double_t eCut ) // Sigmenets histograms 1-32 TH1F* h1 = new TH1F("h1","Muon arrival times in 1 (#mus)",1300,0.,13.); + + // Back inner histogram, i.e. all counts in segments 1-16 + TH1F* hBack = new TH1F("hBack","Muon arrival times Back (#mus)",130,0.,13.); + // Forward inner histogram, i.e. all counts in segments 17-32 + TH1F* hForw = new TH1F("hForw","Muon arrival times Forw (#mus)",130,0.,13.); hEdeposited->Sumw2(); hEdepositCF->Sumw2(); @@ -1282,6 +1316,8 @@ void NewSpec::SCoinIO( Bool_t FigFlag, Double_t eCut ) } else { hAsyFB -> Fit("pol0","NQ","",0.6, 13.); } + TF1 *pol0; + pol0 = (TF1*)gROOT->GetListOfFunctions()->FindObject("pol0"); Double_t chi2=pol0->GetChisquare(); Double_t p1=pol0->GetParameter(0); Double_t e1=pol0->GetParError(0); diff --git a/run/macros/NewSpec.h b/run/macros/NewSpec.h index 55a6a26..0f80a75 100644 --- a/run/macros/NewSpec.h +++ b/run/macros/NewSpec.h @@ -127,6 +127,14 @@ public : virtual void Loop(); virtual Bool_t Notify(); virtual void Show(Long64_t entry = -1); + virtual void CreateIO(Bool_t FigFlag, Double_t eCut); + virtual void CoinIO(Bool_t FigFlag, Double_t eCut); + virtual void CoinIOUD(Bool_t FigFlag, Double_t eCut); + virtual void TBLRCoinIO(Bool_t FigFlag, Double_t eCut); + virtual void TBLRCoinDown(Bool_t FigFlag, Double_t eCut); + virtual void TBLRCoinUp(Bool_t FigFlag, Double_t eCut); + virtual void SCoinIO(Bool_t FigFlag, Double_t eCut); + }; #endif