From f328bdcaad010473af2a2e3c699800c76f68d798 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Sun, 1 Jul 2018 03:22:33 +0300 Subject: [PATCH] Some progress with Be data analysis. --- analysis/fillChain.cxx | 248 ++++++++++++-- analysis/showBananas2.cxx | 572 +++++++++++++++++++++++++-------- analysis/showTritium.cxx | 63 +--- analysis/showTritiumReport.cxx | 298 +++++++++++++++++ 4 files changed, 971 insertions(+), 210 deletions(-) create mode 100644 analysis/showTritiumReport.cxx diff --git a/analysis/fillChain.cxx b/analysis/fillChain.cxx index a61f06a..595a6fa 100644 --- a/analysis/fillChain.cxx +++ b/analysis/fillChain.cxx @@ -1,6 +1,7 @@ #include "TSystem.h" #include "TFile.h" #include "TTree.h" +#include "TVector3.h" //#include "../src/TNeEvent.h" //#include "../../AculUtils/TELoss/TELoss.h" @@ -10,15 +11,15 @@ using std::endl; 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/h5_14_%02d.root", nofile); + inFile.Form("~/data/exp1804/be10_03_%d0.root", nofile); //files 00,10,...,60 +// inFile.Form("~/data/exp1804/be10_%02d_00.root", nofile); //files 01,02, 03, 05 // 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/h5_14_%02d_calib.root", nofile); + outFile.Form("~/data/exp1804/be10_03_%d0_calib.root", nofile); //files 00,10,...,60 +// outFile.Form("~/data/exp1804/be10_%02d_00_calib.root", nofile); //files 01,02, 03, 05 // outFile.Form("~/data/exp1804/calib/si_20_03_calib.root"); cout << "Input file: " << inFile << endl; @@ -36,15 +37,33 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { Float_t SQ20E[16]; Float_t SQ20Ecorr[16]; + Float_t SQ20EcorrHit[16]; Float_t SQ20Esum; + + Float_t SQ20time[16]; + Int_t SQ20timeMult; + Float_t SQLXtime[32]; + Int_t SQLXtimeMult; +// Float_t SQLXtimeSum; + Float_t SQLXE[32]; Float_t SQLXEsum; + + Float_t SQLXEtimeFiltered[32]; + Float_t SQLXEtimeFilteredSum; + Float_t SQLYE[16]; Float_t SQLYEsum; + Float_t SQLYtime[16]; + Int_t SQLYtimeMult; + + Float_t SQLYEtimeFiltered[16]; + Float_t SQLYEtimeFilteredSum; Int_t SQLXmult; Int_t SQLYmult; Int_t SQ20EcorrMult; + Int_t SQ20EcorrHitMult; Float_t SQRXE[32]; Float_t SQRXEsum; @@ -52,11 +71,55 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { Float_t TOF, dEbeam; Float_t x1p, y1p, x2p, y2p, xt, yt; + + //left 1 mm position + Float_t x1mm, y1mm; + const Float_t z1mm = 230.; + + Float_t xThin, yThin; + const Float_t zThin = 230.-53.6; + + const Float_t xThinOffset = -3., yThinOffset = -1.8; + + Int_t mapXbin, mapYbin; + + TVector3 vHit1mm; + TVector3 vNorm(0.,0.,1.); + Double_t angleLeft; + + tw->Branch("angleLeft",&angleLeft,"angleLeft/D"); + tw->Branch("x1mm",&x1mm,"x1mm/F"); + tw->Branch("y1mm",&y1mm,"y1mm/F"); + tw->Branch("xThin",&xThin,"xThin/F"); + tw->Branch("yThin",&yThin,"yThin/F"); + + tw->Branch("mapXbin",&mapXbin,"mapXbin/I"); + tw->Branch("mapYbin",&mapYbin,"mapYbin/I"); + tw->Branch("SQ20E",SQ20E,"SQ20E[16]/F"); tw->Branch("SQ20Ecorr",SQ20Ecorr,"SQ20Ecorr[16]/F"); + tw->Branch("SQ20EcorrHit",SQ20EcorrHit,"SQ20EcorrHit[16]/F"); tw->Branch("SQ20Esum",&SQ20Esum,"SQ20Esum/F"); + + tw->Branch("SQ20time",SQ20time,"SQ20time[16]/F"); + tw->Branch("SQ20timeMult",&SQ20timeMult,"SQ20timeMult/I"); +// tw->Branch("SQLXtimeSum",&SQLXtimeSum,"SQLXtimeSum/F"); + + tw->Branch("SQLXtime",SQLXtime,"SQLXtime[32]/F"); + tw->Branch("SQLXtimeMult",&SQLXtimeMult,"SQLXtimeMult/I"); + + tw->Branch("SQLYtime",SQLYtime,"SQLYtime[16]/F"); + tw->Branch("SQLYtimeMult",&SQLYtimeMult,"SQLYtimeMult/I"); + tw->Branch("SQLXE",SQLXE,"SQLXE[32]/F"); tw->Branch("SQLXEsum",&SQLXEsum,"SQLXE/F"); + + tw->Branch("SQLXEtimeFiltered",SQLXEtimeFiltered,"SQLXEtimeFiltered[32]/F"); + tw->Branch("SQLXEsumtimeFilteredSum",&SQLXEtimeFilteredSum,"SQLXEtimeFilteredSum/F"); + + tw->Branch("SQLYEtimeFiltered",SQLYEtimeFiltered,"SQLYEtimeFiltered[16]/F"); + tw->Branch("SQLYEsumtimeFilteredSum",&SQLYEtimeFilteredSum,"SQLYEtimeFilteredSum/F"); + tw->Branch("SQLYE",SQLYE,"SQLYE[16]/F"); tw->Branch("SQLYEsum",&SQLYEsum,"SQLYEsum/F"); @@ -114,7 +177,7 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { TFile fThickness("thicknessFinal.root", "OPEN"); fr->cd(); TH2F *hThickness = new TH2F(*(TH2F*)fThickness.Get("hTh")); - hThickness->Draw("col"); +// hThickness->Draw("col"); // std::cout << std::setprecision(1) << std::fixed; @@ -137,24 +200,25 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { // } // } + Float_t timeCorr[16] = {0, -2, 0, 2, + -2.5, 5, -6, 4, + 7, 3, 3, 4, + 6, 4, -4, 13 + }; 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); - ////////////////////////////////// //event processing ////////////////////////////////// for (Int_t eventNo = 0; eventNo < nevents; eventNo++) { + +// cout << eventNo << endl; + tr->GetEvent(eventNo); + +// cout << eventNo << endl; // cout << revent->SQX_L[0] << endl; // SQLXE[0] = revent->SQX_L[0]; @@ -164,21 +228,32 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { SQRXEsum = 0.; SQRXmult = 0; + SQLXEtimeFilteredSum = 0.; + SQLYEtimeFilteredSum = 0.; + SQLXmult = 0; SQLYmult = 0; SQ20EcorrMult = 0; + SQ20EcorrHitMult = 0; + + SQ20timeMult = 0; + SQLXtimeMult = 0; +// SQLXtimeSum = 0; + SQLYtimeMult = 0; + +//cout << endl; + for (Int_t i = 0; i < 32; i++) { // cout << pSQX_L_EC.Energy(1, i) << endl; SQLXE[i] = 0; SQRXE[i] = 0; + SQLXtime[i] = 0; + SQLXEtimeFiltered[i] = 0.; energy = pSQX_L_EC.Energy(revent->SQX_L[i], i); -// cout << energy << "\t" << pSQX_L_EC.a[i][0] << "\t" << pSQX_L_EC.a[i][1] << "\t" << pSQX_L_EC.a[i][2] << endl; -// cout << energy << endl; - // if (i == 5 && i == 6) continue; if (energy > kSQLX_energy_thr) { @@ -187,6 +262,28 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { SQLXmult++; } + if (i<16 && i!=5 && i!=6 && i!=0 && i!=1 + && SQLXE[i]>kSQLX_energy_thr + && revent->tSQX_L[i]*0.3>320 && revent->tSQX_L[i]*0.3<380) { + SQLXtime[i] = revent->tSQX_L[i]*0.3; + SQLXtimeMult++; +// SQLXtimeSum = SQLXtimeSum + SQLXtime[i]; + SQLXEtimeFiltered[i]=energy; + SQLXEtimeFilteredSum = SQLXEtimeFilteredSum + SQLXEtimeFiltered[i]; +// cout << SQLXtime[i] << endl; +// cout << i << endl; + } + if (i>15 + && SQLXE[i]>kSQLX_energy_thr + && revent->tSQX_L[i]*0.3>410 && revent->tSQX_L[i]*0.3<470) { + SQLXtime[i] = revent->tSQX_L[i]*0.3; + SQLXtimeMult++; +// SQLXtimeSum = SQLXtimeSum + SQLXtime[i]; + SQLXEtimeFiltered[i] = energy; + SQLXEtimeFilteredSum = SQLXEtimeFilteredSum + SQLXEtimeFiltered[i]; +//// cout << SQLXtime[i] << endl; + } + energy = pSQX_R_EC.Energy(revent->SQX_R[i], i); if (energy > 1.0) { @@ -201,9 +298,14 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { SQLYE[i] = 0.; SQ20E[i] = 0.; + SQ20time[i] = 0.; SQ20Ecorr[i] = 0.; + SQ20EcorrHit[i] = 0.; // SQRXE[i] = 0; + SQLYtime[i] = 0.; + SQLYEtimeFiltered[i] = 0.; + energy = pSQ20_EC.Energy(revent->SQ20[i], i); // if (energy > 1.) { @@ -213,6 +315,9 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { // cout << i << "\t" << energy << "\t" << pSQ20_EC.a[i][0] << "\t" << pSQ20_EC.a[i][1] << "\t" << pSQ20_EC.a[i][2] << endl; // } + SQ20time[i] = revent->tSQ20[i]*0.3; + if (SQ20E[i]>kSQL20_energy_thr && SQ20time[i]>400 && SQ20time[i]<500) SQ20timeMult++; + if (i==0) continue; @@ -227,6 +332,18 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { SQLYmult++; } + Double_t time = revent->tSQY_L[i]*0.3 + timeCorr[i]; + + if (SQLYE[i]>kSQLY_energy_thr && time>325 && time<333) { +// cout << "!!!!!!!!!!!!" << endl; + SQLYtime[i] = time; + SQLYtimeMult++; + SQLYEtimeFiltered[i]=energy; + SQLYEtimeFilteredSum = SQLYEtimeFilteredSum + SQLYEtimeFiltered[i]; + } + + + // energy = pSQX_R_EC.Energy(revent->SQX_R[i], i); // // if (energy > 1.0) { @@ -236,6 +353,8 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { // } }//for 16 +// cout << SQLXtimeMult << endl; + // cout << endl; /////////////////////////////////////////////// @@ -260,7 +379,7 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { // } for (Int_t x20 = 0; x20 < kSQL_20_strips; x20++) { - if (SQ20E[x20] > kSQL20_energy_thr && currThickness<30.) { + if (SQ20E[x20] > kSQL20_energy_thr/*SQ20timeMult==1*/ && currThickness<30.) { // SQ20Ecorr[x20] = SQ20E[x20] + 1.; // currThickness = kSQ20_norm_thickness + (currThickness - kSQ20_norm_thickness)*0.5; @@ -283,7 +402,7 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { } } - } + }//if for correction according energy multiplicity /////////////////////////////////////////////// @@ -329,15 +448,96 @@ void fillTree(Int_t nofile = 0, const Int_t noevents = 0) { } -// cout << endl; + + /////////////////////////////////////////////// + //position of hit in left telescope + /////////////////////////////////////////////// + + //reset + mapXbin = -1; + mapYbin = -1; + x1mm = -100.; + y1mm = -100.; + xThin = -100.; + yThin = -100.; + vHit1mm.SetXYZ(x1mm, y1mm, -1.); + angleLeft = TMath::Pi(); + + if (SQLXtimeMult==1) { + for (Int_t i = 0; i<32; i++) { + if (SQLXEtimeFiltered[i]>0) x1mm = -30. + (i+1/2)*60./32.; + } + } +// cout << SQLYtimeMult << endl; + + if (SQLYtimeMult==1) { + for (Int_t i = 0; i<16; i++) { + if (SQLYEtimeFiltered[i]>0) y1mm = -30. + (i+1/2)*60./16.; + } + } + + + if (SQLXtimeMult==1 && SQLYtimeMult==1 && xt>-50. && yt>-50.) { + vHit1mm.SetXYZ(x1mm-xt, y1mm-yt, z1mm); +// cout << vHit1mm.X() << "\t" << vHit1mm.Y() << endl; +// cout << "\t" << zThin/z1mm*vHit1mm.X() << "\t" << zThin/z1mm*vHit1mm.Y() << endl; + vHit1mm *= zThin/z1mm; +// cout << "\t" << vHit1mm.X() << "\t" << vHit1mm.Y() << "\t" << vHit1mm.Z() << endl; +// cout << "\t" << xt << "\t" << yt << "\t" << 0 << endl; +// cout << zThin/z1mm << endl; + angleLeft = vHit1mm.Angle(vNorm); +// xThin = vHit1mm.X()+xt; +// yThin = vHit1mm.Y()+yt; + +// cout << angleLeft << endl; + } + +// cout << angleLeft << endl; + +// cout << x1mm << "\t" << y1mm << endl; + +// cout << vHit1mm.X() << "\t" << vHit1mm.Y() << endl; + + + + if (SQLXtimeMult==1 && SQLYtimeMult==1 + && vHit1mm.X()+xt>-30. && vHit1mm.X()+xt<30. + && vHit1mm.Y()+yt>-30. && vHit1mm.Y()+yt<30.) { + mapYbin = (vHit1mm.Y()+yt+30.-0.5*60./16.)*16./60.; + mapXbin = (vHit1mm.X()+xt+30.-0.5*60./32.)*32./60.; + xThin = vHit1mm.X()+xt; + yThin = vHit1mm.Y()+yt; +// cout << "\t\t" << xThin << "\t" << yThin << endl; + +// cout << mapYbin << "\t" << "\t" << y1mm << "\t" << xt << endl; + + //calculation of corrected energy + currThickness = hThickness->GetBinContent(mapXbin+1, mapYbin+1); + for (Int_t x20 = 0; x20 < kSQL_20_strips; x20++) { + if (SQ20E[x20] > kSQL20_energy_thr/*SQ20timeMult==1*/ && currThickness<30.) { + SQ20EcorrHit[x20] = (kSQ20_norm_thickness/currThickness)*SQ20E[x20]; + SQ20EcorrHitMult++; +// cout << mapXbin << "\t" << mapYbin << "\t" << x20 +// << "\t" << currThickness +// << "\t" << SQ20E[x20] << "\t" << SQ20EcorrHit[x20] << "\t" << endl; + + } + }//for*/ + + }//if inside the map + +// cout << mapYbin << "\t" << "\t" << y1mm << endl; +// cout << mapXbin << "\t" << xThin << "\t" << x1mm << endl; + + +// cout << mapXbin << "\t" << mapYbin << endl; tw->Fill(); -// cout << eventNo << "\t" << eventNo%100 << endl; if (eventNo%100000 == 0 && eventNo !=0) { cout << eventNo << " events processed." << endl; } - } + }//for events cout << nevents << " entries processed." << endl; diff --git a/analysis/showBananas2.cxx b/analysis/showBananas2.cxx index 5b2050b..549c902 100644 --- a/analysis/showBananas2.cxx +++ b/analysis/showBananas2.cxx @@ -6,21 +6,24 @@ #include "TBox.h" #include "TCut.h" #include "TCutG.h" +#include "TStopwatch.h" using std::cout; using std::endl; -void showBananas2(const Long64_t drawEntries = 100000) { +void showBananas2() { + + 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/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/h5_14_0?_calib.root"); trCal->Add("~/data/exp1804/be10_0?_?0_calib.root"); tr->AddFriend(trCal); @@ -53,56 +56,91 @@ void showBananas2(const Long64_t drawEntries = 100000) { TString varName; TString condition; - cout << drawEntries << " entries in input chain will be processed." << endl; +// cout << drawEntries << " entries in input chain will be processed." << endl; + + TString timeSiLeftCondition; + timeSiLeftCondition.Form("(SQLXtime[0]>0"); + for (Int_t j = 1; j<32; j++) { + condition.Form("|| SQLXtime[%d]>0", j); + timeSiLeftCondition.Append(condition); + } + timeSiLeftCondition.Append(")"); - const Int_t firstThinStrip = 5; + Int_t firstThinStrip = 5; + + + TStopwatch stopwatch; + stopwatch.Start(); ///////////////////////////////////////////////////////////////////// // c1 - /*TCanvas *c1 = new TCanvas("c1", "time issues", 1600, 800); - c1->Divide(4,2); + /*TCanvas *c1 = new TCanvas("c1", "time in thin detector", 1600, 1200); + c1->Divide(4,4); - for (Int_t i = 0; i < 8; i++) { - c1->cd(i+1); -// varName.Form("SQ20E[%d]:SQLYEsum", i+firstThinStrip); - varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", i+firstThinStrip, i+firstThinStrip); - condition.Form("SQ20E[%d]>0 && SQ20E[%d]<14 && SQLYEsum>0. && SQLYEsum<120. && SQLYE[0]<1. && SQLYE[15]<1.", i+firstThinStrip, i+firstThinStrip); + firstThinStrip = 0; - varName.Form("SQX_L[%d]:tSQX_L[%d]", i+firstThinStrip, i+firstThinStrip); - condition.Form("tSQX_L[%d]>0 && SQX_L[%d]>0", i+firstThinStrip, i+firstThinStrip); + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 10000000; + cout << drawEntries << " entries in input chain will be processed." << endl; + + for (Int_t i = 0; i < 16; i++) { + c1->cd(i+1); + varName.Form("SQ20E[%d]:tSQ20[%d]*0.3", i+firstThinStrip, i+firstThinStrip); + condition.Form("tSQ20[%d]>0 && SQ20E[%d]>1.2", i+firstThinStrip, i+firstThinStrip); tr->SetMarkerColor(kBlack); tr->SetMarkerStyle(20); tr->SetMarkerSize(0.1); - tr->Draw(varName, condition, "", drawEntries); + tr->Draw(varName, condition, "col", drawEntries); c1->Update(); - } - return;*/ + }//*/ + +// return; ///////////////////////////////////////////////////////////////////// // c2 - /*TCanvas *c2 = new TCanvas("c2", "1 mm Y: 8-15 zoomed", 1600, 800); - c2->Divide(4,2); + /*TCanvas *c2 = new TCanvas("c2", "time issues in 32 X-strips: 0-15", 1600, 1200); + c2->Divide(4,4); - for (Int_t i = 0; i < 8; i++) { + firstThinStrip = 0; + Int_t conTimeMult = 1; + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 1000000; + cout << drawEntries << " entries in input chain will be processed." << endl; + + for (Int_t i = 0; i < 16; i++) { c2->cd(i+1); - varName.Form("SQ20E[%d]:SQLYEsum", i+firstThinStrip); - varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", i+firstThinStrip, i+firstThinStrip); - 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+firstThinStrip, i+firstThinStrip); - tr->SetMarkerColor(kBlack); + + varName.Form("SQLXE[%d]:0.3*tSQX_L[%d]", i+firstThinStrip, i+firstThinStrip); + condition.Form("0.3*tSQX_L[%d]>200 && 0.3*tSQX_L[%d]<500 && SQLXE[%d]>0", i+firstThinStrip, i+firstThinStrip, i+firstThinStrip); + + tr->SetMarkerColor(kRed); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(.4); tr->Draw(varName, condition, "col", drawEntries); -// tr->Draw(varName, condition, "", drawEntries); - tAlphaCal->Draw(varName, "", "same"); + varName.Form("SQLXE[%d]:SQLXtime[%d]", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQLXtime[%d]>0 && SQLXE[%d]>0 && SQLXtimeMult==%d", + i+firstThinStrip, i+firstThinStrip, conTimeMult); + + varName.Form("SQLXEtimeFiltered[%d]:0.3*tSQX_L[%d]", i+firstThinStrip, i+firstThinStrip); + condition.Form("0.3*tSQX_L[%d]>200 && 0.3*tSQX_L[%d]<500 && SQLXEtimeFilteredSum>0 && SQLXtimeMult==%d", + i+firstThinStrip, i+firstThinStrip, conTimeMult); +// condition.Form("SQLXtimeSum>0 && SQLXtimeSum<470 && SQLXtimeMult==%d && %s", +// conTimeMult, timeSiLeftCondition.Data()); + + cout << condition << endl; + + tr->Draw(varName, condition, "same", drawEntries); + +// tAlphaCal->Draw(varName, "", "same"); c2->Update(); }//for */ @@ -111,173 +149,455 @@ void showBananas2(const Long64_t drawEntries = 100000) { // return; -///////////////////////////////////////////////////////////////////// -// c3 - TCanvas *c3 = new TCanvas("c3", "dE-E corrected", 1600, 800); - c3->Divide(4,2); +///////////////////////////////////////////////////////////////////// +// c2_1 - TF1 *f3 = new TF1("dEE", "log(1/x)-log(0.1)+1.6", 1, 30); - f3->SetLineColor(kRed); - f3->SetLineWidth(3); + /*TCanvas *c2_1 = new TCanvas("c2_1", "time issues in 32 X-strips: 16-31", 1600, 1200); + c2_1->Divide(4,4); - TF1 *f4 = new TF1("dEE", "log(1/x)-log(0.1)+1.98", 1, 30); - f4->SetLineColor(kGreen); - f4->SetLineWidth(3); + firstThinStrip = 16; - TF1 *f6 = new TF1("dEE", "log(1/x)-log(0.1)+2.66", 1, 30); - f4->SetLineColor(kBlue); - f4->SetLineWidth(3); + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 1000000; + cout << drawEntries << " entries in input chain will be processed." << endl; + for (Int_t i = 0; i < 16; i++) { + c2_1->cd(i+1); + varName.Form("SQLXE[%d]:0.3*tSQX_L[%d]", i+firstThinStrip, i+firstThinStrip); + condition.Form("0.3*tSQX_L[%d]>300 && 0.3*tSQX_L[%d]<600 && SQLXE[%d]>0", i+firstThinStrip, i+firstThinStrip, i+firstThinStrip); - for (Int_t i = 0; i < 8; i++) { - c3->cd(i+1); -// varName.Form("SQ20Ecorr[%d]:SQLYEsum", i+firstThinStrip); - 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->SetMarkerColor(kBlack); tr->Draw(varName, condition, "col", drawEntries); // tr->Draw(varName, condition, "", drawEntries); - tAlphaCal->Draw(varName, "", "same"); - -// f3->Draw("same"); -// f4->Draw("same"); -// f6->Draw("same"); + varName.Form("SQLXE[%d]:SQLXtime[%d]", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQLXtime[%d]>0 && SQLXE[%d]>0 && SQLXtimeMult==%d", i+firstThinStrip, i+firstThinStrip, conTimeMult); + tr->Draw(varName, condition, "same", drawEntries); - c3->Update(); - }//*/ + c2_1->Update(); + }//for */ - return; +// return; ///////////////////////////////////////////////////////////////////// - // c4 +// c3 + + /*TCanvas *c3 = new TCanvas("c3", "Multiplicity", 1600, 1200); + c3->Divide(2,2); - ///////////////////////////////////////////////////////////////////// - // c2 + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 10000000; + cout << drawEntries << " entries in input chain will be processed." << endl; + + + c3->cd(1); + varName.Form("SQ20timeMult"); + condition.Form("trigger==3 && SQ20timeMult>0"); + tr->Draw(varName, condition, "", drawEntries); + c3->Update(); + + c3->cd(2); + varName.Form("SQLXtimeMult"); + condition.Form("trigger==3 && SQLXtimeMult>0 && SQLXtimeMult<8"); + tr->Draw(varName, condition, "", drawEntries); + c3->Update(); + + c3->cd(3); + varName.Form("SQ20EcorrMult"); + condition.Form("trigger==3 && SQ20EcorrMult>0"); + tr->Draw(varName, condition, "", drawEntries); + c3->Update(); + + c3->cd(4); + varName.Form("SQLXmult"); + condition.Form("trigger==3 && SQLXmult>0"); + tr->Draw(varName, condition, "", drawEntries); + c3->Update(); + //*/ - TCanvas *c4 = new TCanvas("c4", "1 mm Y all: 8-15 zoomed", 1000, 900); +// return; + +///////////////////////////////////////////////////////////////////// +// c4 + + /*TCanvas *c4 = new TCanvas("c4", "time issues in 16 Y-strips", 1600, 1200); c4->Divide(4,4); + firstThinStrip = 0; + Int_t conTimeMult = 1; + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 1000000; + cout << drawEntries << " entries in input chain will be processed." << endl; + + Float_t timeCorr[16] = {0, -2, 0, 2, + -2.5, 5, -6, 4, + 7, 3, 3, 4, + 6, 4, -4, 13 + }; + + 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); + + + varName.Form("SQLYE[%d]:0.3*tSQY_L[%d]+%f", i+firstThinStrip, i+firstThinStrip, timeCorr[i]); + condition.Form("0.3*tSQY_L[%d]>300 && 0.3*tSQY_L[%d]<360 && SQLYE[%d]>0", i+firstThinStrip, i+firstThinStrip, i+firstThinStrip); + + tr->SetMarkerColor(kRed); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(.4); tr->Draw(varName, condition, "col", drawEntries); - // tr->Draw(varName, condition, "", drawEntries); +// tr->Draw(varName, condition, "", drawEntries); - tAlphaCal->Draw(varName, "", "same"); + varName.Form("SQLYEtimeFiltered[%d]:SQLYtime[%d]", i+firstThinStrip, i+firstThinStrip); +// condition.Form("SQLYtime[%d]>0 && SQLYE[%d]>0 && SQLYtimeMult==%d", +// i+firstThinStrip, i+firstThinStrip, conTimeMult); - c4->Update(); - }//for */ +// varName.Form("SQLYEtimeFiltered[%d]:0.3*tSQY_L[%d]", i+firstThinStrip, i+firstThinStrip); + condition.Form("0.3*tSQY_L[%d]>200 && 0.3*tSQY_L[%d]<500 && SQLYEtimeFilteredSum>0 && SQLYtimeMult==%d", + i+firstThinStrip, i+firstThinStrip, conTimeMult); + cout << condition << endl; + tr->Draw(varName, condition, "same", drawEntries); - return; +// varName.Form("SQLXE[%d]:SQLXtime[%d]", i+firstThinStrip, i+firstThinStrip); + condition.Form("0.3*tSQY_L[%d]+%f>325 && 0.3*tSQY_L[%d]+%f<333 && SQLYE[%d]>0", + i+firstThinStrip, timeCorr[i], i+firstThinStrip, timeCorr[i], i+firstThinStrip); +// +// varName.Form("SQLXEtimeFiltered[%d]:0.3*tSQX_L[%d]", i+firstThinStrip, i+firstThinStrip); +// condition.Form("0.3*tSQX_L[%d]>200 && 0.3*tSQX_L[%d]<500 && SQLXEtimeFilteredSum>0 && SQLXtimeMult==%d", +// i+firstThinStrip, i+firstThinStrip, conTimeMult); +// // condition.Form("SQLXtimeSum>0 && SQLXtimeSum<470 && SQLXtimeMult==%d && %s", +// // conTimeMult, timeSiLeftCondition.Data()); +// +// cout << condition << endl; +// + tr->SetMarkerColor(kRed); +// tr->Draw(varName, condition, "same", drawEntries); + // tAlphaCal->Draw(varName, "", "same"); + c4->Update(); + }//for */ - return; +// return; ///////////////////////////////////////////////////////////////////// // c5 - TCanvas *c5 = new TCanvas("c4", "MWPC", 1000, 1000); - c5->Divide(2,2); + TCanvas *c5 = new TCanvas("c5", "Multiplicity", 1400, 900); + c5->Divide(3,3); + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 10000000; + cout << drawEntries << " entries in input chain will be processed." << endl; - 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"); +// varName.Form("SQ20timeMult"); +// condition.Form("trigger==3 && SQ20timeMult>0"); + tr->Draw("angleLeft", "angleLeft<3", "", drawEntries); 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); + varName.Form("SQLYtimeMult"); + condition.Form("trigger==3 && SQLYtimeMult>0 && SQLYtimeMult<8"); + tr->Draw(varName, condition, "", drawEntries); 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); + varName.Form("y1mm:x1mm>>h(32, -30., 30, 16, -30., 30)"); + condition.Form("trigger==3 && y1mm>-80. && x1mm>-80."); + tr->Draw(varName, condition, "col", drawEntries); + c5->Update(); + + c5->cd(4); + varName.Form("mapXbin"); + condition.Form("trigger==3 && mapXbin>-1"); + tr->Draw(varName, condition, "col", drawEntries); + c5->Update(); + + c5->cd(5); + varName.Form("mapYbin"); + condition.Form("trigger==3 && mapYbin>-1"); + tr->Draw(varName, condition, "col", drawEntries); + c5->Update(); + + c5->cd(6); + varName.Form("yThin:xThin"); + condition.Form("trigger==3 && yThin>-80. && xThin>-80."); +// condition.Form("yThin>-80. && xThin>-80."); + tr->Draw(varName, condition, "col", drawEntries); + + TBox *boxThinDet = new TBox(25., -25., -25., 25.); + boxThinDet->SetLineColor(kRed); + boxThinDet->SetLineWidth(3); + boxThinDet->SetFillStyle(0); + boxThinDet->Draw("same"); + c5->Update(); + + c5->cd(7); +// varName.Form("nx1"); +// condition.Form("nx1>0 && nx1<10"); +//// condition.Form("yThin>-80. && xThin>-80."); +// tr->Draw(varName, condition, "col", drawEntries); + + tr->Draw("dEbeam:TOF>>IDplot(200,,,200,,)", "TOF<400 && TOF>0 && dEbeam < 4000 && trigger==1", "col", 1000000); +// tr->Draw("dEbeam:TOF>>IDplot(200,,,200,,)", " trigger==1", "col", 1000000); + TBox *beamBox = new TBox(156, 2300, 165, 1800); beamBox->SetFillStyle(0); beamBox->SetLineWidth(3); beamBox->SetLineColor(kRed); beamBox->Draw(); c5->Update(); + c5->cd(8); + varName.Form("ny1"); + condition.Form("ny1>0 && ny1<10"); + tr->Draw(varName, condition, "", drawEntries); + c5->Update(); + + condition.Form("ny1>0 && ny1<10 && TOF>156 && TOF<165 && dEbeam > 1800 && dEbeam<2300 && trigger==1"); +// condition.Form("yThin>-80. && xThin>-80."); + tr->Draw(varName, condition, "same", drawEntries); + c5->Update(); + + c5->cd(9); + varName.Form("yt:xt"); + condition.Form("trigger==3"); +// condition.Form("yThin>-80. && xThin>-80."); + tr->Draw(varName, condition, "col", drawEntries); + + + //*/ + + return; + ///////////////////////////////////////////////////////////////////// -// c6 +// c9 + + /*TCanvas *c9 = new TCanvas("c9", "dE-E uncorrected", 1600, 800); + c9->Divide(4,2); - 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."); + firstThinStrip = 5; - c6->cd(1); - tr->Draw("SQ20E[0]:SQ20E[0]+SQLYEsum>>(200,0,5,200,0,5)", "", "", 100); + Int_t drawnEvents1[8]; + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 10000000; + Long64_t drawEntriesCorrected = 20000000; + cout << drawEntries << " entries in input chain will be processed." << endl; 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.", + c9->cd(i+1); + varName.Form("SQ20E[%d]:SQ20E[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " +// "&& SQLXtimeMult==1" + "&& trigger==3", i+firstThinStrip, i+firstThinStrip); + tr->SetMarkerColor(kRed); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(.4); 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); + varName.Form("SQ20E[%d]:SQ20E[%d]+SQLXEtimeFilteredSum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " + "&& SQLXtimeMult==1" +// "&& %s" + "&& SQLXEtimeFilteredSum>0" + "&& trigger==3", + i+firstThinStrip, i+firstThinStrip); + + drawnEvents1[i] = tr->Draw(varName, condition, "same", drawEntriesCorrected); +// cout << "noevents in strip " << i << ": " << drawnEvents << endl; + + + + c9->Update(); + }//*/ + +// return; + +///////////////////////////////////////////////////////////////////// +// c10 + + /*TCanvas *c10 = new TCanvas("c10", "dE-E corrected", 1600, 800); + c10->Divide(4,2); + + Int_t drawnEvents2[8]; + + firstThinStrip = 5; + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 10000000; +// drawEntriesCorrected = 100000000; + drawEntriesCorrected = drawEntriesCorrected/0.4; + cout << drawEntries << " entries in input chain will be processed." << endl; + + for (Int_t i = 0; i < 8; i++) { + c10->cd(i+1); + + varName.Form("SQ20Ecorr[%d]:SQ20Ecorr[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20Ecorr[%d]>1.2 && SQ20Ecorr[%d]<5 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " +// "&& SQLXtimeMult==1" + "&& trigger==3", + i+firstThinStrip, i+firstThinStrip); + tr->Draw(varName, condition, "col", drawEntries); + c10->Update(); + tr->SetMarkerStyle(20); - tr->SetMarkerSize(.5); + tr->SetMarkerSize(.4); + tr->SetMarkerColor(kRed); + + varName.Form("SQ20Ecorr[%d]:SQ20Ecorr[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20Ecorr[%d]>1.2 && SQ20Ecorr[%d]<5 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " +// "&& SQLXtimeMult==1" +// "&& SQLXEtimeFilteredSum>0" + "&& trigger==3", + i+firstThinStrip, i+firstThinStrip); tr->Draw(varName, condition, "same", drawEntries); - c6->Update(); + c10->Update(); + + tr->SetMarkerColor(kGreen); +// tr->SetMarkerColor(kRed); + varName.Form("SQ20EcorrHit[%d]:SQ20EcorrHit[%d]+SQLXEtimeFilteredSum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20EcorrHit[%d]>1.2 && SQ20EcorrHit[%d]<5 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " + "&& SQLXtimeMult==1" + "&& SQLXEtimeFilteredSum>0.5" + "&& trigger==3", + i+firstThinStrip, i+firstThinStrip); + drawnEvents2[i] = tr->Draw(varName, condition, "same", drawEntriesCorrected); + + +// tAlphaCal->Draw(varName, "", "same"); + + c10->Update(); } + for (Int_t i = 0; i < 8; i++) { + cout << "noevents in strip " << i+firstThinStrip << ": " << drawnEvents1[i] << " (first choice)" << endl; + cout << "noevents in strip " << i+firstThinStrip << ": " << drawnEvents2[i] << " (second choice)" << endl; + }//*/ + + +// return; + + + ///////////////////////////////////////////////////////////////////// -// c7 +// c11 + + TCanvas *c11 = new TCanvas("c11", "dE-E uncorrected", 1600, 800); + c11->Divide(4,2); + + firstThinStrip = 5; - 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."); + Int_t drawnEvents1[8]; + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 1000000000; + cout << drawEntries << " entries in input chain will be processed." << endl; for (Int_t i = 0; i < 8; i++) { - c7->cd(i+1); + c11->cd(i+1); varName.Form("SQ20E[%d]:SQ20E[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); - condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 " + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5 " "&& SQLXEsum>1.1 && SQLXEsum<30 " - "&& %s && %s" - , i+firstThinStrip, i+firstThinStrip, cStripsLow.Data(), cStripsHigh.Data()); + // "&& SQLXtimeMult==1" + "&& trigger==3", + i+firstThinStrip, i+firstThinStrip); + tr->SetMarkerColor(kRed); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(.4); tr->Draw(varName, condition, "col", drawEntries); - c7->Update(); - } + c11->Update(); + }//*/ + + // return; + +///////////////////////////////////////////////////////////////////// +// c12 + + TCanvas *c12 = new TCanvas("c12", "dE-E corrected (first approximation)", 1600, 800); + c12->Divide(4,2); + + Int_t drawnEvents2[8]; + + firstThinStrip = 5; + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 1000000000; + cout << drawEntries << " entries in input chain will be processed." << endl; + + for (Int_t i = 0; i < 8; i++) { + c12->cd(i+1); + + varName.Form("SQ20Ecorr[%d]:SQ20Ecorr[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20Ecorr[%d]>1.2 && SQ20Ecorr[%d]<5 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " + // "&& SQLXtimeMult==1" + "&& trigger==3", + i+firstThinStrip, i+firstThinStrip); + + tr->Draw(varName, condition, "col", drawEntries); + }//*/ + +// return; + +///////////////////////////////////////////////////////////////////// +// c13 + + TCanvas *c13 = new TCanvas("c13", "dE-E corrected (second approximation)", 1600, 800); + c13->Divide(4,2); + + firstThinStrip = 5; + + cout << tr->GetEntries() << " events." << endl; + cout << trCal->GetEntries() << " calibrated events." << endl; + drawEntries = 1000000000; + cout << drawEntries << " entries in input chain will be processed." << endl; + + for (Int_t i = 0; i < 8; i++) { + c13->cd(i+1); + + varName.Form("SQ20EcorrHit[%d]:SQ20EcorrHit[%d]+SQLXEtimeFilteredSum", i+firstThinStrip, i+firstThinStrip); + condition.Form("SQ20EcorrHit[%d]>1.2 && SQ20EcorrHit[%d]<5 " + "&& SQLXEsum>1.1 && SQLXEsum<30 " + "&& SQLXtimeMult==1" + "&& SQLXEtimeFilteredSum>0.5" + "&& trigger==3", + i+firstThinStrip, i+firstThinStrip); + + + tr->Draw(varName, condition, "col", drawEntries); + c13->Update(); + + }//*/ + + cout << "Finished in "<< stopwatch.RealTime() << " seconds" << endl; + cout << "Finished in "<< stopwatch.RealTime()/60. << " minutes" << endl; return; diff --git a/analysis/showTritium.cxx b/analysis/showTritium.cxx index 0d432e9..c19182b 100644 --- a/analysis/showTritium.cxx +++ b/analysis/showTritium.cxx @@ -28,12 +28,6 @@ void showTritium(const Long64_t drawEntries = 100000) 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"); @@ -44,9 +38,6 @@ void showTritium(const Long64_t drawEntries = 100000) TCutG *cBR = (TCutG*)fc->Get("cBeamRight"); -// const Int_t drawEntries = 6000000; -// const Int_t drawEntries = tr->GetEntries(); - tr->GetListOfFiles()->Print(); trCal->GetListOfFiles()->Print(); @@ -102,7 +93,7 @@ void showTritium(const Long64_t drawEntries = 100000) ///////////////////////////////////////////////////////////////////// // c2 - /*TCanvas *c2 = new TCanvas("c2", "time from right Si", 1600, 800); + TCanvas *c2 = new TCanvas("c2", "time from right Si", 1600, 800); c2->Divide(4,2); for (Int_t i = 0; i < 8; i++) { @@ -142,7 +133,7 @@ void showTritium(const Long64_t drawEntries = 100000) ///////////////////////////////////////////////////////////////////// // c3 - /*TCanvas *c3 = new TCanvas("c3", "time from CsI", 1000, 900); + TCanvas *c3 = new TCanvas("c3", "time from CsI", 1000, 900); c3->Divide(4,4); // gROOT->ProcessLine(".x cutPokus.cxx"); @@ -210,7 +201,7 @@ void showTritium(const Long64_t drawEntries = 100000) c4->Update(); }//*/ - return; +// return; ///////////////////////////////////////////////////////////////////// // c5 @@ -288,54 +279,6 @@ void showTritium(const Long64_t drawEntries = 100000) } - 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; } diff --git a/analysis/showTritiumReport.cxx b/analysis/showTritiumReport.cxx new file mode 100644 index 0000000..22be749 --- /dev/null +++ b/analysis/showTritiumReport.cxx @@ -0,0 +1,298 @@ +#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 showTritiumReport(const Long64_t drawEntries = 1000000) +{ + 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_14_0?_calib.root"); + trCal->Add("~/data/exp1804/be10_0?_?0_calib.root"); + + tr->AddFriend(trCal); + + 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"); + + + 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; + + Int_t firstThinStrip = 4; + + TFile *fCutsTime = new TFile("cutsTimeCsI.root"); + TFile *fCutsTritium = new TFile("cutsDeltaEtritium.root"); + TFile *fCutsHelium = new TFile("cutsDeltaEhelium.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, 400); + c1->Divide(4,1); + + for (Int_t i = 0; i < 4; 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, "", 10000000); + c1->Update(); + }//*/ +// return; + +///////////////////////////////////////////////////////////////////// +// c2 + + /*TCanvas *c2 = new TCanvas("c2", "time from right Si", 1600, 400); + c2->Divide(4,1); + + firstThinStrip = 14; + + for (Int_t i = 0; i < 4; i++) { + c2->cd(i+1); + varName.Form("SQRXE[%d]:0.3*tSQX_R[%d]-0.125*tF5[0]", i+firstThinStrip, i+firstThinStrip); + condition.Form("tSQX_R[%d]>1" + "&& trigger==3" + "&& (0.3*tSQX_R[%d]-0.125*tF5[0])<250", + i+firstThinStrip, i+firstThinStrip); + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "", drawEntries); + + condition.Form( + "trigger==3 && %s", + timeSiCondition.Data()); + + tr->SetMarkerColor(kRed); + tr->Draw(varName, condition, "same", 10000000); + + c2->Update(); + }//for */ + +// return; + +///////////////////////////////////////////////////////////////////// +// c3 + + /*TCanvas *c3 = new TCanvas("c3", "time from CsI", 1600, 400); + c3->Divide(4,1); + + firstThinStrip = 4; + + for (Int_t i = 0; i < 4; i++) { + c3->cd(i+1); + 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+firstThinStrip, i+firstThinStrip); + 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] < 8500", + i+firstThinStrip, i+firstThinStrip, + i+firstThinStrip, i+firstThinStrip); + + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "", 10000000); + + currCut->Draw("same"); + + c3->Update(); + }//*/ + +// return; + +///////////////////////////////////////////////////////////////////// + // c4 + + /*TCanvas *c4 = new TCanvas("c4", "PID plot from CsI filtered for time", 1600, 400); + c4->Divide(4,1); + + firstThinStrip = 8; + + for (Int_t i = 0; i < 4; 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, "", 100000000); + + cutName.Form("cutEnergy%d", i+firstThinStrip); + currCut = (TCutG*)fCutsTritium->Get(cutName); + + currCut->Draw("same"); + + c4->Update(); + }//*/ + +// return; + +///////////////////////////////////////////////////////////////////// +// c5 + + TCanvas *c5 = new TCanvas("c5", "dE-E left telescope corrected", 1600, 400); + c5->Divide(4,1); + + firstThinStrip = 4; + + for (Int_t i = 0; i < 4; i++) { + c5->cd(i+1); + // varName.Form("SQ20Ecorr[%d]:SQLYEsum", i+firstThinStrip); + 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", 10000000000); + + cutName.Form("cutHe%d", i+firstThinStrip); + currCut = (TCutG*)fCutsHelium->Get(cutName); + + currCut->Draw("same"); + + c5->Update(); + }//*/ + + return; + +///////////////////////////////////////////////////////////////////// +// c6 + + TCanvas *c6 = new TCanvas("c6", "3He-3H coincidences", 1600, 400); + c6->Divide(4,1); + + firstThinStrip = 12; + + 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++) numberOfHe[i] = -1; + + for (Int_t i = 0; i < 4; i++) { + c6->cd(i+1); + + cutName.Form("cTime%d", i+firstThinStrip); + currCut = (TCutG*)fCutsTime->Get(cutName); + + cutNameTritium.Form("cutEnergy%d", i+firstThinStrip); + currCutTritium = (TCutG*)fCutsTritium->Get(cutNameTritium); + + 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->SetMarkerStyle(20); + tr->SetMarkerSize(.2); + tr->Draw(varName, condition, "", 100000000); + // 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"); + c6->Update(); + + condition.Form("NeEvent.CsI_R[%d]<3500" + "&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1" + "&& trigger==3 && %s && %s && %s && %s", + i+firstThinStrip, + cutName.Data(), timeSiCondition.Data(), cutNameTritium.Data(), cutHe.Data()); + tr->SetMarkerColor(kRed); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(1); + numberOfHe[i+firstThinStrip] = tr->Draw(varName, condition, "same", 100000000); + cout << "CsI number " << i+firstThinStrip << ": " << numberOfHe[i+firstThinStrip] << " events" << endl; + + c6->Update(); + } + + cout << endl << endl; + + for (Int_t i = 0; i < 16; i++) { + cout << "CsI number " << i << ": " << numberOfHe[i] << " events" << endl; + }//*/ + + +// return; + +} -- 2.18.1