#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, const TString beam = "he") { TChain *tr = new TChain("AnalysisxTree"); if (beam.Contains("he")) tr->Add("~/data/exp1804/h5_14_0?.root"); if (beam.Contains("be")) tr->Add("~/data/exp1804/be10_03_?0.root"); TChain *trCal = new TChain("cal"); if (beam.Contains("he")) trCal->Add("~/data/exp1804/h5_14_0?_calib.root"); if (beam.Contains("be")) trCal->Add("~/data/exp1804/be10_03_?0_calib.root"); // 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; ///////////////////////////////////////////////////////////////////// // c1 TCanvas *c1 = new TCanvas("beam", "beam info", 1200, 1200); c1->Divide(2,2); c1->cd(1); 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 *hTOF1 = (TH2F*)gPad->GetPrimitive("htemp"); // hTOF->SetStats(0); hTOF1->SetTitle("trigger 1"); hTOF1->SetXTitle("TOF (ns)"); hTOF1->SetYTitle("dE (a.u.)"); hTOF1->GetXaxis()->CenterTitle(); hTOF1->GetXaxis()->SetTitleSize(0.06); hTOF1->GetXaxis()->SetTitleOffset(0.75); hTOF1->GetYaxis()->CenterTitle(); hTOF1->GetYaxis()->SetTitleSize(0.06); hTOF1->GetYaxis()->SetTitleOffset(0.75); c1->cd(3); 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==3", "col", drawEntries); TH2F *hTOF3 = (TH2F*)gPad->GetPrimitive("htemp"); // hTOF->SetStats(0); hTOF3->SetTitle("trigger 3"); hTOF3->SetXTitle("TOF (ns)"); hTOF3->SetYTitle("dE (a.u.)"); hTOF3->GetXaxis()->CenterTitle(); hTOF3->GetXaxis()->SetTitleSize(0.06); hTOF3->GetXaxis()->SetTitleOffset(0.75); hTOF3->GetYaxis()->CenterTitle(); hTOF3->GetYaxis()->SetTitleSize(0.06); hTOF3->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); ///////////////////////////////////////////////////////////////////// // c2 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); c2->Update(); ///////////////////////////////////////////////////////////////////// // c3 TCanvas *c3 = new TCanvas("c3", "Wire multiplicity", 1200, 1200); c3->Divide(2,2); c3->cd(1); // tr->Draw("x1[0]", "x2[0]<1000 && nx2==1", "", drawEntries); tr->Draw("nx1", "nx1<30000", "", drawEntries); c3->cd(2); tr->Draw("ny1", "ny1<30000", "", drawEntries); c3->cd(3); tr->Draw("nx2", "nx2<30000", "", drawEntries); c3->cd(4); tr->Draw("ny2", "ny2<30000", "", drawEntries); ///////////////////////////////////////////////////////////////////// // c4 TCanvas *c4 = new TCanvas("c4", "MWPC time", 1200, 1200); c4->Divide(2,2); c4->cd(1); // tr->Draw("x1[0]", "x2[0]<1000 && nx2==1", "", drawEntries); tr->Draw("tMWPC[0]*0.125", "nx1<30000", "", drawEntries); tr->SetLineColor(kRed); tr->Draw("tMWPC[0]*0.125", "nx1<30000 && trigger==1", "same", drawEntries); tr->SetLineColor(kBlue); tr->Draw("tMWPC[0]*0.125", "nx1<30000 && trigger==3", "same", drawEntries); tr->SetLineColor(kBlack); c4->cd(2); tr->Draw("tMWPC[1]*0.125", "ny1<30000", "", drawEntries); tr->Draw("tMWPC[1]*0.125-tF5[0]*0.125", "ny1<30000", "", drawEntries); c4->cd(3); tr->Draw("tMWPC[2]*0.125", "nx2<30000", "", drawEntries); c4->cd(4); tr->Draw("tMWPC[3]*0.125", "ny2<30000", "", drawEntries); c4->Update(); ///////////////////////////////////////////////////////////////////// // c5 TCanvas *c5 = new TCanvas("c5", "Multiplicity filtered for time", 1200, 1200); c5->Divide(2,2); c5->cd(1); tr->Draw("nx1", "nx1<30000 && (tMWPC[0]*0.125-tF5[0]*0.125)>60 && (tMWPC[0]*0.125-tF5[0]*0.125)<77", "", drawEntries); c5->cd(2); tr->Draw("ny1", "ny1<30000 && (tMWPC[1]*0.125-tF5[0]*0.125)>60 && (tMWPC[1]*0.125-tF5[0]*0.125)<80", "", drawEntries); c5->cd(3); tr->Draw("nx2", "nx2<30000 && (tMWPC[2]*0.125-tF5[0]*0.125)>70 && (tMWPC[2]*0.125-tF5[0]*0.125)<90", "", drawEntries); c5->cd(4); tr->Draw("ny2", "ny2<30000 && (tMWPC[3]*0.125-tF5[0]*0.125)>60 && (tMWPC[3]*0.125-tF5[0]*0.125)<80", "", drawEntries); c5->Update(); ///////////////////////////////////////////////////////////////////// // c6 TCanvas *c6 = new TCanvas("c6", "Cluster multiplicity", 1500, 1000); c6->Divide(3,2); c6->cd(1); trCal->Draw("x1MultC", "x1MultC>0", "", drawEntries); c6->cd(2); trCal->Draw("y1MultC", "y1MultC>0", "", drawEntries); c6->cd(4); trCal->Draw("x2MultC", "x2MultC>0", "", drawEntries); c6->cd(5); trCal->Draw("y2MultC", "y2MultC>0", "", drawEntries); c6->cd(3); tr->Draw("nx1", "ny2==1 && nx2==1 && ny1==1 && nx1==1", "", drawEntries); c6->cd(6); trCal->Draw("x1MultC", "x1MultC==1 && y1MultC==1 && x2MultC==1 && y2MultC==1", "", drawEntries); // tr->Draw("x1", "nx1<1", "", drawEntries); c6->Update(); ///////////////////////////////////////////////////////////////////// // c1 TCanvas *c7 = new TCanvas("c7", "beam info - clusters", 1200, 1200); c7->Divide(2,2); c7->cd(1); trCal->Draw("y1p:x1p", "y1p>-50. && x1p>-50.", "col", drawEntries); c7->cd(3); trCal->Draw("y2p:x2p", "y2p>-50. && x2p>-50.", "col", drawEntries); c7->cd(2); trCal->Draw("y1c:x1c", "y1c>-50. && x1c>-50.", "col", drawEntries); c7->cd(4); trCal->Draw("y2c:x2c", "y2c>-50. && x2c>-50.", "col", drawEntries); return; }