#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 *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; ///////////////////////////////////////////////////////////////////// // 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); tAlphaCal->Draw(varName, "", "same"); c2->Update(); }//for */ // return; ///////////////////////////////////////////////////////////////////// // c3 TCanvas *c3 = new TCanvas("c3", "dE-E corrected", 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); tAlphaCal->Draw(varName, "", "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(); ///////////////////////////////////////////////////////////////////// // 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; }