From 1c8bbfcfde2b839c3f7c3ee293e77ed4450a134d Mon Sep 17 00:00:00 2001 From: vratislav3 Date: Sun, 24 Jun 2018 21:47:13 +0200 Subject: [PATCH] Mofifications of some scripts --- analysis/figuresPAC.cxx | 220 ++++++++++++++++++++++ analysis/fillChain.cxx | 22 ++- analysis/makeCutsHelium.cxx | 100 ++++++++++ analysis/makeCutsTritium.cxx | 152 ++++++++++++++++ analysis/rootlogon.C | 7 +- analysis/showBananas2.cxx | 140 +++++++------- analysis/showTritium.cxx | 341 +++++++++++++++++++++++++++++++++++ 7 files changed, 892 insertions(+), 90 deletions(-) create mode 100644 analysis/figuresPAC.cxx create mode 100644 analysis/makeCutsHelium.cxx create mode 100644 analysis/makeCutsTritium.cxx create mode 100644 analysis/showTritium.cxx diff --git a/analysis/figuresPAC.cxx b/analysis/figuresPAC.cxx new file mode 100644 index 0000000..3104adb --- /dev/null +++ b/analysis/figuresPAC.cxx @@ -0,0 +1,220 @@ +#include "TSystem.h" +#include "TFile.h" +#include "TTree.h" +#include "TChain.h" +#include "TCanvas.h" +#include "TBox.h" +#include "TCut.h" +#include "TCutG.h" + +using std::cout; +using std::endl; + +void figuresPAC(const Long64_t drawEntries = 100000000) { + +// TFile *fr = new TFile("~/data/exp1804/h5_11_00.root"); + TChain *tr = new TChain("AnalysisxTree"); + tr->Add("~/data/exp1804/h5_14_0?.root"); + tr->Add("~/data/exp1804/be10_0?_?0.root"); + + + TChain *trCal = new TChain("cal"); +// trCal->Add("~/data/exp1804/h5_11_0?_calib.root"); + trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); + trCal->Add("~/data/exp1804/be10_0?_?0_calib.root"); + + tr->AddFriend(trCal); + + TFile *fcal = new TFile("~/data/exp1804/calib/si_20_03_calib.root"); + TTree *tAlphaCal = (TTree*)fcal->Get("cal"); + tAlphaCal->SetMarkerColor(kRed); + tAlphaCal->SetMarkerStyle(20); + tAlphaCal->SetMarkerSize(.6); + + TFile *fc = new TFile("cutsIdentification.root", "READ"); + TCutG *cUS = (TCutG*)fc->Get("c7UpperShadow"); + TCutG *cLS = (TCutG*)fc->Get("c7LowerShadow"); + cLS->SetLineColor(kMagenta); + TCutG *cMA = (TCutG*)fc->Get("c7MainAlpha"); + TCutG *cA = (TCutG*)fc->Get("c7All"); + TCutG *cBL = (TCutG*)fc->Get("cBeamLeft"); + TCutG *cBR = (TCutG*)fc->Get("cBeamRight"); + + +// const Int_t drawEntries = 6000000; +// const Int_t drawEntries = tr->GetEntries(); + + tr->GetListOfFiles()->Print(); + trCal->GetListOfFiles()->Print(); + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + + TString varName; + TString condition; + + cout << drawEntries << " entries in input chain will be processed." << endl; + + const Int_t firstThinStrip = 5; + +///////////////////////////////////////////////////////////////////// +// c3 + + /*TCanvas *c3 = new TCanvas("c3", "dE-E corrected", 1000, 1000); + + Int_t i = 1; + varName.Form("SQ20Ecorr[%d]:SQ20Ecorr[%d]+SQLYEsum", i+firstThinStrip, i+firstThinStrip); + varName.Form("SQ20Ecorr[%d]:SQ20Ecorr[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20Ecorr[%d]>1.2 && SQ20Ecorr[%d]<5 " + "&& SQLYEsum>1.1 && SQLYEsum<30 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " + "&& SQLYE[0]<1. && SQLYE[15]<1. " + "&& SQLYmult==1 && SQLXmult==1" + "&& trigger==3", + i+firstThinStrip, i+firstThinStrip); + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "col", drawEntries); + c3->Update();//*/ + +// return; + +///////////////////////////////////////////////////////////////////// + // c4 + + TCanvas *c4 = new TCanvas("c4", "PID plot from CsI filtered for time", 1600, 800); +// c4->Divide(4,2); + + TFile *fCutsTime = new TFile("cutsTimeCsI.root"); + TString cutName; + TCutG *currCut; + + TString timeSiCondition; + timeSiCondition.Form("0.3*tSQX_R[0]-0.125*tF5[0]<100"); + // TString auxCon; + for (Int_t j = 1; j<32; j++) { + condition.Form(" && 0.3*tSQX_R[%d]-0.125*tF5[0]<100", j); + timeSiCondition.Append(condition); + } + cout << timeSiCondition << endl; + +// for (Int_t i = 0; i < 8; i++) { + // c4->cd(i+1); + Int_t i = 4; + + cutName.Form("cTime%d", i+firstThinStrip); + currCut = (TCutG*)fCutsTime->Get(cutName); + + varName.Form("SQRXE:NeEvent.CsI_R[%d]", i+firstThinStrip); + condition.Form("NeEvent.CsI_R[%d]<3500" + "&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1" + "&& trigger==3 && %s && %s", + i+firstThinStrip, cutName.Data(), timeSiCondition.Data()); + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "", drawEntries); + // tr->Draw(varName, "", "", drawEntries); + // tr->Draw(varName, condition, "", drawEntries); + + // tAlphaCal->Draw(varName, "", "same"); + + // cutName.Form("cutEnergy%d", i+firstThinStrip); + // currCut = (TCutG*)fCutsTritium->Get(cutName); + // + // currCut->Draw("same"); + + c4->Update(); + // }//*/ + + return; + + + + + + + + + return; + +///////////////////////////////////////////////////////////////////// +// c5 + + TCanvas *c5 = new TCanvas("c4", "MWPC", 1000, 1000); + c5->Divide(2,2); + + c5->cd(4); + condition.Form("TOF<185 && TOF>165 && trigger==3 && yt>-50 && xt>-50"); + varName.Form("yt:xt>>hXYt(32, -40., 40., 32, -40., 40.)"); + tr->Draw(varName, condition, "col", drawEntries); +// targetBoarder->Draw(); + c5->Update(); + + c5->cd(1); + tr->Draw("y1p:x1p>>hXY1(32, -20., 20., 32, -20., 20.)", + "TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && y1p>-50 && x1p>-50", "col", 1000000); + cBL->Draw("same"); + cBR->Draw("same"); + c5->Update(); + + c5->cd(2); + tr->Draw("y2p:x2p>>hXY2(32, -20., 20., 32, -20., 20.)", + "TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && y2p>-50 && x2p>-50", "col", 1000000); + c5->Update(); + + c5->cd(3); + tr->Draw("dEbeam:TOF>>IDplot(200,,,200,,)", "TOF<200 && TOF>100 && dEbeam < 2500 && trigger==1", "col", 1000000); + TBox *beamBox = new TBox(165, 1150, 185, 600); + beamBox->SetFillStyle(0); + beamBox->SetLineWidth(3); + beamBox->SetLineColor(kRed); + beamBox->Draw(); + c5->Update(); + +///////////////////////////////////////////////////////////////////// +// c6 + + TCanvas *c6 = new TCanvas("c6", "1 mm Y: 8-15 - target locus", 1600, 800); + c6->Divide(4,2); + TString cTarget("xt>-10. && xt<10. && yt>-15. && yt<15."); + + c6->cd(1); + tr->Draw("SQ20E[0]:SQ20E[0]+SQLYEsum>>(200,0,5,200,0,5)", "", "", 100); + + for (Int_t i = 0; i < 8; i++) { + c6->cd(i+1); + varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 && SQLYEsum>1.1 && SQLYEsum<30 && SQLYE[0]<1. && SQLYE[15]<1.", + i+firstThinStrip, i+firstThinStrip); + tr->Draw(varName, condition, "col", drawEntries); + c6->Update(); + + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 && SQLYEsum>1.1 && SQLYEsum<30 && SQLYE[0]<1. && SQLYE[15]<1. && %s", + i+firstThinStrip, i+firstThinStrip, cTarget.Data()); + tr->SetMarkerColor(kRed); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(.5); + tr->Draw(varName, condition, "same", drawEntries); + c6->Update(); + } + +///////////////////////////////////////////////////////////////////// +// c7 + + TCanvas *c7 = new TCanvas("c7", "1 mm Y: 8-15", 1600, 800); + c7->Divide(4,2); + TString cStripsLow("SQLXE[0]<1. && SQLXE[1]<1. && SQLXE[2]<1. && SQLXE[3]<1. && SQLXE[4]<1. && SQLXE[5]<1. && SQLXE[6]<1. && SQLXE[7]<1. && SQLXE[8]<1. && SQLXE[9]<1. && SQLXE[10]<1."); + TString cStripsHigh("SQLXE[31]<1. && SQLXE[30]<1. && SQLXE[29]<1. && SQLXE[28]<1. && SQLXE[27]<1. && SQLXE[26]<1. && SQLXE[25]<1. && SQLXE[24]<1. && SQLXE[23]<1. && SQLXE[22]<1. && SQLXE[21]<1. && SQLXE[20]<1."); + + for (Int_t i = 0; i < 8; i++) { + c7->cd(i+1); + varName.Form("SQ20E[%d]:SQ20E[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " + "&& %s && %s" + , i+firstThinStrip, i+firstThinStrip, cStripsLow.Data(), cStripsHigh.Data()); + tr->Draw(varName, condition, "col", drawEntries); + c7->Update(); + } + + return; + +} diff --git a/analysis/fillChain.cxx b/analysis/fillChain.cxx index 62feecc..a61f06a 100644 --- a/analysis/fillChain.cxx +++ b/analysis/fillChain.cxx @@ -1,8 +1,8 @@ #include "TSystem.h" #include "TFile.h" #include "TTree.h" -#include "../src/TNeEvent.h" -#include "../../AculUtils/TELoss/TELoss.h" +//#include "../src/TNeEvent.h" +//#include "../../AculUtils/TELoss/TELoss.h" using std::cout; using std::endl; @@ -11,10 +11,14 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { TString inFile; inFile.Form("~/data/exp1804/h5_14_%02d.root", nofile); +// inFile.Form("~/data/exp1804/be10_03_%d0.root", nofile); +// inFile.Form("~/data/exp1804/be10_%02d_00.root", nofile); // inFile.Form("~/data/exp1804/calib/si_20_03.root"); TString outFile; outFile.Form("~/data/exp1804/h5_14_%02d_calib.root", nofile); +// outFile.Form("~/data/exp1804/be10_03_%d0_calib.root", nofile); +// outFile.Form("~/data/exp1804/be10_%02d_00_calib.root", nofile); // outFile.Form("~/data/exp1804/calib/si_20_03_calib.root"); cout << "Input file: " << inFile << endl; @@ -137,13 +141,13 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { fw->cd(); - TELoss fAlphaSi; - fAlphaSi.SetEL(1, 2.321); // density in g/cm3 - fAlphaSi.AddEL(14., 28.086, 1); //Z, mass - // mSi.SetZP(1., 1.); //protons - fAlphaSi.SetZP(2., 3.); //3He, Z, A - fAlphaSi.SetEtab(100000, 100.); // ?, MeV calculate ranges - fAlphaSi.SetDeltaEtab(300); +// TELoss fAlphaSi; +// fAlphaSi.SetEL(1, 2.321); // density in g/cm3 +// fAlphaSi.AddEL(14., 28.086, 1); //Z, mass +// // mSi.SetZP(1., 1.); //protons +// fAlphaSi.SetZP(2., 3.); //3He, Z, A +// fAlphaSi.SetEtab(100000, 100.); // ?, MeV calculate ranges +// fAlphaSi.SetDeltaEtab(300); ////////////////////////////////// //event processing diff --git a/analysis/makeCutsHelium.cxx b/analysis/makeCutsHelium.cxx new file mode 100644 index 0000000..e5e81cc --- /dev/null +++ b/analysis/makeCutsHelium.cxx @@ -0,0 +1,100 @@ +#include "TSystem.h" +#include "TFile.h" +#include "TTree.h" +#include "TChain.h" +#include "TCanvas.h" +#include "TBox.h" +#include "TCut.h" +#include "TCutG.h" + +using std::cout; +using std::endl; + +void makeCutsHelium(const Long64_t drawEntries = 10000000) { + +// TFile *fr = new TFile("~/data/exp1804/h5_11_00.root"); + TChain *tr = new TChain("AnalysisxTree"); + tr->Add("~/data/exp1804/h5_14_0?.root"); + tr->Add("~/data/exp1804/be10_0?_?0.root"); + + + TChain *trCal = new TChain("cal"); +// trCal->Add("~/data/exp1804/h5_11_0?_calib.root"); + trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); + trCal->Add("~/data/exp1804/be10_0?_?0_calib.root"); + + tr->AddFriend(trCal); + + TFile *fcal = new TFile("~/data/exp1804/calib/si_20_03_calib.root"); + TTree *tAlphaCal = (TTree*)fcal->Get("cal"); + tAlphaCal->SetMarkerColor(kRed); + tAlphaCal->SetMarkerStyle(20); + tAlphaCal->SetMarkerSize(.6); + + TFile *fc = new TFile("cutsIdentification.root", "READ"); + TCutG *cUS = (TCutG*)fc->Get("c7UpperShadow"); + TCutG *cLS = (TCutG*)fc->Get("c7LowerShadow"); + cLS->SetLineColor(kMagenta); + TCutG *cMA = (TCutG*)fc->Get("c7MainAlpha"); + TCutG *cA = (TCutG*)fc->Get("c7All"); + TCutG *cBL = (TCutG*)fc->Get("cBeamLeft"); + TCutG *cBR = (TCutG*)fc->Get("cBeamRight"); + + +// const Int_t drawEntries = 6000000; +// const Int_t drawEntries = tr->GetEntries(); + + tr->GetListOfFiles()->Print(); + trCal->GetListOfFiles()->Print(); + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + + TString varName; + TString condition; + + cout << drawEntries << " entries in input chain will be processed." << endl; + +// const Int_t firstThinStrip = 5; + + TString canName; + TString canTitle; + + ///////////////////////////////////////////////////////////////////// + // c4 + + + TCanvas *c4[16]; + + for (Int_t i = 4; i < 14; i++) { + canName.Form("c4_%d", i); + canTitle.Form("PID plot from left telescope: %d", i); + c4[i] = new TCanvas(canName, canTitle, 1000, 900); + c4[i]->cd(); + + // varName.Form("SQ20E[%d]:SQLYEsum", i); + varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", i, i); + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5 " + "&& SQLYEsum>1.1 && SQLYEsum<30 " + "&& SQLYE[0]<1. && SQLYE[15]<1." + "&& SQLYmult==1 && SQLXmult==1" + "&& trigger==3", + i, i); + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "col", drawEntries); + // tr->Draw(varName, condition, "", drawEntries); + +// tAlphaCal->Draw(varName, "", "same"); + + c4[i]->Update(); + }//for */ + + + + return; + + + + + +} diff --git a/analysis/makeCutsTritium.cxx b/analysis/makeCutsTritium.cxx new file mode 100644 index 0000000..6608f06 --- /dev/null +++ b/analysis/makeCutsTritium.cxx @@ -0,0 +1,152 @@ +#include "TSystem.h" +#include "TFile.h" +#include "TTree.h" +#include "TChain.h" +#include "TCanvas.h" +#include "TBox.h" +#include "TCut.h" +#include "TCutG.h" + +using std::cout; +using std::endl; + +void makeCutsTritium(const Long64_t drawEntries = 5000000) +{ +// const Long64_t drawEntries = 100000; + +// TFile *fr = new TFile("~/data/exp1804/h5_11_00.root"); + TChain *tr = new TChain("AnalysisxTree"); + tr->Add("~/data/exp1804/h5_14_0?.root"); +// tr->Add("~/data/exp1804/be10_0?_?0.root"); + + + TChain *trCal = new TChain("cal"); +// trCal->Add("~/data/exp1804/h5_11_0?_calib.root"); + trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); +// trCal->Add("~/data/exp1804/be10_0?_?0_calib.root"); + + tr->AddFriend(trCal); + +// TFile *fcal = new TFile("~/data/exp1804/calib/si_20_03_calib.root"); +// TTree *tAlphaCal = (TTree*)fcal->Get("cal"); +// tAlphaCal->SetMarkerColor(kRed); +// tAlphaCal->SetMarkerStyle(20); +// tAlphaCal->SetMarkerSize(.6); + + TFile *fc = new TFile("cutsIdentification.root", "READ"); + TCutG *cUS = (TCutG*)fc->Get("c7UpperShadow"); + TCutG *cLS = (TCutG*)fc->Get("c7LowerShadow"); + cLS->SetLineColor(kMagenta); + TCutG *cMA = (TCutG*)fc->Get("c7MainAlpha"); + TCutG *cA = (TCutG*)fc->Get("c7All"); + TCutG *cBL = (TCutG*)fc->Get("cBeamLeft"); + TCutG *cBR = (TCutG*)fc->Get("cBeamRight"); + + +// const Int_t drawEntries = 6000000; +// const Int_t drawEntries = tr->GetEntries(); + + tr->GetListOfFiles()->Print(); + trCal->GetListOfFiles()->Print(); + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + + TString varName; + TString condition; + + cout << drawEntries << " entries in input chain will be processed." << endl; + +// const Int_t firstThinStrip = 5; + + TString canName; + TString canTitle; + + TString timeSiCondition; + timeSiCondition.Form("0.3*tSQX_R[0]-0.125*tF5[0]<100"); + // TString auxCon; + for (Int_t j = 1; j<32; j++) { + condition.Form(" && 0.3*tSQX_R[%d]-0.125*tF5[0]<100", j); + timeSiCondition.Append(condition); + } + cout << timeSiCondition << endl; + +///////////////////////////////////////////////////////////////////// +// c3 + + + + /*TCanvas *c3[16]; +// c3->Divide(4,4); + + for (Int_t i = 0; i < 16; i++) { + canName.Form("c3_%d", i); + canTitle.Form("time from CsI: %d", i); + c3[i] = new TCanvas(canName, canTitle, 1000, 900); + c3[i]->cd(); + + varName.Form("CsI_R[%d]:0.125*tCsI_R[%d]-0.125*tF5[0]", i, i); + condition.Form("CsI_R[%d]>250 && trigger==3" + "&& 0.125*tCsI_R[%d]-0.125*tF5[0] > -80" + "&& 0.125*tCsI_R[%d]-0.125*tF5[0] < 0" + "&& CsI_R[%d] < 4500", + i, i, i, i); + + tr->SetMarkerColor(kBlack); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(.4); + tr->Draw(varName, condition, "", drawEntries); + + c3[i]->Update(); + }//*/ + +// return; + +///////////////////////////////////////////////////////////////////// + // c4 + + TCanvas *c4[16]; + + TFile *fCutsTime = new TFile("cutsTimeCsI.root"); + TCutG *currCut; + TString cutName; + + + for (Int_t i = 4; i < 16; i++) { + canName.Form("c4_%d", i); + canTitle.Form("PID plot from CsI filtered for time: %d", i); + c4[i] = new TCanvas(canName, canTitle, 1000, 900); + c4[i]->cd(); + + cutName.Form("cTime%d", i); + currCut = (TCutG*)fCutsTime->Get(cutName); + + varName.Form("SQRXE:NeEvent.CsI_R[%d]", i); + condition.Form("NeEvent.CsI_R[%d]<3500" +// "&& 0.125*tCsI_R[%d]-0.125*tF5[0] > -70" +// "&& 0.125*tCsI_R[%d]-0.125*tF5[0] < -40" + "&& SQRXEsum<25 && SQRXmult==1" + "&& trigger==3 && %s && %s", + i, cutName.Data(), timeSiCondition.Data()); + tr->SetMarkerColor(kBlack); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(.4); + + tr->Draw(varName, condition, "", drawEntries); +// tr->Draw(varName, "", "", drawEntries); + // tr->Draw(varName, condition, "", drawEntries); + +// tAlphaCal->Draw(varName, "", "same"); + + c4[i]->Update(); + }//*/ + + return; + +///////////////////////////////////////////////////////////////////// +// c5 + + + return; + +} diff --git a/analysis/rootlogon.C b/analysis/rootlogon.C index a641ac4..3f20d17 100644 --- a/analysis/rootlogon.C +++ b/analysis/rootlogon.C @@ -1,6 +1,7 @@ { - gInterpreter->AddIncludePath("/home/vratik/go4-5.3.0/include"); - gInterpreter->AddIncludePath("/home/vratik/workspace/AculUtils/TELoss"); +// gInterpreter->AddIncludePath("/home/vratik/go4-5.3.0/include"); +// gInterpreter->AddIncludePath("/home/vratik/workspace/go4egor/src"); +// gInterpreter->AddIncludePath("/home/vratik/workspace/AculUtils/TELoss"); gSystem->Load("../libUserAnalysis.so"); - gSystem->Load("../../AculUtils/libTELoss.so"); +// gSystem->Load("../../AculUtils/libTELoss.so"); } diff --git a/analysis/showBananas2.cxx b/analysis/showBananas2.cxx index 0472027..5b2050b 100644 --- a/analysis/showBananas2.cxx +++ b/analysis/showBananas2.cxx @@ -15,11 +15,13 @@ void showBananas2(const Long64_t drawEntries = 100000) { // TFile *fr = new TFile("~/data/exp1804/h5_11_00.root"); TChain *tr = new TChain("AnalysisxTree"); tr->Add("~/data/exp1804/h5_14_0?.root"); + tr->Add("~/data/exp1804/be10_0?_?0.root"); TChain *trCal = new TChain("cal"); // trCal->Add("~/data/exp1804/h5_11_0?_calib.root"); trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); + trCal->Add("~/data/exp1804/be10_0?_?0_calib.root"); tr->AddFriend(trCal); @@ -83,7 +85,7 @@ void showBananas2(const Long64_t drawEntries = 100000) { ///////////////////////////////////////////////////////////////////// // c2 - TCanvas *c2 = new TCanvas("c2", "1 mm Y: 8-15 zoomed", 1600, 800); + /*TCanvas *c2 = new TCanvas("c2", "1 mm Y: 8-15 zoomed", 1600, 800); c2->Divide(4,2); for (Int_t i = 0; i < 8; i++) { @@ -115,6 +117,20 @@ void showBananas2(const Long64_t drawEntries = 100000) { TCanvas *c3 = new TCanvas("c3", "dE-E corrected", 1600, 800); c3->Divide(4,2); + TF1 *f3 = new TF1("dEE", "log(1/x)-log(0.1)+1.6", 1, 30); + f3->SetLineColor(kRed); + f3->SetLineWidth(3); + + TF1 *f4 = new TF1("dEE", "log(1/x)-log(0.1)+1.98", 1, 30); + f4->SetLineColor(kGreen); + f4->SetLineWidth(3); + + TF1 *f6 = new TF1("dEE", "log(1/x)-log(0.1)+2.66", 1, 30); + f4->SetLineColor(kBlue); + f4->SetLineWidth(3); + + + for (Int_t i = 0; i < 8; i++) { c3->cd(i+1); // varName.Form("SQ20Ecorr[%d]:SQLYEsum", i+firstThinStrip); @@ -133,87 +149,55 @@ void showBananas2(const Long64_t drawEntries = 100000) { tAlphaCal->Draw(varName, "", "same"); +// f3->Draw("same"); +// f4->Draw("same"); +// f6->Draw("same"); + c3->Update(); - } + }//*/ return; ///////////////////////////////////////////////////////////////////// -// c4 - - TCanvas *c4 = new TCanvas("c5", "MWPC: different dE-E regions", 1000, 1000); - c4->Divide(2,2); - - c4->cd(1); - tr->Draw("y1p:x1p>>hXY1dr(32, -20., 20., 32, -20., 20.)", - "TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && y1p>-50 && x1p>-50", - "col", 1000000); - c4->Update(); - - tr->SetMarkerStyle(20); - tr->SetMarkerSize(0.4); - - condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && yt>-50 && xt>-50 && c7MainAlpha"); - tr->SetMarkerColor(kGreen); - tr->SetMarkerSize(1.); - tr->Draw(varName, condition, "same", drawEntries); - c4->Update(); - - condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && yt>-50 && xt>-50 && c7UpperShadow"); - tr->SetMarkerColor(kRed); - tr->SetMarkerStyle(3); - tr->SetMarkerSize(1.7); - tr->Draw(varName, condition, "same", drawEntries); - c4->Update(); - - condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && yt>-50 && xt>-50 && c7LowerShadow"); - tr->SetMarkerColor(kMagenta); - tr->SetMarkerStyle(20); - tr->SetMarkerSize(1.); - tr->Draw(varName, condition, "same", drawEntries); - c4->Update(); - - c4->cd(2); - tr->Draw("y2p:x2p>>hXY2dr(32, -20., 20., 32, -20., 20.)", - "TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && y2p>-50 && x2p>-50", - "col", 1000000); - c4->Update(); - - c4->cd(4); - condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && yt>-50 && xt>-50"); - varName.Form("yt:xt>>hXYtDR(32, -40., 40., 32, -40., 40.)"); - tr->Draw(varName, condition, "col", 100000); - TBox *targetBoarder = new TBox(-25., 20., 25., -20.); - targetBoarder->SetFillStyle(0); - targetBoarder->SetLineWidth(3); - targetBoarder->SetLineColor(kRed); - targetBoarder->Draw(); - c4->Update(); - - tr->SetMarkerStyle(20); - tr->SetMarkerSize(0.4); - - varName.Form("yt:xt"); - - condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && yt>-50 && xt>-50 && c7MainAlpha"); - tr->SetMarkerColor(kGreen); - tr->SetMarkerSize(1.); - tr->Draw(varName, condition, "same", drawEntries); - c4->Update(); - - condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && yt>-50 && xt>-50 && c7UpperShadow"); - tr->SetMarkerColor(kRed); - tr->SetMarkerStyle(3); - tr->SetMarkerSize(1.7); - tr->Draw(varName, condition, "same", drawEntries); - c4->Update(); - - condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && yt>-50 && xt>-50 && c7LowerShadow"); - tr->SetMarkerColor(kMagenta); - tr->SetMarkerStyle(20); - tr->SetMarkerSize(1.); - tr->Draw(varName, condition, "same", drawEntries); - c4->Update(); + // c4 + + ///////////////////////////////////////////////////////////////////// + // c2 + + TCanvas *c4 = new TCanvas("c4", "1 mm Y all: 8-15 zoomed", 1000, 900); + c4->Divide(4,4); + + for (Int_t i = 0; i < 16; i++) { + c4->cd(i+1); +// varName.Form("SQ20E[%d]:SQLYEsum", i); + varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", i, i); + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5 " + "&& SQLYEsum>1.1 && SQLYEsum<30 " + "&& SQLYE[0]<1. && SQLYE[15]<1." + "&& SQLYmult==1 && SQLXmult==1" + "&& trigger==3", + i, i); + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "col", drawEntries); + // tr->Draw(varName, condition, "", drawEntries); + + tAlphaCal->Draw(varName, "", "same"); + + c4->Update(); + }//for */ + + + + return; + + + + + + + + + return; ///////////////////////////////////////////////////////////////////// // c5 @@ -225,7 +209,7 @@ void showBananas2(const Long64_t drawEntries = 100000) { condition.Form("TOF<185 && TOF>165 && trigger==3 && yt>-50 && xt>-50"); varName.Form("yt:xt>>hXYt(32, -40., 40., 32, -40., 40.)"); tr->Draw(varName, condition, "col", drawEntries); - targetBoarder->Draw(); +// targetBoarder->Draw(); c5->Update(); c5->cd(1); diff --git a/analysis/showTritium.cxx b/analysis/showTritium.cxx new file mode 100644 index 0000000..0d432e9 --- /dev/null +++ b/analysis/showTritium.cxx @@ -0,0 +1,341 @@ +#include "TSystem.h" +#include "TFile.h" +#include "TTree.h" +#include "TChain.h" +#include "TCanvas.h" +#include "TBox.h" +#include "TCut.h" +#include "TCutG.h" +#include "TROOT.h" + +using std::cout; +using std::endl; + +void showTritium(const Long64_t drawEntries = 100000) +{ +// const Long64_t drawEntries = 100000; + +// TFile *fr = new TFile("~/data/exp1804/h5_11_00.root"); + TChain *tr = new TChain("AnalysisxTree"); + tr->Add("~/data/exp1804/h5_14_0?.root"); +// tr->Add("~/data/exp1804/be10_0?_?0.root"); + + + TChain *trCal = new TChain("cal"); +// trCal->Add("~/data/exp1804/h5_11_0?_calib.root"); + trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); +// trCal->Add("~/data/exp1804/be10_0?_?0_calib.root"); + + tr->AddFriend(trCal); + +// TFile *fcal = new TFile("~/data/exp1804/calib/si_20_03_calib.root"); +// TTree *tAlphaCal = (TTree*)fcal->Get("cal"); +// tAlphaCal->SetMarkerColor(kRed); +// tAlphaCal->SetMarkerStyle(20); +// tAlphaCal->SetMarkerSize(.6); + + TFile *fc = new TFile("cutsIdentification.root", "READ"); + TCutG *cUS = (TCutG*)fc->Get("c7UpperShadow"); + TCutG *cLS = (TCutG*)fc->Get("c7LowerShadow"); + cLS->SetLineColor(kMagenta); + TCutG *cMA = (TCutG*)fc->Get("c7MainAlpha"); + TCutG *cA = (TCutG*)fc->Get("c7All"); + TCutG *cBL = (TCutG*)fc->Get("cBeamLeft"); + TCutG *cBR = (TCutG*)fc->Get("cBeamRight"); + + +// const Int_t drawEntries = 6000000; +// const Int_t drawEntries = tr->GetEntries(); + + tr->GetListOfFiles()->Print(); + trCal->GetListOfFiles()->Print(); + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + + TString varName; + TString condition; + + cout << drawEntries << " entries in input chain will be processed." << endl; + + const Int_t firstThinStrip = 5; + + TFile *fCutsTime = new TFile("cutsTimeCsI.root"); + TFile *fCutsTritium = new TFile("cutsDeltaEtritium.root"); + TCutG *currCut; + TString cutName; + + TString timeSiCondition; + timeSiCondition.Form("0.3*tSQX_R[0]-0.125*tF5[0]<100"); + // TString auxCon; + for (Int_t j = 1; j<32; j++) { + condition.Form(" && 0.3*tSQX_R[%d]-0.125*tF5[0]<100", j); + timeSiCondition.Append(condition); + } + cout << timeSiCondition << endl; + +///////////////////////////////////////////////////////////////////// +// c1 + + + TCanvas *c1 = new TCanvas("c1", "tritium raw", 1600, 800); + c1->Divide(4,2); + + for (Int_t i = 0; i < 8; i++) { + c1->cd(i+1); + + varName.Form("SQRXE:NeEvent.CsI_R[%d]", i+firstThinStrip); + condition.Form("NeEvent.CsI_R[%d]<4000 " + "&& SQRXEsum<40 && SQRXmult==1 && SQRXE[0]<1 " + "&& trigger==3", + i+firstThinStrip); + + + tr->SetMarkerColor(kBlack); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(0.1); + tr->Draw(varName, condition, "", drawEntries); + c1->Update(); + }//*/ +// return; + +///////////////////////////////////////////////////////////////////// +// c2 + + /*TCanvas *c2 = new TCanvas("c2", "time from right Si", 1600, 800); + c2->Divide(4,2); + + for (Int_t i = 0; i < 8; i++) { + c2->cd(i+1); +// varName.Form("SQ20E[%d]:SQLYEsum", i+firstThinStrip); + varName.Form("SQRXE[%d]:0.3*tSQX_R[%d]-0.125*tF5[0]", i+firstThinStrip, i+firstThinStrip); + condition.Form("tSQX_R[%d]>0" +// "&& SQLYEsum>1.1 && SQLYEsum<30 " +// "&& SQLYE[0]<1. && SQLYE[15]<1." +// "&& SQLYmult==1 && SQLXmult==1" + "&& trigger==3", + i+firstThinStrip); + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "", drawEntries); +// tr->Draw(varName, condition, "", drawEntries); + + + condition.Form( +// "tSQX_R[%d]>0" +// "&& 0.3*tSQX_R-0.125*tF5[0] <100 " + // "&& SQLYE[0]<1. && SQLYE[15]<1." + // "&& SQLYmult==1 && SQLXmult==1" + "trigger==3 && %s", +// i+firstThinStrip, + timeSiCondition.Data()); + + tr->SetMarkerColor(kRed); + tr->Draw(varName, condition, "same", drawEntries); + + c2->Update(); + }//for */ + + + +// return; + +///////////////////////////////////////////////////////////////////// +// c3 + + /*TCanvas *c3 = new TCanvas("c3", "time from CsI", 1000, 900); + c3->Divide(4,4); + +// gROOT->ProcessLine(".x cutPokus.cxx"); + + + + for (Int_t i = 0; i < 16; i++) { + c3->cd(i+1); +// varName.Form("SQRXE[%d]:0.3*tSQX_R[%d]-0.125*tF5[]", i+firstThinStrip, i+firstThinStrip); +// condition.Form("SQRXE[%d]>3 && trigger==3", +// i+firstThinStrip); + cutName.Form("cTime%d", i); + currCut = (TCutG*)fCutsTime->Get(cutName); + + varName.Form("CsI_R[%d]:0.125*tCsI_R[%d]-0.125*tF5[0]", i, i); + condition.Form("CsI_R[%d]>3 && trigger==3" + "&& 0.125*tCsI_R[%d]-0.125*tF5[0] > -80" + "&& 0.125*tCsI_R[%d]-0.125*tF5[0] < 0" + "&& CsI_R[%d] < 4500", + i, i, i, i); + + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "", drawEntries); +// tr->Draw(varName, condition, "", drawEntries); + + currCut->Draw("same"); + + c3->Update(); + }//*/ + + + +// return; + +///////////////////////////////////////////////////////////////////// + // c4 + + TCanvas *c4 = new TCanvas("c4", "PID plot from CsI filtered for time", 1600, 800); + c4->Divide(4,2); + + + for (Int_t i = 0; i < 8; i++) { + c4->cd(i+1); + + cutName.Form("cTime%d", i+firstThinStrip); + currCut = (TCutG*)fCutsTime->Get(cutName); + + varName.Form("SQRXE:NeEvent.CsI_R[%d]", i+firstThinStrip); + condition.Form("NeEvent.CsI_R[%d]<3500" + "&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1" + "&& trigger==3 && %s && %s", + i+firstThinStrip, cutName.Data(), timeSiCondition.Data()); + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "", drawEntries); +// tr->Draw(varName, "", "", drawEntries); + // tr->Draw(varName, condition, "", drawEntries); + +// tAlphaCal->Draw(varName, "", "same"); + + cutName.Form("cutEnergy%d", i+firstThinStrip); + currCut = (TCutG*)fCutsTritium->Get(cutName); + + currCut->Draw("same"); + + c4->Update(); + }//*/ + + return; + +///////////////////////////////////////////////////////////////////// +// c5 + + TCanvas *c5 = new TCanvas("c5", "PID plot from CsI filtered for time", 1000, 1000); + c5->Divide(4,4); + + TCutG *currCutTritium; + TString cutNameTritium; + + TString cutHe("(cutHe0"); + TString cutNameHe; + TFile *fCutsHelium = new TFile("cutsDeltaEhelium.root"); + TCutG *cutsHe[14]; + for (Int_t i = 0; i<14; i++) { + cutNameHe.Form("cutHe%d", i); + cutsHe[i] = (TCutG*)fCutsHelium->Get(cutNameHe); + cutName.Form(" || %s", cutNameHe.Data()); + if (i>0) cutHe.Append(cutName); + } + cutHe.Append(")"); + + cout << endl << endl << cutHe << endl; + + Int_t numberOfHe[16]; + + for (Int_t i = 0; i < 16; i++) { + c5->cd(i+1); + + cutName.Form("cTime%d", i); + currCut = (TCutG*)fCutsTime->Get(cutName); + + cutNameTritium.Form("cutEnergy%d", i); + currCutTritium = (TCutG*)fCutsTritium->Get(cutNameTritium); + + varName.Form("SQRXE:NeEvent.CsI_R[%d]", i); + condition.Form("NeEvent.CsI_R[%d]<3500" + "&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1" + "&& trigger==3 && %s && %s", + i, + cutName.Data(), timeSiCondition.Data()); + tr->SetMarkerColor(kBlack); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(.4); + tr->Draw(varName, condition, "", drawEntries/100); + // tr->Draw(varName, "", "", drawEntries); + // tr->Draw(varName, condition, "", drawEntries); + + // tAlphaCal->Draw(varName, "", "same"); + +// cutName.Form("cutEnergy%d", i); +// currCut = (TCutG*)fCutsTritium->Get(cutName); + + currCutTritium->Draw("same"); + c5->Update(); + + condition.Form("NeEvent.CsI_R[%d]<3500" + "&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1" + "&& trigger==3 && %s && %s && %s && %s", + i, + cutName.Data(), timeSiCondition.Data(), cutNameTritium.Data(), cutHe.Data()); + tr->SetMarkerColor(kRed); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(1); + numberOfHe[i] = tr->Draw(varName, condition, "same", drawEntries); + cout << "CsI number " << i << ": " << numberOfHe[i] << " events" << endl; + + c5->Update(); + } + + cout << endl << endl; + + for (Int_t i = 0; i < 16; i++) { + cout << "CsI number " << i << ": " << numberOfHe[i] << " events" << endl; + } + + + return; + +///////////////////////////////////////////////////////////////////// +// c6 + + TCanvas *c6 = new TCanvas("c6", "1 mm Y: 8-15 - target locus", 1600, 800); + c6->Divide(4,2); + TString cTarget("xt>-10. && xt<10. && yt>-15. && yt<15."); + + c6->cd(1); + tr->Draw("SQ20E[0]:SQ20E[0]+SQLYEsum>>(200,0,5,200,0,5)", "", "", 100); + + for (Int_t i = 0; i < 8; i++) { + c6->cd(i+1); + varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 && SQLYEsum>1.1 && SQLYEsum<30 && SQLYE[0]<1. && SQLYE[15]<1.", + i+firstThinStrip, i+firstThinStrip); + tr->Draw(varName, condition, "col", drawEntries); + c6->Update(); + + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 && SQLYEsum>1.1 && SQLYEsum<30 && SQLYE[0]<1. && SQLYE[15]<1. && %s", + i+firstThinStrip, i+firstThinStrip, cTarget.Data()); + tr->SetMarkerColor(kRed); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(.5); + tr->Draw(varName, condition, "same", drawEntries); + c6->Update(); + } + +///////////////////////////////////////////////////////////////////// +// c7 + + TCanvas *c7 = new TCanvas("c7", "1 mm Y: 8-15", 1600, 800); + c7->Divide(4,2); + TString cStripsLow("SQLXE[0]<1. && SQLXE[1]<1. && SQLXE[2]<1. && SQLXE[3]<1. && SQLXE[4]<1. && SQLXE[5]<1. && SQLXE[6]<1. && SQLXE[7]<1. && SQLXE[8]<1. && SQLXE[9]<1. && SQLXE[10]<1."); + TString cStripsHigh("SQLXE[31]<1. && SQLXE[30]<1. && SQLXE[29]<1. && SQLXE[28]<1. && SQLXE[27]<1. && SQLXE[26]<1. && SQLXE[25]<1. && SQLXE[24]<1. && SQLXE[23]<1. && SQLXE[22]<1. && SQLXE[21]<1. && SQLXE[20]<1."); + + for (Int_t i = 0; i < 8; i++) { + c7->cd(i+1); + varName.Form("SQ20E[%d]:SQ20E[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " + "&& %s && %s" + , i+firstThinStrip, i+firstThinStrip, cStripsLow.Data(), cStripsHigh.Data()); + tr->Draw(varName, condition, "col", drawEntries); + c7->Update(); + } + + return; + +} -- 2.18.1