#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 "TStopwatch.h" #include "TStyle.h" using std::cout; using std::endl; void showBananasHe(Long64_t drawEntries = 100000, const TString beam = "he", TString opt = "") { // Long64_t drawEntries = 10000000; TChain *trCal = new TChain("cal"); TChain *trCalBe = new TChain("cal"); if (beam.EqualTo("he")) trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); if (beam.EqualTo("be")) trCal->Add("~/data/exp1804/be10_03_?0_calib.root"); if (beam.Contains("he") && beam.Contains("be")) { trCalBe->Add("~/data/exp1804/be10_03_?0_calib.root"); trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); } trCal->GetListOfFiles()->Print(); cout << trCal->GetEntries() << " calibrated events." << endl; TString varName; TString condition; Int_t firstThinStrip = 5; Double_t max1mmDeposit = 31.; // Double_t max1mmDeposit = 65.; // Double_t max20deposit = 5.; Double_t max20deposit = 4.; Long64_t drawnEventsCorr2nd[16]; TStopwatch stopwatch; stopwatch.Start(); //return; ///////////////////////////////////////////////////////////////////// // amplitudes and their cuts for left telescope // may be found in searchOfThresholds.cxx // // time conditions for better choice of events // may be found in searchTimeConditions.cxx // ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // c1 /*TCanvas *c1 = new TCanvas("c1", "1D energy deposits in left Si detectors: different corrections", 1400, 700); c1->Divide(3,2); c1->cd(1); trCal->Draw("SQLXEsum", "SQLXEsum>0 && trigger==3", "", 1000000); c1->Update(); c1->cd(2); trCal->Draw("SQLXEtimeFilteredSum", "SQLXEtimeFilteredSum>0 && trigger==3", "", 1000000); c1->Update(); c1->cd(4); trCal->Draw("SQ20E", "SQ20E>0 && trigger==3", "", 1000000); c1->Update(); c1->cd(5); trCal->Draw("SQ20Ecorr", "SQ20Ecorr>0 && trigger==3", "", 1000000); c1->Update(); c1->cd(6); trCal->Draw("SQ20EcorrHit", "SQ20EcorrHit>0 && trigger==3", "", 1000000); c1->Update(); //*/ // return; ///////////////////////////////////////////////////////////////////// // c2 /*TCanvas *c2 = new TCanvas("c5", "Hits of reaction products in left telescope", 1400, 900); c2->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; c2->Update(); c2->cd(1); varName.Form("yt:xt>>hTarget(32, -40., 40., 32, -40., 40.)"); // condition.Form("yThin>-80. && xThin>-80."); condition.Form("trigger==3"); trCal->Draw(varName, condition, "col", drawEntries); c2->Update(); c2->cd(2); varName.Form("yThin:xThin>>hThin(32, -40., 40., 16, -40., 40.)"); condition.Form("trigger==3 && yThin>-80. && xThin>-80."); // condition.Form("yThin>-80. && xThin>-80."); trCal->Draw(varName, condition, "col", drawEntries); c2->Update(); c2->cd(3); varName.Form("y1mm:x1mm>>h(32, -30., 30., 16, -30., 30.)"); condition.Form("trigger==3 && y1mm>-80. && x1mm>-80."); trCal->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"); Double_t thinXoffset = 1.; Double_t thinYoffset = -1.8; TBox *boxThinDetCorrPosition = new TBox(25.+thinXoffset, -25.+thinYoffset, -25.+thinXoffset, 25.+thinYoffset); boxThinDetCorrPosition->SetLineColor(kGreen); boxThinDetCorrPosition->SetLineWidth(3); boxThinDetCorrPosition->SetFillStyle(0); boxThinDetCorrPosition->Draw("same"); c2->Update(); c2->cd(4); varName.Form("xThin"); condition.Form("trigger==3 && yThin>-80. && xThin>10. && xThin<20."); trCal->Draw(varName, condition, "col", drawEntries); TLine *lx1 = new TLine(16.67, 0., 16.67, 100000.); lx1->SetLineColor(kRed); lx1->SetLineWidth(3); lx1->Draw("same"); TLine *lx2 = new TLine(18.542, 0., 18.542, 100000.); lx2->SetLineColor(kRed); lx2->SetLineWidth(3); lx2->Draw("same"); c2->Update(); c2->cd(5); varName.Form("yThin"); condition.Form("trigger==3 && yThin>-10. && yThin>10. && xThin>-80."); trCal->Draw(varName, condition, "col", drawEntries); TLine *ly1 = new TLine(12.869, 0., 12.869, 15000.); ly1->SetLineColor(kRed); ly1->SetLineWidth(3); ly1->Draw("same"); TLine *ly2 = new TLine(16.305, 0., 16.305, 15000.); ly2->SetLineColor(kRed); ly2->SetLineWidth(3); ly2->Draw("same"); c2->Update(); c2->cd(6); varName.Form("y1mm:x1mm"); condition.Form("trigger==3 && y1mm>-80. && x1mm>-80."); condition.Form("trigger==3 && y1mm>-80. && x1mm>-10. && x1mm<10."); trCal->Draw(varName, condition, "", drawEntries); c2->cd(7); varName.Form("mapXbin"); condition.Form("trigger==3 && mapXbin>-1"); trCal->Draw(varName, condition, "col", drawEntries); TLine *lxMap = new TLine(25.5, 0., 25.5, 745252.); lxMap->SetLineColor(kRed); lxMap->SetLineWidth(3); lxMap->Draw("same"); c2->Update(); c2->cd(8); varName.Form("mapYbin"); condition.Form("trigger==3 && mapYbin>-1"); trCal->Draw(varName, condition, "col", drawEntries); TLine *lyMap = new TLine(7.5, 0., 7.5, 268000.); lyMap->SetLineColor(kRed); lyMap->SetLineWidth(3); lyMap->Draw("same"); c2->Update(); c2->cd(9); // varName.Form("SQ20timeMult"); // condition.Form("trigger==3 && SQ20timeMult>0"); trCal->Draw("angleLeft", "angleLeft<3", "", drawEntries); c2->Update(); //*/ // return; ///////////////////////////////////////////////////////////////////// // c3 /*TCanvas *c3 = new TCanvas("c3", "Multiplicity - clusters", 1400, 900); c3->Divide(3,3); // cout << tr->GetEntries() << " events." << endl; cout << trCal->GetEntries() << " calibrated events." << endl; c3->cd(1); trCal->Draw("x1MultC", "x1MultC<4", "", drawEntries); c3->Update(); c3->cd(2); trCal->Draw("y1MultC", "y1MultC<4", "", drawEntries); c3->Update(); c3->cd(4); trCal->Draw("x2MultC", "x2MultC<4", "", drawEntries); c3->Update(); c3->cd(5); trCal->Draw("y2MultC", "y2MultC<4", "", drawEntries); c3->Update(); //*/ // return; ///////////////////////////////////////////////////////////////////// // c11 /*TCanvas *c11 = new TCanvas("c11", "dE-E uncorrected", 1600, 800); c11->Divide(4,2); firstThinStrip = 5; // 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; c11->cd(1); trCal->Draw("SQ20E[0]:SQ20E[0]+SQLXEsum>>h11(150, 0, 35, 150, 0, 5)", "", "col", 1000); for (Int_t i = 0; i < 8; i++) { c11->cd(i+1); if (opt.Contains("logz")) gPad->SetLogz(); varName.Form("SQ20E[%d]:SQ20E[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); condition.Form("SQ20E[%d]>0 && SQ20E[%d]<%f " // "&& SQLXEsum>1.1 " "&& SQLXEsum<%f " // "&& SQLXtimeMult==1" "&& trigger==3", i+firstThinStrip, i+firstThinStrip, max20deposit, max1mmDeposit); trCal->Draw(varName, condition, "col", drawEntries); c11->Update(); trCalBe->SetMarkerStyle(20); trCalBe->SetMarkerColor(kRed); trCalBe->SetMarkerSize(.4); trCalBe->Draw(varName, condition, "same", drawEntries); TH2F *h = (TH2F*)gPad->GetPrimitive("htemp"); h->SetStats(); 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; c12->cd(1); trCal->Draw("SQ20Ecorr[0]:SQ20Ecorr[0]+SQLXEsum>>h12(100, 0, 35, 100, 0, 5)", "", "col", 1000); for (Int_t i = 0; i < 8; i++) { c12->cd(i+1); if (opt.Contains("logz")) gPad->SetLogz(); varName.Form("SQ20Ecorr[%d]:SQ20Ecorr[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip); condition.Form("" "SQ20Ecorr[%d]>0 " "&& SQ20Ecorr[%d]<5 " // "&& SQLXEsum>1.1 " "&& SQLXEsum<%f " "&& SQLXtimeMult==1" "&& trigger==3", i+firstThinStrip, i+firstThinStrip, max1mmDeposit); trCal->Draw(varName, condition, "col", drawEntries); c12->Update(); }//*/ // 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; c13->cd(1); // trCal->Draw("SQ20Ecorr[0]:SQ20Ecorr[0]+SQLXEsum>>h13(150, 0, 35, 150, 0, 5)", "", "col", 1000); trCal->Draw("SQ20Ecorr[0]:SQ20Ecorr[0]+SQLXEsum>>h13(150, 0, 45, 150, 0, 5)", "", "col", 1000); for (Int_t i = 0; i < 8; i++) { c13->cd(i+1); if (opt.Contains("logz")) gPad->SetLogz(); drawnEventsCorr2nd[i] = 0; varName.Form("SQ20EcorrHit[%d]:SQ20EcorrHit[%d]+SQLXEtimeFilteredSum", i+firstThinStrip, i+firstThinStrip); condition.Form("" "SQ20EcorrHit[%d]>0" " && SQ20EcorrHit[%d]<%f " // "&& SQLXEsum>1.1" " && SQLXEsum<%f " "&& SQLXtimeMult==1" "&& SQLXEtimeFilteredSum>0.5" "&& trigger==3", i+firstThinStrip, i+firstThinStrip, max20deposit, max1mmDeposit); drawnEventsCorr2nd[i] = trCal->Draw(varName, condition, "col", drawEntries); TH2F *h = (TH2F*)gPad->GetPrimitive("htemp"); h->SetStats(); c13->Update(); }//*/ // return; ///////////////////////////////////////////////////////////////////// // c14 /*TCanvas *c14 = new TCanvas("c14", "dE-E corrected (second approximation, clusters)", 1600, 800); c14->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; c14->cd(1); trCal->Draw("SQ20Ecorr[0]:SQ20Ecorr[0]+SQLXEsum>>h13(150, 0, 35, 150, 0, 5)", "", "col", 1000); for (Int_t i = 0; i < 8; i++) { c14->cd(i+1); if (opt.Contains("logz")) gPad->SetLogz(); drawnEventsCorr2nd[i] = 0; varName.Form("SQ20EcorrHitC[%d]:SQ20EcorrHitC[%d]+SQLXEtimeFilteredSum", i+firstThinStrip, i+firstThinStrip); condition.Form("" "SQ20EcorrHitC[%d]>0" " && SQ20EcorrHitC[%d]<%f " // "&& SQLXEsum>1.1" " && SQLXEsum<%f " "&& SQLXtimeMult==1" "&& SQLXEtimeFilteredSum>0.5" "&& trigger==3", i+firstThinStrip, i+firstThinStrip, max20deposit, max1mmDeposit); drawnEventsCorr2nd[i] = trCal->Draw(varName, condition, "col", drawEntries); trCalBe->SetMarkerStyle(20); trCalBe->SetMarkerColor(kRed); trCalBe->SetMarkerSize(.4); trCalBe->Draw(varName, condition, "same", drawEntries); TH2F *h = (TH2F*)gPad->GetPrimitive("htemp"); h->SetStats(); c14->Update(); }//*/ // return; ///////////////////////////////////////////////////////////////////// // c15 /*TCanvas *c15 = new TCanvas("c15", "dE-E corrected (second approximation, clusters, cleaned)", 1600, 800); c15->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; c15->cd(1); trCal->Draw("SQ20Ecorr[0]:SQ20Ecorr[0]+SQLXEsum>>h13(150, 0, 35, 150, 0, 5)", "", "col", 1000); for (Int_t i = 0; i < 8; i++) { c15->cd(i+1); if (opt.Contains("logz")) gPad->SetLogz(); drawnEventsCorr2nd[i] = 0; varName.Form("SQ20EcorrHitC[%d]:SQ20EcorrHitC[%d]+SQLXEtimeFilteredSum", i+firstThinStrip, i+firstThinStrip); condition.Form("" "SQ20EcorrHitC[%d]>0" " && SQ20EcorrHitC[%d]<%f " // "&& SQLXEsum>1.1" " && SQLXEsum<%f " "&& SQLXtimeMult==1" "&& SQLXEtimeFilteredSum>0.5" "&& SQ20EcorrHitCMult" "&& CsI_L_veto==0" "&& trigger==3", i+firstThinStrip, i+firstThinStrip, max20deposit, max1mmDeposit); drawnEventsCorr2nd[i] = trCal->Draw(varName, condition, "col", drawEntries); trCalBe->SetMarkerStyle(20); trCalBe->SetMarkerColor(kRed); trCalBe->SetMarkerSize(.4); trCalBe->Draw(varName, condition, "same", drawEntries); TH2F *h = (TH2F*)gPad->GetPrimitive("htemp"); h->SetStats(); c15->Update(); }//*/ // return; ///////////////////////////////////////////////////////////////////// // c16 TCanvas *c16 = new TCanvas("c16", "dE-E corrected (second approximation, clusters, cleaned, check for thin strip)", 1600, 800); c16->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; gStyle->SetOptStat(); c16->cd(1); trCal->Draw("SQ20Ecorr[0]:SQ20Ecorr[0]+SQLXEsum>>h13(150, 0, 35, 150, 0, 5)", "", "col", 1000); for (Int_t i = 0; i < 8; i++) { c16->cd(i+1); if (opt.Contains("logz")) gPad->SetLogz(); drawnEventsCorr2nd[i] = 0; varName.Form("SQ20EcorrHitC[%d]:SQ20EcorrHitC[%d]+SQLXEtimeFilteredSum", i+firstThinStrip, i+firstThinStrip); condition.Form("" "SQ20EcorrHitC[%d]>0" " && SQ20EcorrHitC[%d]<%f " // "&& SQLXEsum>1.1" " && SQLXEsum<%f " "&& SQLXtimeMult==1" "&& SQLXEtimeFilteredSum>0.5" "&& SQ20EcorrHitCMult" "&& CsI_L_veto==0" "&& abs(expectedThinStrip-%d)<=1" "&& trigger==3", i+firstThinStrip, i+firstThinStrip, max20deposit, max1mmDeposit, i+firstThinStrip); drawnEventsCorr2nd[i] = trCal->Draw(varName, condition, "col", drawEntries); trCalBe->SetMarkerStyle(20); trCalBe->SetMarkerColor(kRed); trCalBe->SetMarkerSize(.4); trCalBe->Draw(varName, condition, "same", drawEntries); TH2F *h = (TH2F*)gPad->GetPrimitive("htemp"); h->SetStats(); c16->Update(); }//*/ // return; ///////////////////////////////////////////////////////////////////// // c17 TCanvas *c17 = new TCanvas("c17", "dE-E corrected (second approximation, clusters, cleaned, check for thin strip); target center", 1600, 800); c17->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; gStyle->SetOptStat(); c17->cd(1); trCal->Draw("SQ20Ecorr[0]:SQ20Ecorr[0]+SQLXEsum>>h13(150, 0, 35, 150, 0, 5)", "", "col", 1000); for (Int_t i = 0; i < 8; i++) { c17->cd(i+1); if (opt.Contains("logz")) gPad->SetLogz(); drawnEventsCorr2nd[i] = 0; varName.Form("SQ20EcorrHitC[%d]:SQ20EcorrHitC[%d]+SQLXEtimeFilteredSum", i+firstThinStrip, i+firstThinStrip); condition.Form("" "SQ20EcorrHitC[%d]>0" " && SQ20EcorrHitC[%d]<%f " // "&& SQLXEsum>1.1" " && SQLXEsum<%f " "&& SQLXtimeMult==1" "&& SQLXEtimeFilteredSum>0.5" "&& SQ20EcorrHitCMult" "&& CsI_L_veto==0" "&& abs(expectedThinStrip-%d)<=1" "&& trigger==3" "&& abs(xt)<10. && abs(yt)<10." "&& xThin<25. && yThin<24.", i+firstThinStrip, i+firstThinStrip, max20deposit, max1mmDeposit, i+firstThinStrip); drawnEventsCorr2nd[i] = trCal->Draw(varName, condition, "", drawEntries); trCalBe->SetMarkerStyle(20); trCalBe->SetMarkerColor(kRed); trCalBe->SetMarkerSize(.4); trCalBe->Draw(varName, condition, "same", drawEntries); TH2F *h = (TH2F*)gPad->GetPrimitive("htemp"); h->SetStats(); c17->Update(); }//*/ // return; // TCanvas *c = new TCanvas(); // trCal->Draw("expectedThinStrip", "", "", drawEntries); for (Int_t i = 0; i<8; i++) { cout << "Events after 2nd correction in strip No." << i << ": " << drawnEventsCorr2nd[i] << endl; } cout << "Finished in "<< stopwatch.RealTime() << " seconds" << endl; cout << "Finished in "<< stopwatch.RealTime()/60. << " minutes" << endl; return; }