From 7df3a32999fb8fcc76c63ed21216cbd05b62a9fa Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Sat, 16 Jun 2018 01:47:56 +0300 Subject: [PATCH] Macros used for analysis added. --- analysis/cutsIdentification.root | Bin 0 -> 8038 bytes analysis/fillChain.cxx | 349 +++++++++++++++++++++++++++++++ analysis/openChain.cxx | 17 ++ analysis/showBananas.cxx | 274 ++++++++++++++++++++++++ analysis/showBananas2.cxx | 289 +++++++++++++++++++++++++ analysis/showBeam.cxx | 132 ++++++++++++ 6 files changed, 1061 insertions(+) create mode 100644 analysis/cutsIdentification.root create mode 100644 analysis/fillChain.cxx create mode 100644 analysis/openChain.cxx create mode 100644 analysis/showBananas.cxx create mode 100644 analysis/showBananas2.cxx create mode 100644 analysis/showBeam.cxx diff --git a/analysis/cutsIdentification.root b/analysis/cutsIdentification.root new file mode 100644 index 0000000000000000000000000000000000000000..1c831010090de62da86b50db93bf07dc9280e7aa GIT binary patch literal 8038 zcmb`M2UJsAm&XHv1SEvsd+!j6bcBd>5JY+ny-ODm1!4e^j#34r3MfU2)Q9xmdslj| zD$*1(!T099nf1-g_r00PS~t0C-F0@(J^Oe6_w4`na(DLu0QN%x0Dvt3z+?{qQ0HLI zwJ--Z=Fr8#d|?3q1eyQ6;s*0{~Lj z0k8iJ0KnB#c5=0&vhnrtRv~@Q?F9htbtH3xksi$Kt|RIG zdqe<$5&NG_6Z^yUY;a>SF(?6Izh?9GdOWV4qOXq%p^b#ThlicleMc)>cRySeFDnm6 z6HPonY(Ok7z#q#Sf!Mc3cp(sjwg^uILI;7sxy_8QM=URCi4zHMs|ws0Qq}Aga_|*W z=kEc$TSg$TZ!3fBnbQe7tb_1vJ&~Q%`*hR_3aO*;m9fVKkCutSG!_&mD7uGI+|rTW zyeW(ibxg(NKN;+oqwbD8amvg{hlbY|x^UGdNu_><1X}w0WKp<__hu6pi13+mwU?uJ?)UQK$4q1pM5fb?|K!@0Y?lP-laMJN3S4U(Jb zsN4qyU!;*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A8X!q>^CTl*{dH-05w*U7>0uk5d3 z0nYx&{(0MV_P<8|%6{^n+2^~?z67_ZT;3n)FA6~+@wvNuS|GMnShLXsLP&l=;wa>3 z6A}xjj)sB!Gr`qaVp9jwuT$-f@gWEO+1Y)ZIA34M9?7zX`L*HY?76`vxyy<;)ZN}V z9sD#P6l7TCHc59^lA8VMoY~;44gLdBaPKsY0lGs1ws@Z)0~954Jn~KU=6J$KA4<{Z zW^leZ8+-~>@mp662e#$V9gC8QLVFIR<$)2t_w3hh$GOLH6GS&WiRrlWI$K)eS6WI&E#AHG zUT9UVuG=!nCjJjTDx=QInrEei#Y%SDhcOQRcUb>7I(W59;xW=-drb!x-(LcY>7o8| rt^Q|q!TA3ewElK86*J~Get("AnalysisxTree"); + + TNeEvent *revent = new TNeEvent(); + + tr->SetBranchAddress("NeEvent.", &revent); + + TFile *fw = new TFile(outFile, "RECREATE"); + TTree *tw = new TTree("cal", "Calibrated information"); + + Float_t SQ20E[16]; + Float_t SQ20Ecorr[16]; + Float_t SQ20Esum; + Float_t SQLXE[32]; + Float_t SQLXEsum; + Float_t SQLYE[16]; + Float_t SQLYEsum; + + Int_t SQLXmult; + Int_t SQLYmult; + Int_t SQ20EcorrMult; + + Float_t SQRXE[32]; + Float_t SQRXEsum; + Int_t SQRXmult; + Float_t TOF, dEbeam; + Float_t x1p, y1p, x2p, y2p, xt, yt; + + tw->Branch("SQ20E",SQ20E,"SQ20E[16]/F"); + tw->Branch("SQ20Ecorr",SQ20Ecorr,"SQ20Ecorr[16]/F"); + tw->Branch("SQ20Esum",&SQ20Esum,"SQ20Esum/F"); + tw->Branch("SQLXE",SQLXE,"SQLXE[32]/F"); + tw->Branch("SQLXEsum",&SQLXEsum,"SQLXE/F"); + tw->Branch("SQLYE",SQLYE,"SQLYE[16]/F"); + tw->Branch("SQLYEsum",&SQLYEsum,"SQLYEsum/F"); + + tw->Branch("SQLXmult",&SQLXmult,"SQLXmult/I"); + tw->Branch("SQLYmult",&SQLYmult,"SQLYmult/I"); + tw->Branch("SQ20EcorrMult",&SQ20EcorrMult,"SQ20EcorrMult/I"); + + tw->Branch("SQRXE",SQRXE,"SQRXE[32]/F"); + tw->Branch("SQRXEsum",&SQRXEsum,"SQRXE/F"); + tw->Branch("SQRXmult",&SQRXmult,"SQRXmult/I"); + + tw->Branch("TOF", &TOF, "TOF/F"); + tw->Branch("dEbeam", &dEbeam, "dEbeam/F"); + + tw->Branch("x1p", &x1p, "x1p/F"); + tw->Branch("y1p", &y1p, "y1p/F"); + tw->Branch("x2p", &x2p, "x2p/F"); + tw->Branch("y2p", &y2p, "y2p/F"); + + tw->Branch("xt", &xt, "xt/F"); + tw->Branch("yt", &yt, "yt/F"); + + + Long64_t nevents; + if (noevents == 0) nevents = tr->GetEntries(); + else nevents = noevents; + if (nevents > tr->GetEntries()) nevents = tr->GetEntries(); + +// TNeDet16 *pSQX_L_EC = new TNeDet16("SQX_L_EC"); +// TNeDet16 pSQX_L_EC("../SQX_L_EC"); + TNeDet16 pSQX_L_EC("./SQX_L"); + pSQX_L_EC.ReadData(); + + TNeDet16 pSQX_L_TC("./SQX_L_time"); + pSQX_L_TC.ReadData(); + + TNeDet16 pSQY_L_EC("./SQY_L"); + pSQY_L_EC.ReadData(); + + TNeDet16 pSQX_R_EC("../SQX_R_EC"); + pSQX_R_EC.ReadData(); + + TNeDet16 pSQ20_EC("./sq20_58"); + pSQ20_EC.ReadData(); + +// for (Int_t i = 0; i < 32; i++) { +// cout << pSQX_L_EC.Energy(1, i) << endl; +// } + + Float_t energy = 0; + + cout << nevents << " entries will be treated." << endl; + +// TFile fThickness("thicknessPreliminary.root", "OPEN"); + TFile fThickness("thicknessFinal.root", "OPEN"); + fr->cd(); + TH2F *hThickness = new TH2F(*(TH2F*)fThickness.Get("hTh")); + hThickness->Draw("col"); + +// std::cout << std::setprecision(1) << std::fixed; + + + const Int_t kSQL_X_strips = 32; + const Int_t kSQL_Y_strips = 16; + const Int_t kSQL_20_strips = 16; + + const Double_t kSQLY_energy_thr = 1.; + const Double_t kSQLX_energy_thr = 1.; + const Double_t kSQL20_energy_thr = 1.2; + + const Double_t kSQ20_norm_thickness = 20.; + +// for (Int_t yi = 0; yi < kSQL_Y_strips; yi++) { +// cout << "y bin: " << yi+1 << "\t\t"; +// for (Int_t xi = 0; xi < kSQL_X_strips; xi++) { +// cout << hThickness->GetBinContent(xi+1, yi+1) << "\t"; +// if (xi == kSQL_X_strips-1) cout << endl; +// } +// } + + + 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++) { + tr->GetEvent(eventNo); +// cout << revent->SQX_L[0] << endl; +// SQLXE[0] = revent->SQX_L[0]; + + SQ20Esum = 0.; + SQLXEsum = 0.; + SQLYEsum = 0.; + SQRXEsum = 0.; + SQRXmult = 0; + + SQLXmult = 0; + SQLYmult = 0; + SQ20EcorrMult = 0; + + + for (Int_t i = 0; i < 32; i++) { +// cout << pSQX_L_EC.Energy(1, i) << endl; + SQLXE[i] = 0; + SQRXE[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) { + SQLXE[i] = energy; + SQLXEsum += SQLXE[i]; + SQLXmult++; + } + + energy = pSQX_R_EC.Energy(revent->SQX_R[i], i); + + if (energy > 1.0) { + SQRXE[i] = energy; + SQRXEsum += SQRXE[i]; + SQRXmult++; + } + } + + for (Int_t i = 0; i < 16; i++) { + // cout << pSQX_L_EC.Energy(1, i) << endl; + + SQLYE[i] = 0.; + SQ20E[i] = 0.; + SQ20Ecorr[i] = 0.; + // SQRXE[i] = 0; + + energy = pSQ20_EC.Energy(revent->SQ20[i], i); + +// if (energy > 1.) { + SQ20E[i] = energy; + SQ20Esum += SQ20E[i]; +// cout << energy << endl; +// cout << i << "\t" << energy << "\t" << pSQ20_EC.a[i][0] << "\t" << pSQ20_EC.a[i][1] << "\t" << pSQ20_EC.a[i][2] << endl; +// } + + + if (i==0) continue; + + energy = pSQY_L_EC.Energy(revent->SQY_L[i], i); + + // cout << energy << "\t" << pSQY_L_EC.a[i][0] << "\t" << pSQY_L_EC.a[i][1] << "\t" << pSQY_L_EC.a[i][2] << endl; + // cout << energy << endl; + + if (energy > kSQLY_energy_thr) { + SQLYE[i] = energy; + SQLYEsum += SQLYE[i]; + SQLYmult++; + } + + // energy = pSQX_R_EC.Energy(revent->SQX_R[i], i); + // + // if (energy > 1.0) { + // SQRXE[i] = energy; + // SQRXEsum += SQRXE[i]; + // SQRXmult++; + // } + }//for 16 + +// cout << endl; + + /////////////////////////////////////////////// + //correction for thickness inhomogeneity + /////////////////////////////////////////////// + + Double_t currThickness; + + if (SQLXmult == 1 && SQLYmult == 1) { + + for (Int_t yi = 0; yi < kSQL_Y_strips; yi++) { + // cout << "y bin: " << yi+1 << "\t\t"; + if (SQLYE[yi]>kSQLY_energy_thr) { + + for (Int_t xi = 0; xi < kSQL_X_strips; xi++) { + + if (SQLXE[xi] > kSQLX_energy_thr) { + currThickness = hThickness->GetBinContent(xi+1, yi+1); +// if (currThickness<30.) { +// Int_t probableThinStrip = xi-2/2; +// SQ20Ecorr[0] = +// } + + for (Int_t x20 = 0; x20 < kSQL_20_strips; x20++) { + if (SQ20E[x20] > kSQL20_energy_thr && currThickness<30.) { +// SQ20Ecorr[x20] = SQ20E[x20] + 1.; + +// currThickness = kSQ20_norm_thickness + (currThickness - kSQ20_norm_thickness)*0.5; + + SQ20Ecorr[x20] = (kSQ20_norm_thickness/currThickness)*SQ20E[x20]; + SQ20EcorrMult++; + +// cout << xi << "\t" << yi << "\t" << x20 +// << "\t" << currThickness +// << "\t" << SQ20E[x20] << "\t" << SQ20Ecorr[x20] << "\t" << endl; + } + }//for*/ + } + + + + // cout << hThickness->GetBinContent(xi+1, yi+1) << "\t"; + // if (xi == kSQL_X_strips-1) cout << endl; + } + } + } + + } + + + /////////////////////////////////////////////// + //beam diagnostics + /////////////////////////////////////////////// + + dEbeam = 0.; + TOF = 0.; + if (revent->tF5[0]>0 && revent->tF5[1]>0 && revent->tF5[2]>0 && revent->tF5[3]>0 + && revent->tF3[0]>0 && revent->tF3[1]>0 && revent->tF3[2]>0 && revent->tF3[3]>0 + && revent->F5[0]>0 && revent->F5[1]>0 && revent->F5[2]>0 && revent->F5[3]>0 +// && ( (revent->tF5[0]+revent->tF5[1]+revent->tF5[2]+revent->tF5[3]) - (revent->tF3[0]+revent->tF3[1]+revent->tF3[2]+revent->tF3[3]) )/4.*0.125+89.165<200 +// && ( (tF5[0]+tF5[1]+tF5[2]+tF5[3]) - (tF3[0]+tF3[1]+tF3[2]+tF3[3]) )/4.*0.125+89.165>100 +// && (F5[0]+F5[1]+F5[2]+F5[3])/4. < 2500 + ) { + dEbeam = (revent->F5[0]+revent->F5[1]+revent->F5[2]+revent->F5[3])/4.; + TOF = ( (revent->tF5[0]+revent->tF5[1]+revent->tF5[2]+revent->tF5[3]) - (revent->tF3[0]+revent->tF3[1]+revent->tF3[2]+revent->tF3[3]) )/4.*0.125+89.165; + } + + const Float_t l12 = 546.; + const Float_t lt = 270.; + + x1p = -100.; + y1p = -100.; + x2p = -100.; + y2p = -100.; + xt = -100.; + yt = -100.; + + if (revent->x1[0]<1000 && revent->y1[0]<1000 && revent->nx1==1 && revent->ny1==1) { + x1p = revent->x1[0]*1.25-20.; + y1p = revent->y1[0]*1.25-20.; + } + + if (revent->x2[0]<1000 && revent->y2[0]<1000 && revent->nx2==1 && revent->ny2==1) { + x2p = revent->x2[0]*1.25-20.; + y2p = revent->y2[0]*1.25-20.; + } + + if (x1p > -50. && y1p > -50. && x2p > -50. && y2p > -50.) { + xt = x1p - (x1p - x2p)*(l12/lt); + yt = y1p - (y1p - y2p)*(l12/lt); + } + + +// cout << endl; + + tw->Fill(); + +// cout << eventNo << "\t" << eventNo%100 << endl; + if (eventNo%100000 == 0 && eventNo !=0) { + cout << eventNo << " events processed." << endl; + } + } + + cout << nevents << " entries processed." << endl; + + fw->cd(); + tw->Write(); + fw->Close(); + +} + + +void fillChain(const Int_t from = 0, const Int_t to = 9, const Int_t noevents = 0) { + for (Int_t i = from; i <= to; i++) { + fillTree(i, noevents); + } +} diff --git a/analysis/openChain.cxx b/analysis/openChain.cxx new file mode 100644 index 0000000..3f2d4fb --- /dev/null +++ b/analysis/openChain.cxx @@ -0,0 +1,17 @@ +//void openChain(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"); + + + TChain *trCal = new TChain("cal"); +// trCal->Add("~/data/exp1804/h5_11_0?_calib.root"); + trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); + + tr->AddFriend(trCal); + + TFile *fcal = new TFile("~/data/exp1804/calib/si_20_03.root"); + +} diff --git a/analysis/showBananas.cxx b/analysis/showBananas.cxx new file mode 100644 index 0000000..5e77561 --- /dev/null +++ b/analysis/showBananas.cxx @@ -0,0 +1,274 @@ +#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 showBananas(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"); + + + TChain *trCal = new TChain("cal"); +// trCal->Add("~/data/exp1804/h5_11_0?_calib.root"); + trCal->Add("~/data/exp1804/h5_14_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"); + + +// 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 = 3; + +///////////////////////////////////////////////////////////////////// +// c1 + + TCanvas *c1 = new TCanvas("c1", "1 mm Y: all", 1600, 800); + c1->Divide(4,2); + + 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); + tr->SetMarkerColor(kBlack); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(0.1); + if (i<4) + tr->Draw(varName, condition, "", drawEntries); + if (i>3) + tr->Draw(varName, condition, "col", drawEntries); +// condition.Form("SQ20E[%d]>0 && SQ20E[%d]<14 && SQLYEsum>0. && SQLYEsum<120. && SQLYE[0]<1. && SQLYE[15]<1. && cBeamLeft", i+firstThinStrip, i+firstThinStrip); +// tr->SetMarkerColor(kRed); +// tr->SetMarkerSize(0.5); +// +// condition.Form("SQ20E[%d]>0 && SQ20E[%d]<14 && SQLYEsum>0. && SQLYEsum<120. && SQLYE[0]<1. && SQLYE[15]<1. && cBeamRight", i+firstThinStrip, i+firstThinStrip); +// tr->SetMarkerColor(kGreen); +// tr->SetMarkerSize(0.5); + c1->Update(); + } + +///////////////////////////////////////////////////////////////////// +// c2 + + 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++) { + 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.5 && SQLYEsum>1.1 && SQLYEsum<30 && SQLYE[0]<1. && SQLYE[15]<1.", i+firstThinStrip, i+firstThinStrip); + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "col", drawEntries); + c2->Update(); + } + + Int_t stripNb; + + return; + +///////////////////////////////////////////////////////////////////// +// c3 + + TCanvas *c3 = new TCanvas("c3", "1 mm Y: double-bananas cuts", 1000, 1000); + stripNb = 7; + varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", stripNb, stripNb); + condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 && SQLYEsum>1.1 && SQLYEsum<30 && SQLYE[0]<1. && SQLYE[15]<1.", stripNb, stripNb); + tr->SetMarkerColor(kBlack); + tr->Draw(varName, condition, "col", drawEntries); + c3->Update(); + cUS->Draw("same"); + cLS->Draw("same"); + cMA->Draw("same"); + c3->Update(); + +///////////////////////////////////////////////////////////////////// +// 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(); + +///////////////////////////////////////////////////////////////////// +// 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/showBananas2.cxx b/analysis/showBananas2.cxx new file mode 100644 index 0000000..a48eb18 --- /dev/null +++ b/analysis/showBananas2.cxx @@ -0,0 +1,289 @@ +#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 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"); + + + TChain *trCal = new TChain("cal"); +// trCal->Add("~/data/exp1804/h5_11_0?_calib.root"); + trCal->Add("~/data/exp1804/h5_14_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"); + + +// 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; + +///////////////////////////////////////////////////////////////////// +// c1 + + + /*TCanvas *c1 = new TCanvas("c1", "time issues", 1600, 800); + c1->Divide(4,2); + + 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); + + 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); + + + tr->SetMarkerColor(kBlack); + tr->SetMarkerStyle(20); + tr->SetMarkerSize(0.1); + tr->Draw(varName, condition, "", drawEntries); + c1->Update(); + } + return;*/ + +///////////////////////////////////////////////////////////////////// +// c2 + + 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++) { + 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); + tr->Draw(varName, condition, "col", drawEntries); +// tr->Draw(varName, condition, "", drawEntries); + + c2->Update(); + }//for */ + + + +// return; + +///////////////////////////////////////////////////////////////////// +// c3 + + TCanvas *c3 = new TCanvas("c3", "dE-E raw", 1600, 800); + c3->Divide(4,2); + + 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->Draw(varName, condition, "col", drawEntries); +// tr->Draw(varName, condition, "", drawEntries); + 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(); + +///////////////////////////////////////////////////////////////////// +// 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/showBeam.cxx b/analysis/showBeam.cxx new file mode 100644 index 0000000..a4d9d40 --- /dev/null +++ b/analysis/showBeam.cxx @@ -0,0 +1,132 @@ +#include "TSystem.h" +#include "TFile.h" +#include "TTree.h" +#include "TChain.h" +#include "TCanvas.h" + +using std::cout; +using std::endl; + +void showBeam(const Long64_t drawEntries = 100000) +{ + + TChain *tr = new TChain("AnalysisxTree"); +// tr->Add("~/data/exp1804/h5_14_0?.root"); +// tr->Add("~/data/exp1804/output.root"); + tr->Add("~/data/exp1804/h5_12.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"); + +// tr->AddFriend(trCal); + +// 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; + + +// TCanvas *c1 = new TCanvas("c1", "R: 0-7", 1600, 800); +// c1->Divide(4,2); + TCanvas *c1 = new TCanvas("beam", "beam info", 1200, 1200); + c1->Divide(2,2); + + c1->cd(1); +// tr->Draw("trigger", "", "", drawEntries); + + c1->cd(3); + +// af5 = (NeEvent->F5[0]+NeEvent->F5[1]+NeEvent->F5[2]+NeEvent->F5[3]+4.*gRandom->Uniform())/4. +// tf5 = (NeEvent->tF5[0]+NeEvent->tF5[1]+NeEvent->tF5[2]+NeEvent->tF5[3]+4.*gRandom->Uniform())/4.; +// tf3 = (NeEvent->tF3[0]+NeEvent->tF3[1]+NeEvent->tF3[2]+NeEvent->tF3[3]+4.*gRandom->Uniform())/4.; +// ToF = (tf5 - tf3)*0.125+89.165; +// af5:TOF +// tr->Draw("(NeEvent->F5[0]+NeEvent->F5[1]+NeEvent->F5[2]+NeEvent->F5[3])/4.", "", "", drawEntries); +// tr->Draw("(F5[0]+F5[1]+F5[2]+F5[3])/4.", "", "", drawEntries); +// tr->Draw("(tF5[0]+tF5[1]+tF5[2]+tF5[3])/4.;", "", "", drawEntries); +// tr->Draw("( (tF5[0]+tF5[1]+tF5[2]+tF5[3]) - (tF3[0]+tF3[1]+tF3[2]+tF3[3]) )/4.*0.125+89.165;", +// "tF5[0]>0 && tF5[1]>0 && tF5[2]>0 && tF5[3]>0 && tF3[0]>0 && tF3[1]>0 && tF3[2]>0 && tF3[3]>0", "", drawEntries); + tr->Draw("(F5[0]+F5[1]+F5[2]+F5[3])/4.:( (tF5[0]+tF5[1]+tF5[2]+tF5[3]) - (tF3[0]+tF3[1]+tF3[2]+tF3[3]) )/4.*0.125+89.165;", + "tF5[0]>0 && tF5[1]>0 && tF5[2]>0 && tF5[3]>0 " + "&& tF3[0]>0 && tF3[1]>0 && tF3[2]>0 && tF3[3]>0 " + "&& F5[0]>0 && F5[1]>0 && F5[2]>0 && F5[3]>0" + "&& ( (tF5[0]+tF5[1]+tF5[2]+tF5[3]) - (tF3[0]+tF3[1]+tF3[2]+tF3[3]) )/4.*0.125+89.165<200 " + "&& ( (tF5[0]+tF5[1]+tF5[2]+tF5[3]) - (tF3[0]+tF3[1]+tF3[2]+tF3[3]) )/4.*0.125+89.165>100" + "&& (F5[0]+F5[1]+F5[2]+F5[3])/4. < 2500" + "&& trigger==1", + "col", drawEntries); + TH2F *hTOF = (TH2F*)gPad->GetPrimitive("htemp"); + hTOF->SetStats(0); + hTOF->SetTitle(""); + hTOF->SetXTitle("TOF (ns)"); + hTOF->SetYTitle("dE (a.u.)"); + hTOF->GetXaxis()->CenterTitle(); + hTOF->GetXaxis()->SetTitleSize(0.06); + hTOF->GetXaxis()->SetTitleOffset(0.75); + hTOF->GetYaxis()->CenterTitle(); + hTOF->GetYaxis()->SetTitleSize(0.06); + hTOF->GetYaxis()->SetTitleOffset(0.75); + + c1->cd(2); + tr->Draw("(y1[0]-16)*1.25:(x1[0]-16.)*1.25>>hXY1(32, -20., 20., 32, -20., 20.)", "x1[1]<1000 && y1[1]<1000 && trigger==1 && nx1==1 && ny1==1", "col", drawEntries); +// tr->Draw("x2[0]", "x2[0]<1000 && nx2==1", "", drawEntries); + TH2F *h1 = (TH2F*)gPad->GetPrimitive("hXY1"); + h1->SetStats(0); + h1->SetTitle(""); + h1->SetXTitle("x1 (mm)"); + h1->SetYTitle("y1 (mm)"); + h1->GetXaxis()->CenterTitle(); + h1->GetXaxis()->SetTitleSize(0.06); + h1->GetXaxis()->SetTitleOffset(0.75); + h1->GetYaxis()->CenterTitle(); + h1->GetYaxis()->SetTitleSize(0.06); + h1->GetYaxis()->SetTitleOffset(0.75); + + c1->cd(4); + tr->Draw("(y2[0]-16)*1.25:(x2[0]-16.)*1.25>>hXY2(32, -20., 20., 32, -20., 20.)", "x2[0]<1000 && y2[0]<1000 && trigger==1", "col", drawEntries); + TH2F *h2 = (TH2F*)gPad->GetPrimitive("hXY2"); + h2->SetStats(0); + h2->SetTitle(""); + h2->SetXTitle("x2 (mm)"); + h2->SetYTitle("y2 (mm)"); + h2->GetXaxis()->CenterTitle(); + h2->GetXaxis()->SetTitleSize(0.06); + h2->GetXaxis()->SetTitleOffset(0.75); + h2->GetYaxis()->CenterTitle(); + h2->GetYaxis()->SetTitleSize(0.06); + h2->GetYaxis()->SetTitleOffset(0.75); + + + TCanvas *c2 = new TCanvas("c2", "Bugs in MWPC", 1200, 1200); + c2->Divide(2,2); + + c2->cd(1); +// tr->Draw("") + tr->Draw("x1[0]", "x2[0]<1000 && nx2==1", "", drawEntries); + tr->Draw("x1[0]", "nx1==0", "", drawEntries); + + c2->cd(2); + tr->Draw("y1[0]", "ny1==0", "", drawEntries); + + c2->cd(3); + tr->Draw("x2[0]", "nx2==0", "", drawEntries); + + c2->cd(4); + tr->Draw("y2[0]", "ny2==0", "", drawEntries); + + + return; + +} -- 2.18.1