void SimplePlot2D(){ //string filename = "data/scan_CH1-64_unmasked.root"; //string filename = "data/scan_CH1-50_masked.root"; string filename = "test.root"; string varXname = "VMM #"; string varYname = "CH #"; // delay count stuff int CH = 21; double delays[5]; double count_tot[5]; double count_right[5]; for(int i = 0; i < 5; i++){ delays[i] = double(i)*5.; count_tot[i] = 0.; count_right[i] = 0.; } /////////////////////////////////////////////////////// TChain* tree = new TChain("MMFE8","MMFE8"); tree->AddFile(filename.c_str()); MMFE8Base* base = new MMFE8Base(tree); int N = tree->GetEntries(); TH2D* hist = new TH2D("hist","hist", 8, 0.5, 8.5, 64, 0.5,64.5); TH2D* histN = (TH2D*) hist->Clone("norm"); TH2D* histchch = new TH2D("histchch","histchch", 64, 0.5, 64.5, 64, 0.5,64.5); TH2D* histDelay = new TH2D("histN","histN", 31, 9.5, 40.5, 5,-0.5, 4.5); TH2D* histDelayD = new TH2D("histD","histD", 31, 9.5, 40.5, 5,-0.5, 4.5); for(int i = 0; i < N; i++){ base->GetEntry(i); if(base->CHpulse == CH){ //count_tot[base->Delay] += 1.; count_tot[(base->TPDAC-80)/20] += 1.; if(base->CHpulse == base->CHword) //count_right[base->Delay] += base->TDO; count_right[(base->TPDAC-80)/20] += base->PDO; } //histDelayD->Fill(base->CHpulse,base->Delay); histDelayD->Fill(base->CHpulse,(base->TPDAC-80)/20); if(base->CHpulse == base->CHword) //histDelay->Fill(base->CHpulse,base->Delay,base->TDO); histDelay->Fill(base->CHpulse,(base->TPDAC-80)/20,base->PDO); if((base->CHpulse != base->CHword || true) && base->VMM == 6) histchch->Fill(base->CHpulse,base->CHword); if(base->CHpulse != base->CHword) continue; hist->Fill(base->VMM,base->CHpulse,base->PDO); histN->Fill(base->VMM,base->CHpulse); } for(int x = 0; x < 8; x++){ for(int y = 0; y < 64; y++){ double v = hist->GetBinContent(x+1,y+1); double N = histN->GetBinContent(x+1,y+1); hist->SetBinContent(x+1,y+1,v/max(int(N),1)); } } TLatex l; //l.NDC(); TCanvas* can = new TCanvas("can","can",600,500); can->SetTopMargin(0.05); can->SetLeftMargin(0.12); can->SetRightMargin(0.15); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); can->Draw(); can->SetGridx(); can->SetGridy(); can->cd(); hist->Draw("COLZ"); hist->GetXaxis()->SetTitle(varXname.c_str()); hist->GetXaxis()->CenterTitle(); hist->GetYaxis()->SetTitle(varYname.c_str()); hist->GetYaxis()->CenterTitle(); hist->GetYaxis()->SetTitleOffset(1.4); hist->GetYaxis()->CenterTitle(); //hist->GetYaxis()->SetRangeUser(0.,hist->GetMaximum()*1.1) ; TCanvas* canN = new TCanvas("canN","canN",600,500); canN->SetTopMargin(0.05); canN->SetLeftMargin(0.12); canN->SetRightMargin(0.15); canN->Draw(); canN->SetGridx(); canN->SetGridy(); canN->cd(); histN->Draw("COLZ"); histN->GetXaxis()->SetTitle(varXname.c_str()); histN->GetXaxis()->CenterTitle(); histN->GetYaxis()->SetTitle(varYname.c_str()); histN->GetYaxis()->CenterTitle(); histN->GetYaxis()->SetTitleOffset(1.4); histN->GetYaxis()->CenterTitle(); TCanvas* canchch = new TCanvas("canchch","canchch",600,500); canchch->SetTopMargin(0.05); canchch->SetLeftMargin(0.12); canchch->SetRightMargin(0.15); canchch->Draw(); canchch->SetGridx(); canchch->SetGridy(); canchch->cd(); histchch->Draw("COLZ"); histchch->GetXaxis()->SetTitle("CH pulsed"); histchch->GetXaxis()->CenterTitle(); histchch->GetYaxis()->SetTitle("CH data"); histchch->GetYaxis()->CenterTitle(); histchch->GetYaxis()->SetTitleOffset(1.4); histchch->GetYaxis()->CenterTitle(); histchch->GetZaxis()->SetTitle("Number of data events"); histchch->GetZaxis()->SetTitleOffset(1.4); histchch->GetZaxis()->CenterTitle(); l.DrawLatex(.54,65.2,"VMM 2"); TCanvas* can_delay = new TCanvas("can_delay","can_delay",600,500); can_delay->Draw(); can_delay->cd(); for(int i = 0; i < 5; i++) count_tot[i] = count_right[i]/count_tot[i]; TGraph* gr = new TGraph(5,delays,count_tot); gr->SetMarkerSize(4); gr->SetMarkerStyle(5); gr->Draw("AP"); histDelay->Divide(histDelayD); TCanvas* canDelay = new TCanvas("canDelay","canDelay",600,500); canDelay->SetTopMargin(0.05); canDelay->SetLeftMargin(0.12); canDelay->SetRightMargin(0.15); canDelay->Draw(); canDelay->SetGridx(); canDelay->SetGridy(); canDelay->cd(); histDelay->Draw("COLZ"); histDelay->GetXaxis()->SetTitle("CH pulsed"); histDelay->GetXaxis()->CenterTitle(); histDelay->GetYaxis()->SetTitle("Delay Count"); histDelay->GetYaxis()->CenterTitle(); histDelay->GetYaxis()->SetTitleOffset(1.4); histDelay->GetYaxis()->CenterTitle(); histDelay->GetZaxis()->SetTitle("Fraction zeroes"); histDelay->GetZaxis()->SetTitleOffset(1.4); histDelay->GetZaxis()->CenterTitle(); }
// infilename - root file with relevant histograms // system - PP,APAP,PP // status - Pass,Fail // rWrite - 0-no,1-png,2-eps // rPerformance - 0-no,1-yes (ALICE logo etc.) // bin: 0 - all, 1- 0:5, 2- 5:10, etc void drawPID(const char* infilename, const char* system, const char* status, Int_t rWrite, Int_t rPerformance, Int_t bin) { TFile *f = new TFile(infilename, "read"); // TPC dEdx TH2D* TPCdEdx =(TH2D*)f->Get(Form("TPCdEdxcut%s1%stpcM%i",status, system,0)); if (!bin) { int minMultBin = 0; int maxMultBin = 6; // 8 } else { int minMultBin = bin-1; int maxMultBin = bin; // 8 } double EvMultall = 0; for (int i = minMultBin; i < maxMultBin; i++) { TH2D* TPCdEdxN =(TH2D*)f->Get(Form("TPCdEdxcut%s1%stpcM%i",status,system,i)); TPCdEdx->Add(TPCdEdxN); cout << i << " " << TPCdEdxN->GetEntries() << endl; //delete hEvMult; } TCanvas *c2 = new TCanvas("TPC dEdx", "TPC dEdx"); c2->SetGridx(); c2->SetGridy(); c2->SetFillColor(10); c2->SetRightMargin(1.9); c2->SetLogz(); TPCdEdx->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})"); TPCdEdx->GetXaxis()->SetRangeUser(0.0,6.0); TPCdEdx->GetYaxis()->SetTitle("dE/dx"); TPCdEdx->GetZaxis()->SetLabelSize(0.03); TPCdEdx->Draw("colz"); // double a1 = -3000.0; double b1 = 1280.0; // double a2 = -312.5; double b2 = 312.5; // double a3 = -200.0; double b3 = 240.0; // TF1 *fa1 = new TF1("fa1","-1800*x+940",0.3,0.4); // fa1->Draw("same"); // TF1 *fa2 = new TF1("fa2","-500.0*x+420.0",0.4,0.6); // fa2->Draw("same"); // TF1 *fa3 = new TF1("fa3","-216.7*x+250.0",0.6,0.9); // fa3->Draw("same"); // TF1 *fa4 = new TF1("fa4","-566.7*x+570.0",0.6,0.75); // fa4->Draw("same"); // TF1 *fa5 = new TF1("fa5","-2076.92*x+1476.15",0.47,0.6); // fa5->Draw("same"); // cout<<TPCdEdx->GetNbinsX()<<endl; // cout<<TPCdEdx->GetNbinsY()<<endl; // for (int ii=0;ii<TPCdEdx->GetNbinsX();ii++){ // for (int jj=0;jj<TPCdEdx->GetNbinsY();jj++){ // cout<<"binX: "<<ii<<endl; // cout<<"binY: "<<jj<<endl; // cout<<"val: "<<TPCdEdx->GetBinContent(ii,jj)<<endl; // } // } // TH1D *py = TPCdEdx->ProjectionY("py", 230, 232); // where firstYbin = 0 and lastYbin = 9 // TCanvas *c22 = new TCanvas("TPC2", "TPC2"); // py->Draw(); postprocess(c2,Form("TPCdEdx%s",status),rWrite,rPerformance,system); // TPC Nsigma TH2D* TPCNsigma =(TH2D*)f->Get(Form("TPCNSigmacut%s1%stpcM%i",status,system,0)); // int minMultBin = 0; // int maxMultBin = 2; double EvMultall = 0; for(int i = minMultBin; i<maxMultBin; i++) { //all TH2D* TPCNsigmaN =(TH2D*)f->Get(Form("TPCNSigmacut%s1%stpcM%i",status,system,i)); TPCNsigma->Add(TPCNsigmaN); //delete hEvMult; } TCanvas *c3 = new TCanvas("TPC Nsigma", "TPC Nsigma"); c3->SetGridx(); c3->SetGridy(); c3->SetFillColor(10); c3->SetRightMargin(1.7); c3->SetLogz(); TPCNsigma->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})"); TPCNsigma->GetXaxis()->SetRangeUser(0.0,5.0); TPCNsigma->GetYaxis()->SetTitle("number of sigmas"); TPCNsigma->GetZaxis()->SetLabelSize(0.03); TPCNsigma->Draw("colz"); postprocess(c3,Form("TPCNsigma%s",status),rWrite,rPerformance,system); // TOF Nsigma TH2D* TOFNsigma =(TH2D*)f->Get(Form("TOFNSigmacut%s1%stpcM%i",status,system,0)); // int minMultBin = 1; // int maxMultBin = 1; double EvMultall = 0; for(int i = minMultBin; i<maxMultBin; i++) { //all TH2D* TOFNsigmaN =(TH2D*)f->Get(Form("TOFNSigmacut%s1%stpcM%i",status,system,i)); TOFNsigma->Add(TOFNsigmaN); //delete hEvMult; } TCanvas *c4 = new TCanvas("TOF Nsigma", "TOF Nsigma"); c4->SetGridx(); c4->SetGridy(); c4->SetFillColor(10); c4->SetRightMargin(1.7); c4->SetLogz(); TOFNsigma->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})"); TOFNsigma->GetXaxis()->SetRangeUser(0.0,5.0); TOFNsigma->GetYaxis()->SetTitle("number of sigmas from TOF"); TOFNsigma->GetZaxis()->SetLabelSize(0.03); TOFNsigma->Draw("colz"); postprocess(c4,Form("TOFNsigma%s",status),rWrite,rPerformance,system); // TOF time TH2D* TOFTime =(TH2D*)f->Get(Form("TOFTimecut%s1%stpcM%i",status,system,0)); // int minMultBin = 1; // int maxMultBin = 1; double EvMultall = 0; for(int i = minMultBin; i<maxMultBin; i++) { //all TH2D* TOFTimeN =(TH2D*)f->Get(Form("TOFTimecut%s1%stpcM%i",status,system,i)); TOFTime->Add(TOFTimeN); //delete hEvMult; } TCanvas *c5 = new TCanvas("TOF Time", "TOF Time"); c5->SetGridx(); c5->SetGridy(); c5->SetFillColor(10); c5->SetRightMargin(1.7); c5->SetLogz(); TOFTime->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})"); TOFTime->GetYaxis()->SetTitle("GetTOFsignal - GetIntegratedTimes"); TOFTime->GetYaxis()->SetTitleOffset(1.3); TOFTime->GetXaxis()->SetRangeUser(0,5); TOFTime->GetYaxis()->SetRangeUser(-7000,7000); // TOFTime->GetZaxis()->SetLabelSize(0.03); TOFTime->Draw("colz"); postprocess(c5,Form("TOFTime%s",status),rWrite,rPerformance,system); // TPC & TOF Nsigma TH2D* TPCTOFNsigma =(TH2D*)f->Get(Form("TPCTOFNSigmacut%s1%stpcM%i",status,system,0)); int minMultBin = 1; int maxMultBin = 1; double EvMultall = 0; for(int i = minMultBin; i<maxMultBin; i++) { //all TH2D* TPCTOFNsigmaN =(TH2D*)f->Get(Form("TPCTOFNSigmacut%s1%stpcM%i",status,system,i)); TOFNsigma->Add(TOFNsigmaN); //delete hEvMult; } TCanvas *c6 = new TCanvas("TOF Nsigma", "TOF Nsigma"); c6->SetGridx(); c6->SetGridy(); c6->SetFillColor(10); c6->SetRightMargin(1.7); c6->SetLogz(); TPCTOFNsigma->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})"); TPCTOFNsigma->GetXaxis()->SetRangeUser(0.0,5.0); TPCTOFNsigma->GetYaxis()->SetTitle("#sqrt{#frac{n#sigma_{TPC} + n#sigma_{TOF}}{2}}"); TPCTOFNsigma->GetZaxis()->SetLabelSize(0.03); TPCTOFNsigma->Draw("colz"); postprocess(c6,Form("TPCTOFNsigma%s",status),rWrite,rPerformance,system); }
void residualAlignment(TH2D* residualX, TH2D* residualY, double& offsetX, double& offsetY, double& rotation, double relaxation, bool display) { assert(residualX && residualY && "Processors: can't perform residual alignment without histograms"); rotation = 0; offsetX = 0; offsetY = 0; double angleWeights = 0; double fitChi2 = 0; for (int axis = 0; axis < 2; axis++) { TH2D* hist = 0; if (axis) hist = residualX; else hist = residualY; // Project the histogram and fit with a gaussian to center the sensor TH1D* project = hist->ProjectionX("ResidualProjetion", 1, hist->GetNbinsY()); project->SetDirectory(0); double sigma = project->GetBinWidth(1); double mean = 0; fitGaussian(project, mean, sigma, false); if (axis) offsetX = mean; else offsetY = mean; delete project; std::vector<double> ptsX; std::vector<double> ptsY; std::vector<double> ptsErr; const unsigned int numSlices = hist->GetNbinsY(); for (Int_t row = 1; row <= (int)numSlices; row++) { TH1D* slice = hist->ProjectionX("ResidualSlice", row, row); slice->SetDirectory(0); double mean = 0; double sigma = 0; double factor = 0; double background = 0; if (slice->Integral() < 1) { delete slice; continue; } fitGaussian(slice, mean, sigma, factor, background, false); const double sliceMin = slice->GetBinCenter(1); const double sliceMax = slice->GetBinCenter(slice->GetNbinsX()); delete slice; // Quality assurance // Sigma is contained in the slice's range if (sigma > (sliceMax - sliceMin)) continue; // Mean is contained in the slice's range if (mean > sliceMax || mean < sliceMin) continue; // Peak is contains sufficient events if (factor < 100) continue; // Sufficient signal to noise ratio if (factor / background < 10) continue; // Get the total number of events in the gaussian 1 sigma Int_t sigRangeLow = hist->FindBin(mean - sigma); Int_t sigRangeHigh = hist->FindBin(mean + sigma); double sigRangeTotal = 0; for (Int_t bin = sigRangeLow; bin <= sigRangeHigh; bin++) sigRangeTotal += hist->GetBinContent(bin); // 2 * 1 sigma integral shoudl give ~ area under gaussian sigma /= sqrt(2 * sigRangeTotal); ptsX.push_back(hist->GetYaxis()->GetBinCenter(row)); ptsY.push_back(mean); ptsErr.push_back(sigma); } if (ptsX.size() < 3) continue; std::vector<double> yvals = ptsY; std::sort(yvals.begin(), yvals.end()); const double median = yvals[yvals.size()/2]; double avgDeviation = 0; for (unsigned int i = 0; i < yvals.size(); i++) avgDeviation += fabs(yvals[i] - median); avgDeviation /= (double)yvals.size(); std::vector<double> ptsXGood; std::vector<double> ptsYGood; std::vector<double> ptsErrGood; for (unsigned int i = 0; i < ptsX.size(); i++) { if (fabs(ptsY[i] - median) > 1.5*avgDeviation) continue; ptsXGood.push_back(ptsX[i]); ptsYGood.push_back(ptsY[i]); ptsErrGood.push_back(ptsErr[i]); } if (ptsXGood.size() < 3) continue; TGraphErrors* graph = new TGraphErrors(ptsXGood.size(), &(ptsXGood.at(0)), &(ptsYGood.at(0)), 0, &(ptsErrGood.at(0))); TF1* fitFunc = new TF1("f1", "1 ++ x"); TF1* result = 0; graph->Fit(fitFunc, "Q0E").Get(); result = graph->GetFunction(fitFunc->GetName()); // Weight the angle by the slope uncertainty and the inverse of the chi2 normalized double weight = result->GetParError(1); const double chi2 = result->GetChisquare() / (double)result->GetNDF(); fitChi2 += chi2; weight *= chi2; if (weight > 10 * DBL_MIN) weight = 1.0 / weight; else weight = 1.0; if (axis) { rotation -= weight * atan(result->GetParameter(1)); offsetX = result->GetParameter(0); } else { rotation += weight * atan(result->GetParameter(1)); offsetY = result->GetParameter(0); } angleWeights += weight; if (display) { TCanvas* can = new TCanvas("ResidualAlignment", "Residual Alignment", 900, 600); can->Divide(2); can->cd(1); hist->Draw("COLZ"); can->cd(2); result->SetLineColor(46); result->SetLineWidth(2); graph->Draw("ap"); result->Draw("SAME"); can->Update(); can->WaitPrimitive(); } delete fitFunc; delete graph; } if (angleWeights > 10 * DBL_MIN) rotation /= angleWeights; std::cout << "relaxation: " << relaxation << std::endl; rotation *= relaxation; offsetX *= relaxation; offsetY *= relaxation; }
void Factorization_eta_vn() { const int nfiles = 16; TString filename[nfiles]; double v2HF = 7.26962328031520721e-02; filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass45_eff0_v24.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass45_eff1_v24.root"); filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass34_eff0_v24.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff0_v24.root"); /* filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg053_ptassallweight_etaass45_eff0_v18.root"); */ const int ntrgbins = 20; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr_v2[nfiles][6]; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr0[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; // double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kBlue, kBlue, kBlue,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal0[ntrgbins]; TH2D* hbackground0[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal0_1D[ntrgbins][6]; TH1D* hbackground0_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; double Vn[ntrgbins1][6]; double VnError[ntrgbins1][6]; double rn[ntrgbins1]; double rn_err[ntrgbins1]; double Vn0[ntrgbins1][6]; double Vn0Error[ntrgbins1][6]; double rn0[ntrgbins2]; double rn0_err[ntrgbins2]; double Vn1[ntrgbins1][6]; double Vn1Error[ntrgbins1][6]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; for(int i=0;i<ntrgbins;i++) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/backgroundcosn_trg%d",i)); hsignal[i] = (TH2D*)hsignal0[i]->Clone(Form("signalcosn_trg%d",i)); hbackground[i] = (TH2D*)hbackground0[i]->Clone(Form("backgroundcosn_trg%d",i)); hsignal[i]->Add(hsignal1[i]); hbackground[i]->Add(hbackground1[i]); for(int nbin=1;nbin<4;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal0_1D[i][nbin] = (TH1D*)hsignal0[i]->ProjectionX(Form("signal0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground0_1D[i][nbin] = (TH1D*)hbackground0[i]->ProjectionX(Form("background0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); Vn[i][nbin]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i][nbin]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn0[i][nbin]=hsignal0_1D[i][nbin]->GetMean()-hbackground0_1D[i][nbin]->GetMean(); Vn0Error[i][nbin]=sqrt(hsignal0_1D[i][nbin]->GetMeanError()*hsignal0_1D[i][nbin]->GetMeanError()+hbackground0_1D[i][nbin]->GetMeanError()*hbackground0_1D[i][nbin]->GetMeanError()); Vn1[i][nbin]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); Vn1Error[i][nbin]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); Vn[i][nbin]=Vn[i][nbin]/v2HF; VnError[i][nbin]=VnError[i][nbin]/v2HF; if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<hsignal0_1D[i][nbin]->GetMean()<<" "<<hbackground0_1D[i][nbin]->GetMean()<<" "<<Vn0[i][nbin]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<Vn1[i][nbin]<<endl; delete hsignal_1D[i][nbin]; delete hsignal0_1D[i][nbin]; delete hsignal1_1D[i][nbin]; delete hbackground_1D[i][nbin]; delete hbackground0_1D[i][nbin]; delete hbackground1_1D[i][nbin]; } delete hsignal0[i]; delete hsignal1[i]; delete hsignal[i]; delete hbackground0[i]; delete hbackground1[i]; delete hbackground[i]; } for(int nbin=1;nbin<4;nbin++) { for(int i=0;i<ntrgbins1;i++) { rn[i]=Vn[i][nbin]; rn_err[i]=VnError[i][nbin]; } gr_v2[jj][nbin] = new TGraphErrors(ntrgbins1,eta,rn,eta_err,rn_err); gr_v2[jj][nbin]->SetMarkerColor(color[nbin]); } } TCanvas* c = new TCanvas("c","c",900,500); makeMultiPanelCanvas(c,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-2.4,2.4,100,0.0,0.2); fixedFontHist(htmp,1.8,2.2); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { c->cd(jj+1); htmp->Draw(); gr_v2[jj][1]->SetMarkerStyle(21); gr_v2[jj][1]->Draw("Psame"); } return; TString histtitle[8] = {"0-0.2%","0-5%","5-10%","10-20%","20-30%","30-40%","40-50%","50-60%"}; TLine* ll = new TLine(0,1.,5.0,1.); TCanvas* c = new TCanvas("c","c",900,500); makeMultiPanelCanvas(c,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp,1.8,2.2); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr[jj][1]->SetMarkerStyle(21); gr[jj][1]->Draw("Psame"); fit[jj][1]->Draw("Lsame"); gr[jj+8][1]->SetMarkerStyle(25); // fit[jj+8][1]->SetLineStyle(5); gr[jj+8][1]->Draw("Psame"); // fit[jj+8][1]->Draw("Lsame"); } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c->cd(1); latex2->DrawLatex(0.26,0.05,histtitle[0]); latex2->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); c->cd(2); latex2->DrawLatex(0.08,0.05,histtitle[1]); latex2->DrawLatex(0.07,0.3,"0.3 < p_{T}^{a} < 3 GeV/c"); latex2->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); c->cd(4); latex2->DrawLatex(0.08,0.05,histtitle[3]); c->cd(3); latex2->DrawLatex(0.08,0.05,histtitle[2]); c->cd(8); latex2->DrawLatex(0.08,0.24,histtitle[7]); c->cd(7); latex2->DrawLatex(0.08,0.24,histtitle[6]); c->cd(6); latex2->SetTextSize(0.96*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,histtitle[5]); c->cd(5); latex2->SetTextSize(0.85*latex2->GetTextSize()); latex2->DrawLatex(0.26,0.24,histtitle[4]); TLegend* legend2 = new TLegend(0.24,0.14,0.51,0.38); legend2->SetFillStyle(0); legend2->AddEntry(gr[0][1],"4<#eta^{b}<5","P"); legend2->AddEntry(gr[8][1],"3<#eta^{b}<4","P"); c->cd(1); legend2->Draw("same"); TCanvas* ccaa = new TCanvas("ccaa","ccaa",900,500); makeMultiPanelCanvas(ccaa,4,2,0.01,0.0,0.2,0.2,0.02); for(int jj=0;jj<8;jj++) { ccaa->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr0[jj][1]->SetMarkerStyle(21); gr0[jj][1]->Draw("Psame"); gr1[jj][1]->SetMarkerStyle(25); gr1[jj][1]->Draw("Psame"); } TCanvas* ccbb = new TCanvas("ccbb","ccbb",900,500); makeMultiPanelCanvas(ccbb,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmpaa = new TH2D("htmpaa",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.97,1.03); for(int jj=0;jj<8;jj++) { ccbb->cd(jj+1); htmpaa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->SetMarkerStyle(21); gr_ratio[jj][1]->Draw("Psame"); } TCanvas* cc = new TCanvas("cc","cc",900,500); makeMultiPanelCanvas(cc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp1 = new TH2D("htmp1",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp1,1.8,2.2); htmp1->GetXaxis()->CenterTitle(); htmp1->GetYaxis()->CenterTitle(); htmp1->GetYaxis()->SetTitleSize(htmp1->GetYaxis()->GetTitleSize()*1.2); htmp1->GetXaxis()->SetTitleSize(htmp1->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { cc->cd(jj+1); htmp1->Draw(); ll->Draw("Lsame"); gr[jj][2]->SetMarkerStyle(21); gr[jj][2]->Draw("Psame"); fit[jj][2]->Draw("Lsame"); gr[jj+8][2]->SetMarkerStyle(25); // fit[jj+8][2]->SetLineStyle(5); gr[jj+8][2]->Draw("Psame"); // fit[jj+8][2]->Draw("Lsame"); } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.5*latex3->GetTextSize()); cc->cd(1); latex3->DrawLatex(0.26,0.05,histtitle[0]); latex3->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cc->cd(2); latex3->DrawLatex(0.08,0.05,histtitle[1]); latex3->DrawLatex(0.07,0.28,"0.3 < p_{T}^{a} < 3 GeV/c"); latex3->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); cc->cd(4); latex3->DrawLatex(0.08,0.05,histtitle[3]); cc->cd(3); latex3->DrawLatex(0.08,0.05,histtitle[2]); cc->cd(8); latex3->DrawLatex(0.08,0.24,histtitle[7]); cc->cd(7); latex3->DrawLatex(0.08,0.24,histtitle[6]); cc->cd(6); latex3->SetTextSize(0.96*latex3->GetTextSize()); latex3->DrawLatex(0.08,0.24,histtitle[5]); cc->cd(5); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.26,0.24,histtitle[4]); TLegend* legend3 = new TLegend(0.24,0.14,0.51,0.38); legend3->SetFillStyle(0); legend3->AddEntry(gr[0][1],"4<#eta^{b}<5","P"); legend3->AddEntry(gr[8][1],"3<#eta^{b}<4","P"); cc->cd(1); legend3->Draw("same"); /* TCanvas* ccc = new TCanvas("ccc","ccc",900,500); makeMultiPanelCanvas(ccc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{4}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp2,1.8,2.2); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.2); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { ccc->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][3]->Draw("Psame"); fit[jj][3]->Draw("Lsame"); gr[jj+8][3]->Set_arkerStyle(25); fit[jj+8][3]->SetLineStyle(5); gr[jj+8][3]->Draw("Psame"); fit[jj+8][3]->Draw("Lsame"); } */ TCanvas* c1 = new TCanvas("c1","c1",500,500); TH2D* htmp2 = new TH2D("htmp2",";Centrality;C",100,0,1.0,100,0.0,0.06); htmp2->Draw(); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); gr_slope[1]->SetMarkerColor(1); gr_slope[2]->SetMarkerColor(1); gr_slope[1]->SetMarkerStyle(21); gr_slope[2]->SetMarkerStyle(22); gr_slope[1]->Draw("PESAME"); gr_slope[2]->Draw("PESAME"); gr1_slope[1]->SetMarkerColor(1); gr1_slope[2]->SetMarkerColor(1); gr1_slope[1]->SetMarkerStyle(25); gr1_slope[2]->SetMarkerStyle(26); gr1_slope[1]->Draw("PESAME"); gr1_slope[2]->Draw("PESAME"); TFile* f_slope_out = new TFile("gr_slope_v2v3.root","recreate"); gr_slope[1]->Write(); gr_slope[2]->Write(); gr1_slope[1]->Write(); gr1_slope[2]->Write(); f_slope_out->Close(); return; SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); SaveCanvas(ccaa,"HI/FactBreak","epetadeco_HI_r2ratio"); // SaveCanvas(c1,"HI/FactBreak","epetadeco_HI_C"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_HI_cos"); }
int main(int argc, char * argv[]) { int ChooseCamera; cout << "Set the camera you want to use: \n 0 -> Integrated one \n 1 -> USB one " << endl; cin >> ChooseCamera; VideoCapture cam(ChooseCamera); // with 1 -> choose the webcam if it's attached, otherwise choose the integrated one if(!cam.isOpened()){ // Controllo di apertura della webcam cout << "Impossibile aprire lo stream della webcam. Il programma verrà terminato." << endl; return -1; } //~ double MyWidth = 640; // Limiti 1280x720 copiati da Ave. Sono quelli propri della videocamera come mostrati da Cheese. //~ double MyHeight = 480; double MyWidth = 1280; // Limiti 1280x720 copiati da Ave. Sono quelli propri della videocamera come mostrati da Cheese. double MyHeight = 720; cam.set(CV_CAP_PROP_FRAME_WIDTH, MyWidth); //Set frame width and height cam.set(CV_CAP_PROP_FRAME_HEIGHT, MyHeight); //~ system("v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=1 -d /dev/video1"); //Set frame width and height through a system call cam.set(CV_CAP_PROP_FPS, 30); //Set the webcam frame rate // NB: per poter modificare i valori della frame Width and Height è necessario compilare le librerie OPENCV con // le librerie [ v4l2ucp, v4l-utils and libv4l-dev ] già installate nel computer // (vedi: http://stackoverflow.com/questions/16287488/runtime-opencv-highgui-error-highgui-error-v4l-v4l2-vidioc-s-crop-opencv-c) if (ChooseCamera==1) { //~ system("v4l2-ctl --set-ctrl exposure_auto=1 -d /dev/video1"); //Alternative method to change v4l2 controls //~ system("v4l2-ctl --set-ctrl exposure_absolute=5 -d /dev/video1"); system("v4l2-ctl -c exposure_auto=1 -d /dev/video1"); //system call to adjust the balance variables, sono necessarie le librerie v4l2 system("v4l2-ctl -c exposure_absolute=5 -d /dev/video1"); //Le chiamate e le impostazioni le ho copiate da Ave, sperando che siano quelle giust // in general v4l2-ctl -c command -> comando per cambiare le immpostazioni, lista delle impostazioni possibili le leggi // da bash dando $v4l2-ctl --list-ctrls // documentazione completa delle v4l2 la trovi @ http://ivtvdriver.org/index.php/V4l2-ctl cout << "Sys call for camera #" << ChooseCamera << " done!\n"; //system("say 'settings done baby'"); } if (ChooseCamera==0) { //~ //Put here commands for set the integrated camera commands. Generally useless //~ system("v4l2-ctl -c exposure_auto=1 -d /dev/video0"); //system call to adjust the balance variables, sono necessarie le librerie v4l2 //~ system("v4l2-ctl -c exposure_absolute=5 -d /dev/video0"); //Le chiamate e le impostazioni le ho copiate da Ave, sperando che siano quelle giust cout << "Sys call for camera #" << ChooseCamera << " done!\n"; } //Controllo dimensionamento immagine acquisita: double RealWidth = cam.get(CV_CAP_PROP_FRAME_WIDTH); //This function get the Width (in pixels) of the output. double RealHeight = cam.get(CV_CAP_PROP_FRAME_HEIGHT); //This function get the Height (in pixels) of the output. cout << " Setted Width: " << MyWidth << " || Real Width: " << RealWidth << endl; cout << " Setted Height: " << MyHeight << " || Real Height: " << RealHeight << endl; cout << "\n"; //Creazione Root object used for analysis TApplication myapp("myapp", &argc,argv); //ROOT Canvas for the current image //~ TCanvas * C = new TCanvas ("C","",710,400); //~ TH2D * CurrentHisto = new TH2D ("h2d", " ", (int)MyWidth, -(MyWidth/2)+1 , (MyWidth/2), (int)MyHeight, -(MyHeight/2)+1 , (MyHeight/2) ); //Canvas for the total image TCanvas * C2 = new TCanvas ("C2","",710,400); TH2D * TotalHisto = new TH2D ("TotalHisto", " ", (int)MyWidth, -(MyWidth/2)+1 , (MyWidth/2), (int)MyHeight, -(MyHeight/2)+1 , (MyHeight/2) ); //~ gStyle->SetPalette(1); TotalHisto->Draw("CONT"); //~ double RootTempMatrix [int(MyWidth)][int(MyHeight)]; //declaration of a two dimansional array //~ int meanX; //~ int meanY; //~ double VarX; //~ double VarY; //~ double IntIntegral; double alfa= 0.79; //IntensityCalibration namedWindow("Live_Video",WINDOW_NORMAL); //Crea una finestra di cui posso modificare le dimensioni (openCV method) resizeWindow("Live_Video", RealWidth, RealHeight); //Imposta la dimensione iniziale uguale alla dimensione del frame int k=0; float DisplayHeight = RealHeight / 2 ; float DisplayWidth = RealWidth / 2 ; Mat ImageBGR(Size(RealWidth, RealHeight), CV_16UC3); Vec3b intensity; //Definisco due array sui quali metto l'immagine istantanea e l'immagine totale double * MatIn = new double [int( MyWidth * MyHeight)]; double * MatSum = new double [int( MyWidth * MyHeight)]; for (int m=0; m < (MyWidth * MyHeight); m++){ MatSum[m]=0.0; } for(int i=0; i< int(MyWidth); i++){ //Piazzo dentro i valori for(int j=0; j< int(MyHeight); j++){ TotalHisto->SetBinContent((MyWidth-i+1),(MyHeight-j+1),0); } } int IntensityGreen; double temp = 0; ofstream ofile; ofile.open("MatrixSumFondo.txt",ios::out); for(;;) { k++; Mat frame; //non capisco la logica di rinizializzare il frame ad ogni ciclo...ma nel tutorial officiale opencv è così.. Lascio così che sia mai che vi potrebbero essere problemi con il buffer altrimenti cam >> frame; // get a new frame from camera imshow("Live_Video", frame); //MouseCallBack Function to get pixel intensity //For very good explaination and examples go at -> http://opencvexamples.blogspot.com/2014/01/detect-mouse-clicks-and-moves-on-image.html#.VWVpIs17h5Q setMouseCallback("Live_Video", mouseEvent, &frame); if( (k%10)==0){ //elabora un frame ogni 50 cam.retrieve(ImageBGR, 0); //Salva in una matrice la figura della webcam //~ cout << "\n-------- Inizio filling --------" << endl; for(int i=0; i< int(MyWidth); i++){ //Piazzo dentro i valori for(int j=0; j< int(MyHeight); j++){ intensity = ImageBGR.at<Vec3b>(j, i); IntensityGreen = pow(intensity.val[1],(1.0/alfa)); //cout << IntensityGreen << endl; //~ MatIn[Index(i,j,MyWidth)] = IntensityGreen; //~ CurrentHisto->SetBinContent((MyWidth-i+1),(MyHeight-j+1),IntensityGreen); MatSum[Index(i,j,MyWidth)] += IntensityGreen; if( (k%200)==0){ TotalHisto->SetBinContent((MyWidth-i+1),(MyHeight-j+1),MatSum[Index(i,j,MyWidth)]); } } } //In questo modo stampo un asterisco ogni 20 immagini che si sommano if( (k%200)==0){ temp = k/10; cout << "Numero di immagni sovraimposte: " << temp << endl; } //~ //~ if( (k%400)==0){ //~ cout << "\n" << endl; //~ } //~ cout << "Fine filling:" << endl; //~ CurrentHisto->Draw("CONT"); //~ C-> Update(); //~ TotalHisto->Draw("CONT"); C2 -> Modified(); C2-> Update(); } double px,py,pz; if (k==3000){ for(int i=0; i< int(MyWidth); i++){ for(int j=0; j< int(MyHeight); j++){ pz=TotalHisto->GetBinContent((MyWidth-i+1),(MyHeight-j+1)); px=MyHeight-j+1; py=MyWidth-i+1; ofile << px << " " << py << " " << pz << endl; } ofile << endl; } break; } if(waitKey(30) >= 0) break; } // the camera will be deinitialized automatically in VideoCapture destructor ofile.close(); myapp.Run(); return 0; }
void DrawKinvarPlot(TString filename="kinvarset/FMSOR_Pt_vs_run.root", TString classname="pi0") { TFile * infile = new TFile(filename.Data(),"READ"); char trig[32]; char typ[32]; char tmp[128]; TString tmpstr = filename; tmpstr.ReplaceAll("_"," "); TRegexp re("^.*\/"); tmpstr(re) = ""; cout << tmpstr << endl; sscanf(tmpstr.Data(),"%s %s",trig,typ); printf("%s %s\n",trig,typ); TString hname = "h2_"+classname; TH2D * h = (TH2D*)infile->Get(hname.Data()); TString gname = "g_"+classname; TGraphErrors * g = (TGraphErrors*)infile->Get(gname.Data()); TString gtname = "gt_"+classname; TGraphErrors * gt; if(!strcmp(typ,"Pt")) gt = (TGraphErrors*)infile->Get(gtname.Data()); char htitle[256]; char hnewtitle[512]; strcpy(htitle,h->GetTitle()); sprintf(hnewtitle,"%s -- %s triggers",htitle,trig); h->SetTitle(hnewtitle); h->SetMinimum(0.001); if(!strcmp(typ,"Pt")) { gt->SetLineWidth(2); gt->SetLineColor(kBlack); }; // temporary hack to cut out fluctuations of pt_thresh vs. run to 0 Double_t xx,yy; Int_t gtn = gt->GetN(); for(int ii=0; ii<gtn; ii++) { gt->GetPoint(ii,xx,yy); printf("xx=%f yy=%f\n",xx,yy); if(yy<0.001) gt->RemovePoint(ii); }; // drawing range Float_t xmin = h->GetXaxis()->GetXmin(); Float_t xmax = h->GetXaxis()->GetXmax(); xmax = 515; if(xmax<gtn) { fprintf(stderr,"\nWARNING: xmax < gt->GetN(); graphs will be cut off!\n\n"); }; TCanvas * c = new TCanvas("c","c",1500,700); c->Divide(1,2); gStyle->SetOptStat(0); for(int x=1; x<=2; x++) c->GetPad(x)->SetGrid(1,1); c->cd(1); c->GetPad(1)->SetLogz(); h->GetXaxis()->SetRangeUser(xmin,xmax); h->Draw("colz"); if(!strcmp(typ,"Pt")) gt->Draw("LX"); c->cd(2); g->SetFillColor(kGray); printf("%f %f\n",xmin,xmax); g->GetXaxis()->SetLimits(xmin,xmax); g->GetXaxis()->SetRangeUser(xmin,xmax); /* g->Draw("A3"); g->Draw("PLX"); */ g->Draw("APLX"); TString outname = filename.ReplaceAll(".root"," "+classname); outname = outname+".png"; c->Print(outname.Data(),"png"); };
void RayTrace(AOpticsManager* manager, TCanvas* can3D) { const int kNdeg = 8; TH2D* h2[kNdeg]; TGraph* graph = new TGraph(); TCanvas* can = new TCanvas("can", "can", 900, 900); TCanvas* can2= new TCanvas("can2", "can2", 900, 900); can->Divide(3, 3, 1e-10, 1e-10); TH2D* hMirror = new TH2D("hMirror", ";X (mm);Y (mm)", 1000, -7, 7, 1000, -7, 7); for(int i = 0; i < kNdeg; i++){ double deg = i*0.5; TGeoTranslation raytr("raytr", -2*kF*TMath::Sin(deg*TMath::DegToRad()), 0, 2*kF*TMath::Cos(deg*TMath::DegToRad())); TVector3 dir; dir.SetMagThetaPhi(1, TMath::Pi() - deg*TMath::DegToRad(), 0); double lambda = 400*nm; // dummy ARayArray* array = ARayShooter::Square(lambda, 14*m, 401, 0, &raytr, &dir); manager->TraceNonSequential(*array); h2[i] = new TH2D("", Form("#it{#theta} = %3.1f#circ;x (mm); y (mm)", deg), 200, -40, 100, 200, -70, 70); TH2D tmp("", "", 100, -1e5, 1e5, 100, -1e5, 1e5); TObjArray* focused = array->GetFocused(); for(Int_t j = 0; j <= focused->GetLast(); j++){ ARay* ray = (ARay*)(*focused)[j]; Double_t p[4]; ray->GetLastPoint(p); tmp.Fill(p[0], p[1]); if (i == 0) { int n = ray->FindNodeNumberStartWith("mirror"); const double* pn = ray->GetPoint(n); hMirror->Fill(pn[0]/m, pn[1]/m); } // if if (i == kNdeg - 1 && gRandom->Uniform() < 0.001) { TPolyLine3D* pol = ray->MakePolyLine3D(); pol->SetLineColor(2); can3D->cd(); pol->Draw(); } // if } // j double meanx = tmp.GetMean(); for(Int_t j = 0; j <= focused->GetLast(); j++){ ARay* ray = (ARay*)(*focused)[j]; Double_t p[4]; ray->GetLastPoint(p); h2[i]->Fill((p[0] - meanx)/mm, p[1]/mm); } // j can->cd(i + 1); h2[i]->Draw("colz"); if(i == 0){ can2->cd(); hMirror->Draw("colz"); } // i delete array; } // i }
int main(int argc, char** argv){ std::cout << "Starting application" << std::endl; TApplication* app = new TApplication("Analyse",&argc,argv); //Set plot style for own root design PlotStyle* s = new PlotStyle(); CanvasManager* cManager = new CanvasManager("combinedPlots"); //####################### //# Creating Trees and Analyse objects //####################### std::vector<AnalysisWrapper*> wrapperVect; wrapperVect.push_back(new AnalysisWrapper("deltaPhiGun/DeltaPhiGunPt100dPhi3_0/TrigTestDeltaPhiGun.root","DeltaPhiGunPt100dR3_0",10.,true)); // wrapperVect.push_back(new AnalysisWrapper("deltaPhiGun/DeltaPhiGunPt100dPhi0_3/TrigTestDeltaPhiGun.root","DeltaPhiGunPt100dR0_3",10.,true)); // wrapperVect.push_back(new AnalysisWrapper("deltaPhiGun/DeltaPhiGunPt100dPhi0_1/TrigTestDeltaPhiGun.root","DeltaPhiGunPt100dR0_1",10.,true)); // wrapperVect.push_back(new AnalysisWrapper("deltaPhiGun/DeltaPhiGunPt100dPhi0_05/TrigTestDeltaPhiGun.root","DeltaPhiGunPt100dR0_05",10.,true)); // wrapperVect.push_back(new AnalysisWrapper("deltaPhiGun/DeltaPhiGunPt100dPhi0_01/TrigTestDeltaPhiGun.root","DeltaPhiGunPt100dR0_01",10.,true)); // wrapperVect.push_back(new AnalysisWrapper("deltaPhiGun/DeltaPhiGunPt100dPhi0_005/TrigTestDeltaPhiGun.root","DeltaPhiGunPt100dR0_005",10.,true)); wrapperVect[0]->analyseBti(); wrapperVect[0]->analyseTraco(); wrapperVect[0]->analyseGenParticles(); wrapperVect[0]->savePlots(); //Create a vector with colors to access during scenario iterations std::vector<int> colorVector; colorVector.push_back(kBlack); colorVector.push_back(kBlue); colorVector.push_back(kViolet); colorVector.push_back(kRed); colorVector.push_back(kOrange); colorVector.push_back(kGreen); colorVector.push_back(kTeal); colorVector.push_back(kCyan - 1); //Create a vector with scenarios to access during scenario iterations std::vector<TString> legendNameVector; legendNameVector.push_back(TString("#Delta#Phi 3.0")); legendNameVector.push_back(TString("#Delta#Phi 0.3")); legendNameVector.push_back(TString("#Delta#Phi 0.1")); legendNameVector.push_back(TString("#Delta#Phi 0.05")); legendNameVector.push_back(TString("#Delta#Phi 0.01")); legendNameVector.push_back(TString("#Delta#Phi 0.005")); std::vector<std::vector<TH1*> > btiScenariosBestCase; std::vector<std::vector<TH1*> > btiScenariosHtrg; for(unsigned int i = 0 ; i < wrapperVect.size(); i++ ){ btiScenariosBestCase.push_back(wrapperVect[i]->analyseBtiTrigPerStatAndSlBestCase()); btiScenariosHtrg.push_back(wrapperVect[i]->analyseBtiTrigPerStatAndSlHtrg()); } TCanvas* btiBestCaseCanvas = cManager->getDividedCanvas(1,1); btiBestCaseCanvas->SetName("btiTrigsPerStatAndSlTogetherBestCase"); TCanvas* btiHtrgCanvas = cManager->getDividedCanvas(1,1); btiHtrgCanvas->SetName("btiTrigsPerStatAndSlTogetherHtrg"); //Get the size of the first vector stored in the scenarios for (int i = 0 ; i < btiScenariosBestCase[0].size()/8. ; i++){ int scenarioCounter = 0; TLegend* lBestCase = new TLegend(0.5,.525,0.7,0.9); TLegend* lBestCase2 = new TLegend(0.7,.525,0.9,0.9); TLegend* lHtrg = new TLegend(0.5,.525,0.7,0.9); TLegend* lHtrg2 = new TLegend(0.7,.525,0.9,0.9); btiBestCaseCanvas->cd(i+1)->SetLogy(); //Build the frame TString frameName = "BTI Trigger (Best Case) f#ddot{u}r Station "; frameName += i+1; frameName += ";# BTI Trigger;Relative H#ddot{a}ufigkeit"; TH2D* frame = new TH2D("frameBtiBestCase",frameName,1,-0.5,10.5,1,0.000001,1); frame->SetStats(kFALSE); frame->Draw(); for (std::vector<std::vector<TH1*> >::const_iterator scenarioIt = btiScenariosBestCase.begin(); scenarioIt != btiScenariosBestCase.end() ; scenarioIt++){ //Loop over the scenarios scenarioIt->at(2*i)->SetLineColor(colorVector[scenarioCounter]); scenarioIt->at(2*i)->Scale(1/scenarioIt->at(2*i)->Integral()); scenarioIt->at(2*i)->Draw("same"); scenarioIt->at(2*i+1)->SetLineColor(colorVector[scenarioCounter]); scenarioIt->at(2*i+1)->SetLineStyle(2); scenarioIt->at(2*i+1)->Scale(1/scenarioIt->at(2*i+1)->Integral()); scenarioIt->at(2*i+1)->Draw("same"); lBestCase->AddEntry(scenarioIt->at(2*i),(legendNameVector[scenarioCounter] + " SL 1").Data()); lBestCase2->AddEntry(scenarioIt->at(2*i+1),(legendNameVector[scenarioCounter] + " SL 3").Data()); scenarioCounter++; } lBestCase->Draw(); lBestCase2->Draw(); btiBestCaseCanvas->Update(); TString plotTitle("BTI Trigger (Best Case) f#ddot{u}r Station "); plotTitle += i+1; (new PlotTitle(plotTitle.Data()))->Draw(); scenarioCounter = 0; btiHtrgCanvas->cd(i+1)->SetLogy(); //Build the frame frameName = "BTI Trigger (HTRG) f#ddot{u}r Station "; frameName += i+1; frameName += ";# BTI Trigger;Relative H#ddot{a}ufigkeit"; frame = new TH2D("frameBtiHtrg",frameName,1,-0.5,25.5,1,0.000001,1); frame->SetStats(kFALSE); frame->Draw(); for (std::vector<std::vector<TH1*> >::const_iterator scenarioIt = btiScenariosHtrg.begin(); scenarioIt != btiScenariosHtrg.end() ; scenarioIt++){ //Loop over the scenarios scenarioIt->at(2*i)->SetLineColor(colorVector[scenarioCounter]); scenarioIt->at(2*i)->Scale(1/scenarioIt->at(2*i)->Integral()); scenarioIt->at(2*i)->Draw("same"); scenarioIt->at(2*i+1)->SetLineColor(colorVector[scenarioCounter]); scenarioIt->at(2*i+1)->SetLineStyle(2); scenarioIt->at(2*i+1)->Scale(1/scenarioIt->at(2*i+1)->Integral()); scenarioIt->at(2*i+1)->Draw("same"); lHtrg->AddEntry(scenarioIt->at(2*i),(legendNameVector[scenarioCounter] + " SL 1").Data()); lHtrg2->AddEntry(scenarioIt->at(2*i+1),(legendNameVector[scenarioCounter] + " SL 3").Data()); scenarioCounter++; } lHtrg->Draw(); lHtrg2->Draw(); btiHtrgCanvas->Update(); plotTitle = "BTI Trigger (HTRG) f#ddot{u}r Station "; plotTitle += i+1; (new PlotTitle(plotTitle.Data()))->Draw(); } cManager->addCanvas("btiTrigsPerStatAndSlTogetherBestCase",btiBestCaseCanvas); cManager->addCanvas("btiTrigsPerStatAndSlTogetherHtrg",btiHtrgCanvas); //################################ //### plot TRACO triggers together //################################ std::vector<std::vector<TH1*> > tracoScenariosBestCase; std::vector<std::vector<TH1*> > tracoScenariosHtrg; for(unsigned int i = 0 ; i < wrapperVect.size(); i++ ){ tracoScenariosBestCase.push_back(wrapperVect[i]->analyseTracoTrigPerStationBestCase()); tracoScenariosHtrg.push_back(wrapperVect[i]->analyseTracoTrigPerStationHtrig()); } TCanvas* tracoBestCaseCanvas = cManager->getDividedCanvas(1,1); tracoBestCaseCanvas->SetName("tracoTrigsPerStatTogetherBestCase"); TCanvas* tracoHtrgCanvas = cManager->getDividedCanvas(1,1); tracoHtrgCanvas->SetName("tracoTrigsPerStatTogetherHtrg"); //Get the size of the first vector stored in the scenarios for (int i = 0 ; i < tracoScenariosBestCase[0].size()/4. ; i++){ int scenarioCounter = 0; TLegend* lBestCase = new TLegend(0.75,.45,0.90,0.90); TLegend* lHtrg = new TLegend(0.75,.45,0.90,0.90); tracoBestCaseCanvas->cd(i+1)->SetLogy(); //Build the frame TString frameName = "TRACO Trigger (Best Case) f#ddot{u}r Station "; frameName += i+1; frameName += ";# TRACO Trigger;Relative H#ddot{a}ufigkeit"; TH2D* frame = new TH2D("frameTracoBestCase",frameName,1,-0.5,7.5,1,0.000001,1); frame->SetStats(kFALSE); frame->Draw(); for (std::vector<std::vector<TH1*> >::const_iterator scenarioIt = tracoScenariosBestCase.begin(); scenarioIt != tracoScenariosBestCase.end() ; scenarioIt++){ //Loop over the scenarios scenarioIt->at(i)->SetLineColor(colorVector[scenarioCounter]); scenarioIt->at(i)->Scale(1/scenarioIt->at(i)->Integral()); scenarioIt->at(i)->Draw("same"); lBestCase->AddEntry(scenarioIt->at(i),legendNameVector[scenarioCounter]); scenarioCounter++; } lBestCase->Draw(); tracoBestCaseCanvas->Update(); TString plotTitle("TRACO Trigger (Best Case) f#ddot{u}r Station "); plotTitle += i+1; (new PlotTitle(plotTitle.Data()))->Draw(); scenarioCounter = 0; tracoHtrgCanvas->cd(i+1)->SetLogy(); //Build the frame frameName = "TRACO Trigger (HTRG) f#ddot{u}r Station "; frameName += i+1; frameName += ";# TRACO Trigger;Relative H#ddot{a}ufigkeit"; frame = new TH2D("frameTracoHtrg",frameName,1,-0.5,7.5,1,0.000001,1); frame->SetStats(kFALSE); frame->Draw(); for (std::vector<std::vector<TH1*> >::const_iterator scenarioIt = tracoScenariosHtrg.begin(); scenarioIt != tracoScenariosHtrg.end() ; scenarioIt++){ //Loop over the scenarios scenarioIt->at(i)->SetLineColor(colorVector[scenarioCounter]); scenarioIt->at(i)->Scale(1/scenarioIt->at(i)->Integral()); scenarioIt->at(i)->Draw("same"); lHtrg->AddEntry(scenarioIt->at(i),legendNameVector[scenarioCounter]); scenarioCounter++; } lHtrg->Draw(); tracoHtrgCanvas->Update(); plotTitle = "TRACO Trigger (HTRG) f#ddot{u}r Station "; plotTitle += i+1; (new PlotTitle(plotTitle.Data()))->Draw(); } cManager->addCanvas("tracoTrigsPerStatTogetherBestCase",tracoBestCaseCanvas); cManager->addCanvas("tracoTrigsPerStatTogetherHtrg",tracoHtrgCanvas); cManager->storePlots(); int scenarioCounter = 0; std::cout << "N Entries in bti Best case Scenarios:" << std::endl; for (std::vector<std::vector<TH1*> >::const_iterator scenarioIt = btiScenariosBestCase.begin(); scenarioIt != btiScenariosBestCase.end() ; scenarioIt++) { std::cout << "\t" << legendNameVector[scenarioCounter] << ":\t\t" << scenarioIt->at(0)->GetEntries() << std::endl; scenarioCounter++; } std::cout << std::endl; scenarioCounter = 0; std::cout << "N Entries in bti HTRG Scenarios:" << std::endl; for (std::vector<std::vector<TH1*> >::const_iterator scenarioIt = btiScenariosHtrg.begin(); scenarioIt != btiScenariosHtrg.end() ; scenarioIt++) { std::cout << "\t" << legendNameVector[scenarioCounter] << ":\t\t" << scenarioIt->at(0)->GetEntries() << std::endl; scenarioCounter++; } std::cout << std::endl; scenarioCounter = 0; std::cout << "N Entries in traco HTRIG Scenarios:" << std::endl; for (std::vector<std::vector<TH1*> >::const_iterator scenarioIt = tracoScenariosHtrg.begin(); scenarioIt != tracoScenariosHtrg.end() ; scenarioIt++) { // std::cout << TString::Format("%s:\t%6d",legendNameVector[scenarioCounter].Data(),scenarioIt->at(0)->GetEntries()).Data() << std::endl; std::cout << "\t" << legendNameVector[scenarioCounter] << ":\t\t" << scenarioIt->at(0)->GetEntries() << std::endl; scenarioCounter++; } std::cout << std::endl; scenarioCounter = 0; std::cout << "N Entries in traco BestCase Scenarios:" << std::endl; for (std::vector<std::vector<TH1*> >::const_iterator scenarioIt = tracoScenariosBestCase.begin(); scenarioIt != tracoScenariosBestCase.end() ; scenarioIt++) { std::cout << "\t" << legendNameVector[scenarioCounter] << ":\t\t" << scenarioIt->at(0)->GetEntries() << std::endl; scenarioCounter++; } std::cout << std::endl; delete btiBestCaseCanvas; delete btiHtrgCanvas; delete tracoBestCaseCanvas; delete tracoHtrgCanvas; std::cout << "All done!\nExit via ctrl+c..." << std::endl; // app->Run(); delete cManager; return 0; }
void Factorization_eta_pPb() { const int nfiles = 15; TString filename[nfiles]; filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n150185_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n185220_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n220260_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n260_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n120150_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n150185_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n185220_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n220260_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n260_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n120150_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n150185_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n185220_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n220260_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n260_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n120150_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); const int ntrgbins = 16; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_tot[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; // double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kRed, kBlue, kGreen+2,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; for(int i=0;i<ntrgbins;i++) { hsignal[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/signalcosn_trg%d",i)); hbackground[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/backgroundcosn_trg%d",i)); /* hsignal_1D[i] = (TH1D*)hsignal[i]->ProfileY(Form("signal_1D_trg%d",i),-1,-1,"e"); hsignal1_1D[i] = (TH1D*)hsignal1[i]->ProfileY(Form("signal1_1D_trg%d",i),-1,-1,"e"); hbackground_1D[i] = (TH1D*)hbackground[i]->ProfileY(Form("background_1D_trg%d",i),-1,-1,"e"); hbackground1_1D[i] = (TH1D*)hbackground1[i]->ProfileY(Form("background1_1D_trg%d",i),-1,-1,"e"); */ for(int nbin=1;nbin<2;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); } } for(int nbin=1;nbin<2;nbin++) { double Vn[ntrgbins1]; double VnError[ntrgbins1]; double rn[ntrgbins2]; double rn_err[ntrgbins2]; double Vn1[ntrgbins1]; double VnError1[ntrgbins1]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_tot[ntrgbins2]; double rn_tot_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; for(int i=0;i<ntrgbins1;i++) { if(nbin==1 && jj==3 ) cout<<nbin<<" "<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hsignal1_1D[i][nbin]->GetMeanError()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMeanError()<<endl; /* Vn[i]=hsignal_1D[i]->GetBinContent(nbin)-hbackground_1D[i]->GetBinContent(nbin); VnError[i]=sqrt(hsignal_1D[i]->GetBinError(nbin)*hsignal_1D[i]->GetBinError(nbin)+hbackground_1D[i]->GetBinError(nbin)*hbackground_1D[i]->GetBinError(nbin)); Vn1[i]=hsignal1_1D[i]->GetBinContent(nbin)-hbackground1_1D[i]->GetBinContent(nbin); VnError1[i]=sqrt(hsignal1_1D[i]->GetBinError(nbin)*hsignal1_1D[i]->GetBinError(nbin)+hbackground1_1D[i]->GetBinError(nbin)*hbackground1_1D[i]->GetBinError(nbin)); */ Vn[i]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn1[i]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); VnError1[i]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); } for(int i=0;i<ntrgbins2;i++) { rn[ntrgbins2-i-1]=Vn[i]/Vn[ntrgbins1-i-1]; rn_err[ntrgbins2-i-1]=sqrt((VnError[ntrgbins1-i-1]/Vn[ntrgbins1-i-1])**2+(VnError[i]/Vn[i])**2); rn1[ntrgbins2-i-1]=Vn1[i]/Vn1[ntrgbins1-i-1]; rn1_err[ntrgbins2-i-1]=sqrt((VnError1[ntrgbins1-i-1]/Vn1[ntrgbins1-i-1])**2+(VnError1[i]/Vn1[i])**2); if(nbin==1 && jj==3 ) cout<<rn1[ntrgbins2-i-1]<<" "<<rn1_err[ntrgbins2-i-1]<<endl; rn_tot[ntrgbins2-i-1] = sqrt(rn[ntrgbins2-i-1]*rn1[ntrgbins2-i-1]); rn_tot_err[ntrgbins2-i-1] = rn_tot[ntrgbins2-i-1]*0.5*sqrt(rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]*rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]); rn_ratio[ntrgbins2-i-1] = sqrt(rn[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]); rn_ratio_err[ntrgbins2-i-1] = rn_ratio[ntrgbins2-i-1]*sqrt(rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]*rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1])*0.5; } gr[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn,eta_err,rn_err); gr[jj][nbin]->SetMarkerColor(color[nbin]); gr1[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn1,eta_err,rn1_err); gr1[jj][nbin]->SetMarkerColor(color[nbin]); gr_tot[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_tot,eta_err,rn_tot_err); gr_tot[jj][nbin]->SetMarkerColor(color[nbin]); // gr_tot[jj][nbin]->SetMarkerSize(0.9*gr_tot[jj][nbin]->GetMarkerSize()); gr_ratio[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_ratio,eta_err,rn_ratio_err); gr_ratio[jj][nbin]->SetMarkerColor(color[nbin]); if(jj<5) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp(2*[0]*(-x-4.6))/exp(2*[0]*(x-4.6))",0.0,2.5); else if(jj>=5 && jj<10) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp(2*[0]*(-x-3.5))/exp(2*[0]*(x-3.5))",0.0,1.1); else if(jj>=10) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp(2*[0]*(-x-4.6))/exp(2*[0]*(x-4.6))",0.0,2.06); /* if(jj<4) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1-[1]+[1]*exp([0]*(-x-4.5)))/(1-[1]+[1]*exp([0]*(x-4.5)))",0.0,2.5); else if(jj>=4 && jj<8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1-[1]+[1]*exp([0]*(-x-3.5)))/(1-[1]+[1]*exp([0]*(x-3.5)))",0.0,1.4); else if(jj>=8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1-[1]+[1]*exp([0]*(-x-4.7)))/(1-[1]+[1]*exp([0]*(x-4.7)))",0.0,2.5); */ fit[jj][nbin]->SetParameter(0,0.01); fit[jj][nbin]->SetParameter(1,0.1); fit[jj][nbin]->SetParLimits(1,0,0.2); gr_tot[jj][nbin]->Fit(Form("fit_%d_%d",nbin,jj),"RNO"); fit[jj][nbin]->SetLineColor(color[nbin]); fit[jj][nbin]->SetLineStyle(9); fit[jj][nbin]->SetLineWidth(1); if(jj<5) { slope[nbin][jj] = fit[jj][nbin]->GetParameter(0); slope_err[nbin][jj] = fit[jj][nbin]->GetParError(0); } else { slope1[nbin][jj-10] = fit[jj][nbin]->GetParameter(0); slope1_err[nbin][jj-10] = fit[jj][nbin]->GetParError(0); } // fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"[1]*exp(-[0]*x)+1-[1]",0,5.0); fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"exp(-[0]*x)",0,5.0); fit1_aver[jj][nbin]->SetParameter(0,fit[jj][nbin]->GetParameter(0)); fit1_aver[jj][nbin]->SetParError(0,fit[jj][nbin]->GetParError(0)); // fit1_aver[jj][nbin]->SetParameter(1,fit[jj][nbin]->GetParameter(1)); // fit1_aver[jj][nbin]->SetParError(1,fit[jj][nbin]->GetParError(1)); fit1_aver[jj][nbin]->SetLineStyle(1); fit1_aver[jj][nbin]->SetLineColor(color[nbin]); gr1_band[jj][nbin] = new TGraph(53); for(int mm=0;mm<26;mm++) { gr1_band[jj][nbin]->SetPoint(mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)+fit1_aver[jj][nbin]->GetParError(0)))); gr1_band[jj][nbin]->SetPoint(51-mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)-fit1_aver[jj][nbin]->GetParError(0)))); } gr1_band[jj][nbin]->SetPoint(52,0,1); gr1_band[jj][nbin]->SetFillColor(color[nbin]-10); } } ofstream ff("r2_eta_pPb.txt"); for(int nbin=1;nbin<2;nbin++) { cout<<"i="<<nbin+1<<endl; ff<<"i="<<nbin+1<<endl; for(int j=0;j<5;j++) { cout<<slope[nbin][j]<<" "; ff<<slope[nbin][j]<<", ";} cout<<endl; ff<<endl; for(int j=0;j<5;j++) { cout<<slope_err[nbin][j]<<" "; ff<<slope_err[nbin][j]<<", ";} cout<<endl; ff<<endl; } TString histtitle[5] = {"120 #leq N_{trk}^{offline} < 150", "150 #leq N_{trk}^{offline} < 185", "185 #leq N_{trk}^{offline} < 220", "220 #leq N_{trk}^{offline} < 260", "N_{trk}^{offline} #geq 260"}; TLine* ll = new TLine(0,1.,2.65,1.); TCanvas* c = new TCanvas("c","c",530,500); makeMultiPanelCanvas(c,2,2,0.01,0.0,0.2,0.18,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};#sqrt{r_{2}(-#eta^{a},-#eta^{b}) #times r_{2}(#eta^{a},#eta^{b})}",100,-0.1,2.5,100,0.601,1.06); fixedFontHist(htmp,1.8,2.1); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<4;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr_tot[jj][1]->SetMarkerStyle(25); gr_tot[jj][1]->Draw("Psame"); fit[jj][1]->Draw("Lsame"); gr_tot[jj+5][1]->SetMarkerStyle(24); gr_tot[jj+5][1]->Draw("Psame"); gr_tot[jj+10][1]->SetMarkerStyle(28); gr_tot[jj+10][1]->SetMarkerColor(1); gr_tot[jj+10][1]->Draw("Psame"); /* gr_tot[jj+8][1]->SetMarkerStyle(28); fit[jj+8][1]->SetLineStyle(9); gr_tot[jj+8][1]->Draw("Psame"); fit[jj+8][1]->Draw("Lsame"); */ } TLatex* latex = new TLatex(); latex->SetNDC(); latex->SetTextSize(1.3*latex->GetTextSize()); c->cd(1); latex->DrawLatex(0.27,0.05,histtitle[0]); // latex->DrawLatex(0.58,0.74,"0.3 < p_{T}^{a} < 3 GeV/c"); // latex->DrawLatex(0.58,0.65,"p_{T}^{b} > 0 GeV/c"); latex->DrawLatex(0.24,0.885,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); latex->DrawLatex(0.68,0.7,"L_{int} = 35 nb^{-1}"); c->cd(2); latex->DrawLatex(0.12,0.27,"0.3 < p_{T}^{a} < 3 GeV/c"); latex->DrawLatex(0.12,0.18,"p_{T}^{b} > 0 GeV/c"); latex->DrawLatex(0.09,0.05,histtitle[1]); c->cd(4); latex->SetTextSize(0.9*latex->GetTextSize()); latex->DrawLatex(0.09,0.22,histtitle[3]); latex->SetTextSize(latex->GetTextSize()/0.9); c->cd(3); latex->SetTextSize(0.85*latex->GetTextSize()); latex->DrawLatex(0.27,0.22,histtitle[2]); TLegend* legend = new TLegend(0.25,0.18,0.62,0.39); legend->SetFillStyle(0); // legend->AddEntry(gr_tot[8][1],"4.4<#eta^{b}<5","P"); legend->AddEntry(gr_tot[0][1],"4.4<#eta^{b}<5","P"); // legend->AddEntry(fit[0][1],"Exponential fit","L"); legend->AddEntry(gr_tot[10][1],"4<#eta^{b}<5","P"); legend->AddEntry(gr_tot[5][1],"3<#eta^{b}<4","P"); // legend->AddEntry(fit[4][1],"Exponential fit","L"); c->cd(1); legend->Draw(); TLine* ll = new TLine(0,1.,5.0,1.); TCanvas* ca = new TCanvas("ca","ca",560,500); makeMultiPanelCanvas(ca,2,2,0.02,0.0,0.27,0.18,0.02); TH2D* htmpa = new TH2D("htmpa",";#eta^{a};#frac{v_{2}(#eta^{a})}{v_{2}(-#eta^{a})} = #sqrt{#frac{r_{2}(#eta^{a},#eta^{b})}{r_{2}(-#eta^{a},-#eta^{b})}}",100,-0.1,2.5,100,0.91,1.045); fixedFontHist(htmpa,1.8,2.7); htmpa->GetXaxis()->CenterTitle(); htmpa->GetYaxis()->CenterTitle(); htmpa->GetYaxis()->SetTitleSize(htmpa->GetYaxis()->GetTitleSize()*1.15); htmpa->GetXaxis()->SetTitleSize(htmpa->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<4;jj++) { ca->cd(jj+1); htmpa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->Draw("Psame"); gr_ratio[jj+5][1]->SetMarkerStyle(24); gr_ratio[jj+5][1]->Draw("Psame"); } TLatex* latex1 = new TLatex(); latex1->SetNDC(); latex1->SetTextSize(1.3*latex1->GetTextSize()); ca->cd(1); latex1->DrawLatex(0.33,0.05,histtitle[0]); latex1->DrawLatex(0.31,0.88,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); latex1->DrawLatex(0.31,0.77,"L_{int} = 35 nb^{-1}"); ca->cd(2); latex1->DrawLatex(0.075,0.05,histtitle[1]); latex1->DrawLatex(0.08,0.29,"0.3 < p_{T}^{a} < 3 GeV/c"); latex1->DrawLatex(0.08,0.19,"p_{T}^{b} > 0 GeV/c"); ca->cd(4); latex1->SetTextSize(0.9*latex1->GetTextSize()); latex1->DrawLatex(0.075,0.22,histtitle[3]); latex1->SetTextSize(latex1->GetTextSize()/0.9); ca->cd(3); latex1->SetTextSize(0.85*latex1->GetTextSize()); latex1->DrawLatex(0.33,0.22,histtitle[2]); TLegend* legend1 = new TLegend(0.34,0.15,0.57,0.35); legend1->SetFillStyle(0); legend1->AddEntry(gr_ratio[0][1],"4.4<#eta^{b}<5","P"); legend1->AddEntry(gr_ratio[5][1],"3<#eta^{b}<4","P"); ca->cd(1); legend1->Draw(); TCanvas* c2 = new TCanvas("c2","c2",810,400); makeMultiPanelCanvas(c2,4,2,0.016,0.0,0.24,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.61,1.06); fixedFontHist(htmp2,1.6,1.8); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.3); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); TH2D* htmp2a = (TH2D*)htmp2->Clone("tmp2a"); htmp2a->SetTitle(";#eta^{a};r_{2}(-#eta^{a},-#eta^{b})"); for(int jj=0;jj<4;jj++) { c2->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][1]->Draw("Psame"); gr[jj+5][1]->SetMarkerStyle(24); gr[jj+5][1]->Draw("Psame"); c2->cd(jj+5); htmp2a->Draw(); ll->Draw("Lsame"); gr1[jj][1]->Draw("Psame"); gr1[jj+5][1]->SetMarkerStyle(24); gr1[jj+5][1]->Draw("Psame"); } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c2->cd(1); latex2->DrawLatex(0.30,0.05,histtitle[0]); latex2->DrawLatex(0.28,0.865,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); c2->cd(2); latex2->DrawLatex(0.08,0.05,histtitle[1]); latex2->DrawLatex(0.07,0.3,"0.3 < p_{T}^{a} < 3 GeV/c"); latex2->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); c2->cd(4); latex2->DrawLatex(0.08,0.05,histtitle[3]); c2->cd(3); latex2->DrawLatex(0.08,0.05,histtitle[2]); c2->cd(6); latex2->SetTextSize(0.96*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,histtitle[1]); c2->cd(8); latex2->DrawLatex(0.08,0.24,histtitle[3]); c2->cd(7); latex2->DrawLatex(0.08,0.24,histtitle[2]); c2->cd(5); latex2->SetTextSize(0.9*latex2->GetTextSize()); latex2->DrawLatex(0.3,0.24,histtitle[0]); TLegend* legend2 = new TLegend(0.3,0.18,0.6,0.44); legend2->SetFillStyle(0); legend2->AddEntry(gr_ratio[0][1],"4.4<#eta^{b}<5","P"); legend2->AddEntry(gr_ratio[5][1],"3<#eta^{b}<4","P"); c2->cd(1); legend2->Draw(); /* TCanvas* cc2 = new TCanvas("cc2","cc2",530,500); makeMultiPanelCanvas(cc2,2,2,0.01,0.0,0.2,0.18,0.02); TH2D* htmp22 = new TH2D("htmp22",";|#eta^{a}-#eta^{b}|;cos[n(#Psi_{n}(#eta^{a})-#Psi_{n}(#eta^{b}))]",100,0,5,100,0.731,1.06); fixedFontHist(htmp22,1.8,2.2); htmp22->GetXaxis()->CenterTitle(); htmp22->GetYaxis()->CenterTitle(); htmp22->GetYaxis()->SetTitleSize(htmp22->GetYaxis()->GetTitleSize()*1.1); htmp22->GetXaxis()->SetTitleSize(htmp22->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<4;jj++) { cc2->cd(jj+1); htmp22->Draw(); ll->Draw("Lsame"); gr1_band[jj][1]->Draw("Fsame"); fit1_aver[jj][1]->Draw("Lsame"); } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.4*latex3->GetTextSize()); cc2->cd(1); latex3->DrawLatex(0.26,0.05,histtitle[0]); latex3->DrawLatex(0.24,0.865,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); cc2->cd(2); latex3->DrawLatex(0.075,0.05,histtitle[1]); cc2->cd(4); latex3->DrawLatex(0.075,0.22,histtitle[3]); cc2->cd(3); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.24,0.22,histtitle[2]); */ SaveCanvas(c,"HI/FactBreak","epetadeco_pPb_alletab_r2tot"); SaveCanvas(c2,"HI/FactBreak","epetadeco_pPb_alletab_r2sep"); SaveCanvas(ca,"HI/FactBreak","epetadeco_pPb_alletab_r2ratio"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_pPb_cos"); }
void RPCSeedValidator(string FileName) { gStyle->SetOptStat(""); gStyle->SetOptTitle(0); if(debug) cout << FileName << endl; string theFileName = "../" + FileName; TFile* RootFile = TFile::Open(theFileName.c_str()); string OutputPlotNameFix = ".eps"; string FinalOutput = FileName + "_"; unsigned int EventNumber; int SimTrackId; int SimTrackType; double SimTrackMomentum; double SimTrackDirectionPhi; int SimTrackCharge; int SimTrackvalid; bool PassSegmentFilter; double SimMomentumPtatRef; double SimDirectionPhiatRef; double SimDirectionEtaatRef; double SimBendingPhi; double SimBendingEntryPositionX; double SimBendingEntryPositionY; double SimBendingEntryPositionZ; double SimBendingLeavePositionX; double SimBendingLeavePositionY; double SimBendingLeavePositionZ; unsigned int SeedNumber; int SeedCharge; double SeedPurity; double SeedQuality; double RecMomentumPtatRef; double RecDirectionPhiatRef; double RecDirectionEtaatRef; double RecBendingPhi; double RecBendingEntryPositionX; double RecBendingEntryPositionY; double RecBendingEntryPositionZ; double RecBendingLeavePositionX; double RecBendingLeavePositionY; double RecBendingLeavePositionZ; double RecBendingLastPhi; TTree* T0 = (TTree*)RootFile->Get("ExTree"); T0->SetBranchAddress("EventNumber", &EventNumber); T0->SetBranchAddress("SimTrackId", &SimTrackId); T0->SetBranchAddress("SimTrackType", &SimTrackType); T0->SetBranchAddress("SimTrackMomentum", &SimTrackMomentum); T0->SetBranchAddress("SimTrackDirectionPhi", &SimTrackDirectionPhi); T0->SetBranchAddress("SimTrackCharge", &SimTrackCharge); T0->SetBranchAddress("SimTrackValid", &SimTrackvalid); T0->SetBranchAddress("PassSegmentFilter", &PassSegmentFilter); T0->SetBranchAddress("SimMomentumPtatRef", &SimMomentumPtatRef); T0->SetBranchAddress("SimDirectionPhiatRef", &SimDirectionPhiatRef); T0->SetBranchAddress("SimDirectionEtaatRef", &SimDirectionEtaatRef); T0->SetBranchAddress("SimBendingPhi", &SimBendingPhi); T0->SetBranchAddress("SimBendingEntryPositionX", &SimBendingEntryPositionX); T0->SetBranchAddress("SimBendingEntryPositionY", &SimBendingEntryPositionY); T0->SetBranchAddress("SimBendingEntryPositionZ", &SimBendingEntryPositionZ); T0->SetBranchAddress("SimBendingLeavePositionX", &SimBendingLeavePositionX); T0->SetBranchAddress("SimBendingLeavePositionY", &SimBendingLeavePositionY); T0->SetBranchAddress("SimBendingLeavePositionZ", &SimBendingLeavePositionZ); T0->SetBranchAddress("SeedNumber", &SeedNumber); T0->SetBranchAddress("SeedCharge", &SeedCharge); T0->SetBranchAddress("SeedPurity", &SeedPurity); T0->SetBranchAddress("SeedQuality", &SeedQuality); T0->SetBranchAddress("RecMomentumPtatRef", &RecMomentumPtatRef); T0->SetBranchAddress("RecDirectionPhiatRef", &RecDirectionPhiatRef); T0->SetBranchAddress("RecDirectionEtaatRef", &RecDirectionEtaatRef); T0->SetBranchAddress("RecBendingPhi", &RecBendingPhi); T0->SetBranchAddress("RecBendingEntryPositionX", &RecBendingEntryPositionX); T0->SetBranchAddress("RecBendingEntryPositionY", &RecBendingEntryPositionY); T0->SetBranchAddress("RecBendingEntryPositionZ", &RecBendingEntryPositionZ); T0->SetBranchAddress("RecBendingLeavePositionX", &RecBendingLeavePositionX); T0->SetBranchAddress("RecBendingLeavePositionY", &RecBendingLeavePositionY); T0->SetBranchAddress("RecBendingLeavePositionZ", &RecBendingLeavePositionZ); T0->SetBranchAddress("RecBendingLastPhi", &RecBendingLastPhi); TH1D* SimTrackvalidHist = (TH1D*) new TH1D("SimTrackvalidHist", "SimTrackvalidHist", 2, 0, 2); TH1D* SeedPtforSimTrackvalidHist = (TH1D*) new TH1D("SeedPtforSimTrackvalidHist", "SeedPtforSimTrackvalidHist", 100, 0, 100); TH1D* SeeddeltaPtforSimTrackvalidHist = (TH1D*) new TH1D("SeeddeltaPtforSimTrackvalidHist", "SeeddeltaPtforSimTrackvalidHist", 150, -3., 3.); TH1D* SeeddeltaPhiforSimTrackvalidHist = (TH1D*) new TH1D("SeeddeltaPhiforSimTrackvalidHist", "SeeddeltaPhiforSimTrackvalidHist", 628, -3.14/6, 3.14/6); TH1D* SeeddeltaEtaforSimTrackvalidHist = (TH1D*) new TH1D("SeeddeltaEtaforSimTrackvalidHist", "SeeddeltaEtaforSimTrackvalidHist", 200, -1., 1.); TH1D* SeedPurityforSimTrackvalidHist = (TH1D*) new TH1D("SeedPurityforSimTrackvalidHist", "SeedPurityforSimTrackvalidHist", 20, 0, 2); TH1D* ChargeCheckforSimTrackvalidHist = (TH1D*) new TH1D("ChargeCheckforSimTrackvalidHist", "ChargeCheckforSimTrackvalidHist", 5, -2.5, 2.5); TH1D* SeedNumberforSimTrackvalidHist = (TH1D*) new TH1D("SeedNumberforSimTrackvalidHist", "SeedNumberforSimTrackvalidHist", 30, 0, 30); TH1D* SeedEfficiencyforSimTrackvalidHist = (TH1D*) new TH1D("SeedEfficiencyforSimTrackvalidHist", "SeedEfficiencyforSimTrackvalidHist", 2, 0, 2); TH1D* SeedNumberforSimTrackinvalidHist = (TH1D*) new TH1D("SeedNumberforSimTrackinvalidHist", "SeedNumberforSimTrackinvalidHist", 20, 0, 20); TH1D* SeedEfficiencyforSimTrackinvalidHist = (TH1D*) new TH1D("SeedEfficiencyforSimTrackinvalidHist", "SeedEfficiencyforSimTrackinvalidHist", 2, 0, 2); TH1D* RecBendingLastPhiHist = (TH1D*) new TH1D("RecBendingLastPhiHist", "RecBendingLastPhiHist", 628, -3.14/2, 3.14/2); TH1D* SeedEfficiencyHist = (TH1D*) new TH1D("SeedEfficiency", "SeedEfficiency", 2, 0, 2); TH2D* RecBendingPhi2PtHist = new TH2D("RecBendingPhi2PtHist", "RecBendingPhi2PtHist", 2000, -100, 100, 628, -3.14/4, 3.14/4); TH2D* PtRatoofRecBendingPhiHist = new TH2D("", "", 628, -3.14/4, 3.14/4, 2000, -100, 100); TObjArray* SimReverseBending = (TObjArray*) new TObjArray(); unsigned int LastSeedNumber = -1; unsigned int LastSimTrackvalid = 0; bool LastPassSegmentFilter = false; bool LastPurityFull = false; int Nentries = T0->GetEntries(); for(int i = 0; i < Nentries; i++) { T0->GetEntry(i); if(debug) cout << "SimTrackId: " << SimTrackId << ", SimTrackType: " << SimTrackType << ", PassSegmentFilter: " << PassSegmentFilter << ", SeedNumber: " << SeedNumber << ", SeedPurity: " << SeedPurity << ", SeedCharge: " << SeedCharge << ", SimTrackCharge: " << SimTrackCharge << ", SimBendingPhi: " << SimBendingPhi << ", RecBendingPhi: " << RecBendingPhi << ", RecBendingLastPhi: " << RecBendingLastPhi << ", RecMomentumPtatRef: " << RecMomentumPtatRef << ", SimMomentumPtatRef: " << SimMomentumPtatRef << ", LastSeedNumber: " << LastSeedNumber << endl; //if(SimTrackMomentum > 20.0) //continue; if(SeedNumber != 0) { if(SimTrackvalid == 1 && SeedPurity == 1. && PassSegmentFilter == true) { SeedPtforSimTrackvalidHist->Fill(RecMomentumPtatRef); SeeddeltaPtforSimTrackvalidHist->Fill((RecMomentumPtatRef-SimMomentumPtatRef)/SimMomentumPtatRef); SeeddeltaPhiforSimTrackvalidHist->Fill(RecDirectionPhiatRef-SimDirectionPhiatRef); SeeddeltaEtaforSimTrackvalidHist->Fill(RecDirectionEtaatRef-SimDirectionEtaatRef); RecBendingPhi2PtHist->Fill(SimMomentumPtatRef*SimTrackCharge, RecBendingPhi); double PtRato = SimMomentumPtatRef / RecMomentumPtatRef; if(debug) cout << "PtRato: " << PtRato << ", at RecBendingPhi: " << RecBendingPhi << endl; PtRatoofRecBendingPhiHist->Fill(RecBendingPhi, PtRato); RecBendingLastPhiHist->Fill((RecBendingLastPhi == 0. ? 0 : RecBendingLastPhi/fabs(RecBendingLastPhi))*SimTrackCharge); SeedPurityforSimTrackvalidHist->Fill(SeedPurity); ChargeCheckforSimTrackvalidHist->Fill(SeedCharge*SimTrackCharge); /* if(SeedPurity == 1) { //SeedPtforSimTrackvalidHist->Fill(RecMomentumPtatRef); //SeeddeltaPtforSimTrackvalidHist->Fill(RecMomentumPtatRef-SimMomentumPtatRef); RecBendingPhi2PtHist->Fill(SimMomentumPtatRef*SimTrackCharge, RecBendingPhi); double PtRato = SimMomentumPtatRef / RecMomentumPtatRef; if(debug) cout << "PtRato: " << PtRato << ", at RecBendingPhi: " << RecBendingPhi << endl; PtRatoofRecBendingPhiHist->Fill(RecBendingPhi, PtRato); RecBendingLastPhiHist->Fill((RecBendingLastPhi == 0. ? 0 : RecBendingLastPhi/fabs(RecBendingLastPhi))*SimTrackCharge); } */ if(SeedCharge*SimTrackCharge == -1) { if(debug) cout << "R1: " << sqrt(SimBendingEntryPositionX*SimBendingEntryPositionX+SimBendingEntryPositionY*SimBendingEntryPositionY) << ", R2: " << sqrt(SimBendingLeavePositionX*SimBendingLeavePositionX+SimBendingLeavePositionY*SimBendingLeavePositionY) << endl; TLine* SimSegment = new TLine(SimBendingEntryPositionX, SimBendingEntryPositionY, SimBendingLeavePositionX, SimBendingLeavePositionY); SimReverseBending->AddLast(SimSegment); } LastPurityFull = true; } } else { if(LastSeedNumber != -1) { if(LastSimTrackvalid == 1 && LastPassSegmentFilter == true) { if(debug) cout << "Filling valid track efficiency " << LastSeedNumber << endl; SeedNumberforSimTrackvalidHist->Fill(LastSeedNumber); SeedEfficiencyforSimTrackvalidHist->Fill(LastPurityFull==true?1:0); } else { SeedNumberforSimTrackinvalidHist->Fill(LastSeedNumber); SeedEfficiencyforSimTrackinvalidHist->Fill(LastPurityFull==true?1:0); } LastPurityFull = false; } } LastPassSegmentFilter = PassSegmentFilter; LastSeedNumber = SeedNumber; LastSimTrackvalid = SimTrackvalid; } if(LastSeedNumber != -1) { if(LastSimTrackvalid == 1 && LastPassSegmentFilter == true) { SeedNumberforSimTrackvalidHist->Fill(LastSeedNumber); SeedEfficiencyforSimTrackvalidHist->Fill(LastPurityFull==true?1:0); } else { SeedNumberforSimTrackinvalidHist->Fill(LastSeedNumber); SeedEfficiencyforSimTrackinvalidHist->Fill(LastPurityFull == true?1:0); } } TCanvas* SimTrackvalidCanvas = new TCanvas("SimTrackvalidCanvas", "SimTrackvalidCanvas", 800, 600); SimTrackvalidCanvas->cd(); SimTrackvalidHist->Draw(); string SimTrackvalidCanvasName = FinalOutput + "SimTrackvalid" + OutputPlotNameFix; SimTrackvalidCanvas->SaveAs(SimTrackvalidCanvasName.c_str()); TCanvas* SeedPtforSimTrackvalidCanvas = new TCanvas("SeedPtforSimTrackvalidCanvas", "SeedPtforSimTrackvalidCanvas", 800, 600); SeedPtforSimTrackvalidCanvas->cd(); SeedPtforSimTrackvalidHist->Draw(); string SeedPtforSimTrackvalidCanvasName = FinalOutput + "SeedPtforSimTrackvalid" + OutputPlotNameFix; SeedPtforSimTrackvalidCanvas->SaveAs(SeedPtforSimTrackvalidCanvasName.c_str()); TCanvas* SeeddeltaPtforSimTrackvalidCanvas = new TCanvas("SeeddeltaPtforSimTrackvalidCanvas", "SeeddeltaPtforSimTrackvalidCanvas", 800, 600); SeeddeltaPtforSimTrackvalidCanvas->cd(); SeeddeltaPtforSimTrackvalidHist->SetStats(1); gStyle->SetOptFit(0111); //SeeddeltaPtforSimTrackvalidHist->Fit("gaus", "", "", -1., 1.); SeeddeltaPtforSimTrackvalidHist->GetXaxis()->SetTitle("(recPt-simPt)/simPt"); SeeddeltaPtforSimTrackvalidHist->GetXaxis()->CenterTitle(); SeeddeltaPtforSimTrackvalidHist->Draw(); string SeeddeltaPtforSimTrackvalidCanvasName = FinalOutput + "SeeddeltaPtforSimTrackvalid" + OutputPlotNameFix; SeeddeltaPtforSimTrackvalidCanvas->SaveAs(SeeddeltaPtforSimTrackvalidCanvasName.c_str()); TCanvas* SeeddeltaPhiforSimTrackvalidCanvas = new TCanvas("SeeddeltaPhiforSimTrackvalidCanvas", "SeeddeltaPhiforSimTrackvalidCanvas", 800, 600); SeeddeltaPhiforSimTrackvalidCanvas->cd(); SeeddeltaPhiforSimTrackvalidHist->SetStats(1); SeeddeltaPhiforSimTrackvalidHist->GetXaxis()->SetTitle("(recPhi-simPhi)"); SeeddeltaPhiforSimTrackvalidHist->GetXaxis()->CenterTitle(); SeeddeltaPhiforSimTrackvalidHist->Draw(); string SeeddeltaPhiforSimTrackvalidCanvasName = FinalOutput + "SeeddeltaPhiforSimTrackvalid" + OutputPlotNameFix; SeeddeltaPhiforSimTrackvalidCanvas->SaveAs(SeeddeltaPhiforSimTrackvalidCanvasName.c_str()); TCanvas* SeeddeltaEtaforSimTrackvalidCanvas = new TCanvas("SeeddeltaEtaforSimTrackvalidCanvas", "SeeddeltaEtaforSimTrackvalidCanvas", 800, 600); SeeddeltaEtaforSimTrackvalidCanvas->cd(); SeeddeltaEtaforSimTrackvalidHist->SetStats(1); SeeddeltaEtaforSimTrackvalidHist->GetXaxis()->SetTitle("(recEta-simEta)"); SeeddeltaEtaforSimTrackvalidHist->GetXaxis()->CenterTitle(); SeeddeltaEtaforSimTrackvalidHist->Draw(); string SeeddeltaEtaforSimTrackvalidCanvasName = FinalOutput + "SeeddeltaEtaforSimTrackvalid" + OutputPlotNameFix; SeeddeltaEtaforSimTrackvalidCanvas->SaveAs(SeeddeltaEtaforSimTrackvalidCanvasName.c_str()); TCanvas* SeedPurityforSimTrackvalidCanvas = new TCanvas("SeedPurityforSimTrackvalidCanvas", "SeedPurityforSimTrackvalidCanvas", 800, 600); SeedPurityforSimTrackvalidCanvas->cd(); SeedPurityforSimTrackvalidHist->Draw(); string SeedPurityforSimTrackvalidCanvasName = FinalOutput + "SeedPurityforSimTrackvalid" + OutputPlotNameFix; SeedPurityforSimTrackvalidCanvas->SaveAs(SeedPurityforSimTrackvalidCanvasName.c_str()); TCanvas* ChargeCheckforSimTrackvalidCanvas = new TCanvas("ChargeCheckforSimTrackvalidCanvas", "ChargeCheckforSimTrackvalidCanvas", 800, 600); ChargeCheckforSimTrackvalidCanvas->cd(); double HistEntries = ChargeCheckforSimTrackvalidHist->GetEntries() / 100.; ChargeCheckforSimTrackvalidHist->Scale(1./HistEntries); ChargeCheckforSimTrackvalidHist->GetXaxis()->SetTitle("simCharge*recCharge"); ChargeCheckforSimTrackvalidHist->GetXaxis()->CenterTitle(1); ChargeCheckforSimTrackvalidHist->GetYaxis()->SetTitle("fraction %"); ChargeCheckforSimTrackvalidHist->GetYaxis()->CenterTitle(1); ChargeCheckforSimTrackvalidHist->Draw(); string ChargeCheckforSimTrackvalidCanvasName = FinalOutput + "ChargeCheckforSimTrackvalid" + OutputPlotNameFix; ChargeCheckforSimTrackvalidCanvas->SaveAs(ChargeCheckforSimTrackvalidCanvasName.c_str()); TCanvas* SeedNumberforSimTrackvalidCanvas = new TCanvas("SeedNumberforSimTrackvalidCanvas", "SeedNumberforSimTrackvalidCanvas", 800, 600); SeedNumberforSimTrackvalidCanvas->cd(); SeedNumberforSimTrackvalidHist->Draw(); string SeedNumberforSimTrackvalidCanvasName = FinalOutput + "SeedNumberforSimTrackvalid" + OutputPlotNameFix; SeedNumberforSimTrackvalidCanvas->SaveAs(SeedNumberforSimTrackvalidCanvasName.c_str()); TCanvas* SeedEfficiencyforSimTrackvalidCanvas = new TCanvas("SeedEfficiencyforSimTrackvalidCanvas", "SeedEfficiencyforSimTrackvalidCanvas", 800, 600); SeedEfficiencyforSimTrackvalidCanvas->cd(); SeedEfficiencyforSimTrackvalidHist->Draw(); string SeedEfficiencyforSimTrackvalidCanvasName = FinalOutput + "SeedEfficiencyforSimTrackvalid" + OutputPlotNameFix; SeedEfficiencyforSimTrackvalidCanvas->SaveAs(SeedEfficiencyforSimTrackvalidCanvasName.c_str()); TCanvas* SeedNumberforSimTrackinvalidCanvas = new TCanvas("SeedNumberforSimTrackinvalidCanvas", "SeedNumberforSimTrackinvalidCanvas", 800, 600); SeedNumberforSimTrackinvalidCanvas->cd(); SeedNumberforSimTrackinvalidHist->Draw(); string SeedNumberforSimTrackinvalidCanvasName = FinalOutput + "SeedNumberforSimTrackinvalid" + OutputPlotNameFix; SeedNumberforSimTrackinvalidCanvas->SaveAs(SeedNumberforSimTrackinvalidCanvasName.c_str()); TCanvas* SeedEfficiencyforSimTrackinvalidCanvas = new TCanvas("SeedEfficiencyforSimTrackinvalidCanvas", "SeedEfficiencyforSimTrackinvalidCanvas", 800, 600); SeedEfficiencyforSimTrackinvalidCanvas->cd(); SeedEfficiencyforSimTrackinvalidHist->Draw(); string SeedEfficiencyforSimTrackinvalidCanvasName = FinalOutput + "SeedEfficiencyforSimTrackinvalid" + OutputPlotNameFix; SeedEfficiencyforSimTrackinvalidCanvas->SaveAs(SeedEfficiencyforSimTrackinvalidCanvasName.c_str()); double SeedEfficiencyforSimTrackinvalid = 100. * SeedEfficiencyforSimTrackinvalidHist->GetMean(); double SeedEfficiencyforSimTrackvalid = 100. * SeedEfficiencyforSimTrackvalidHist->GetMean(); SeedEfficiencyHist->SetBinContent(1, SeedEfficiencyforSimTrackinvalid); SeedEfficiencyHist->SetBinContent(2, SeedEfficiencyforSimTrackvalid); SeedEfficiencyHist->GetXaxis()->SetBinLabel(1, "for invalid simTrack"); SeedEfficiencyHist->GetXaxis()->SetBinLabel(2, "for valid simTrack"); TCanvas* SeedEfficiencyCanvas = new TCanvas("SeedEfficiencyCanvas", "SeedEfficiencyCanvas", 800, 600); SeedEfficiencyCanvas->cd(); SeedEfficiencyHist->GetYaxis()->SetTitle("Efficiency %"); SeedEfficiencyHist->GetYaxis()->CenterTitle(1); SeedEfficiencyHist->SetMarkerStyle(3); SeedEfficiencyHist->SetMarkerSize(3); SeedEfficiencyHist->Draw("P"); string SeedEfficiencyCanvasName = FinalOutput + "SeedEfficiency" + OutputPlotNameFix; SeedEfficiencyCanvas->SaveAs(SeedEfficiencyCanvasName.c_str()); TCanvas* RecBendingPhi2PtCanvas = new TCanvas("RecBendingPhi2PtCanvas", "RecBendingPhi2PtCanvas", 800, 600); RecBendingPhi2PtCanvas->cd(); RecBendingPhi2PtHist->Draw(); string RecBendingPhi2PtCanvasName = FinalOutput + "RecBendingPhi2Pt" + OutputPlotNameFix; RecBendingPhi2PtCanvas->SaveAs(RecBendingPhi2PtCanvasName.c_str()); TCanvas* PtRatoofRecBendingPhiCanvas = new TCanvas("PtRatoofRecBendingPhiCanvas", "PtRatoofRecBendingPhiCanvas", 800, 600); PtRatoofRecBendingPhiCanvas->cd(); PtRatoofRecBendingPhiHist->Draw(); string PtRatoofRecBendingPhiCanvasName = FinalOutput + "PtRatoofRecBendingPhi" + OutputPlotNameFix; PtRatoofRecBendingPhiCanvas->SaveAs(PtRatoofRecBendingPhiCanvasName.c_str()); TCanvas* RecBendingLastPhiCanvas = new TCanvas("RecBendingLastPhiCanvas", "RecBendingLastPhiCanvas", 800, 600); RecBendingLastPhiCanvas->cd(); RecBendingLastPhiHist->Draw(); string RecBendingLastPhiCanvasName = FinalOutput + "RecBendingLastPhi" + OutputPlotNameFix; RecBendingLastPhiCanvas->SaveAs(RecBendingLastPhiCanvasName.c_str()); Int_t linsav = gStyle->GetLineWidth(); gStyle->SetLineWidth(2); TCanvas* SimReverseBendingCanvas = new TCanvas("SimReverseBendingCanvas", "SimReverseBendingCanvas", 800, 800); SimReverseBendingCanvas->cd(); TPad* SimReverseBendingPad = new TPad("SimReverseBendingPad", "SimReverseBendingPad", 0, 0, 1, 1); SimReverseBendingPad->Draw(); SimReverseBendingPad->cd(); SimReverseBendingPad->Range(-800, -800, 800, 800); unsigned int segmentNumber = SimReverseBending->GetEntries(); cout << "Number of segments: " << segmentNumber << endl; for(unsigned int j = 0; j < segmentNumber; j++) { ((TLine*)(SimReverseBending->At(j)))->Print(); ((TLine*)(SimReverseBending->At(j)))->Draw("SAME"); } string SimReverseBendingCanvasName = FinalOutput + "SimReverseBending" + OutputPlotNameFix; SimReverseBendingCanvas->SaveAs(SimReverseBendingCanvasName.c_str()); }
void toyV2Generator(const unsigned int numberEvents=300, const unsigned int particlesPerEvent=500, const bool useFlow=true, const float v2Factor=0.20, const bool writeHistogramFile=true, const bool readHistogramFile=false, const unsigned int nBinsOneD=100, const unsigned int nBinsX=40, const unsigned int nBinsY=40, const unsigned int iBinXMinPlot=3, const unsigned int iBinYMinPlot=3, const unsigned int iBinXMaxPlot=37, const unsigned int iBinYMaxPlot=37) { if(readHistogramFile && writeHistogramFile) { cerr << "\n Cannot do a simultaneous read and write of the histogram file"; cerr << endl; return; } const unsigned int particlesPerEventLessOne = particlesPerEvent - 1; float particleEta[particlesPerEvent]; float particlePhi[particlesPerEvent]; float particlePhiLab[particlesPerEvent]; float particleEtaPreviousEvent[particlesPerEvent]; float particlePhiLabPreviousEvent[particlesPerEvent]; // // Function to provide azimuthal angles according to a v2 distribution // char flowFunction[200]; sprintf(flowFunction, "1.0 + %4.2f*2.0*cos(2.0*x)", v2Factor); TF1 *v2Flow = new TF1("v2Flow", flowFunction, 0.0, 2.0*TMath::Pi()); const float highEtaBin = 3.0; const float lowEtaBin = -3.0; const float highPhiBin = 1.5*TMath::Pi(); const float lowPhiBin = -0.5*TMath::Pi(); float mixedEventWeight = float(particlesPerEvent)*float(particlesPerEvent - 1)/(2.0*float(particlesPerEvent*particlesPerEvent)); // // Single particle range in eta will be half the maximum for deltaEta // const float diffEta = 0.5*(highEtaBin - lowEtaBin); TH1D *particlePhiHistogram = 0; TH1D *particlePhiLabHistogram = 0; TH1D *particleEtaHistogram = 0; TH1D *pairDeltaPhiHistogram = 0; TH1D *pairDeltaPhiHistogramMixed = 0; TH1D *pairDeltaPhiHistogramNormalized = 0; TH1D *pairDeltaEtaHistogram = 0; TH1D *pairDeltaEtaHistogramMixed = 0; TH1D *pairDeltaEtaHistogramNormalized = 0; TH2D *pairDeltaEtaDeltaPhiHistogram = 0; TH2D *pairDeltaEtaDeltaPhiHistogramMixed = 0; TH2D *pairDeltaEtaDeltaPhiHistogramNormalized = 0; if(!readHistogramFile) { particlePhiHistogram = new TH1D("particlePhiHistogram", "Particle azimuthal distribution in reaction plane", nBinsOneD, 0.0, 2.0*TMath::Pi()); particlePhiHistogram->SetXTitle("Particle azimuthal angle #phi (radians)"); particlePhiHistogram->SetYTitle("Counts per 0.063 radians bin"); particlePhiLabHistogram = new TH1D("particlePhiLabHistogram", "Particle azimuthal distribution in lab frame", nBinsOneD, 0.0, 2.0*TMath::Pi()); particlePhiLabHistogram->SetXTitle("Particle azimuthal angle #phi (radians)"); particlePhiLabHistogram->SetYTitle("Counts per 0.063 radians bin"); particleEtaHistogram = new TH1D("particleEtaHistogram", "Particle azimuthal distribution", nBinsOneD, lowEtaBin, highEtaBin); particleEtaHistogram->SetXTitle("Particle #eta"); particleEtaHistogram->SetYTitle("Counts per 0.015 bin"); pairDeltaPhiHistogram = new TH1D("pairDeltaPhiHistogram", "#Delta #phi pairs in lab frame", nBinsOneD, lowPhiBin, highPhiBin); pairDeltaPhiHistogram->SetXTitle("#Delta #phi (radians)"); pairDeltaPhiHistogram->SetYTitle("Counts"); pairDeltaPhiHistogramMixed = new TH1D("pairDeltaPhiHistogramMixed", "#Delta #phi pairs in lab frame, mixed-event", nBinsOneD, lowPhiBin, highPhiBin); pairDeltaPhiHistogramMixed->SetXTitle("#Delta #phi (radians)"); pairDeltaPhiHistogramMixed->SetYTitle("Counts"); pairDeltaPhiHistogramNormalized = new TH1D("pairDeltaPhiHistogramNormalized", "Normalized #Delta #phi pairs in lab frame", nBinsOneD, lowPhiBin, highPhiBin); pairDeltaPhiHistogramNormalized->SetXTitle("#Delta #phi (radians)"); pairDeltaPhiHistogramNormalized->SetYTitle("Counts"); pairDeltaEtaHistogram = new TH1D("pairDeltaEtaHistogram", "#Delta #eta Pairs, Same Event", nBinsOneD, lowEtaBin, highEtaBin); pairDeltaEtaHistogram->SetXTitle("#Delta #eta (radians)"); pairDeltaEtaHistogram->SetYTitle("Counts"); pairDeltaEtaHistogramMixed = new TH1D("pairDeltaEtaHistogramMixed", "#Delta #eta Pairs, Mixed Event", nBinsOneD, lowEtaBin, highEtaBin); pairDeltaEtaHistogramMixed->SetXTitle("#Delta #eta (radians)"); pairDeltaEtaHistogramMixed->SetYTitle("Counts"); pairDeltaEtaHistogramNormalized = new TH1D("pairDeltaEtaHistogramNormalized", "#Delta #eta Pairs, Normalized Event", nBinsOneD, lowEtaBin, highEtaBin); pairDeltaEtaHistogramNormalized->SetXTitle("#Delta #eta (radians)"); pairDeltaEtaHistogramNormalized->SetYTitle("Counts"); pairDeltaEtaDeltaPhiHistogram = new TH2D("pairDeltaEtaDeltaPhiHistogram", "Angular Correlation Pairs", nBinsX, lowEtaBin, highEtaBin, nBinsY, lowPhiBin, highPhiBin); pairDeltaEtaDeltaPhiHistogram->SetXTitle("#Delta #eta"); pairDeltaEtaDeltaPhiHistogram->SetYTitle("#Delta #phi"); pairDeltaEtaDeltaPhiHistogramMixed = new TH2D("pairDeltaEtaDeltaPhiHistogramMixed", "Angular Correlation Pairs", nBinsX, lowEtaBin, highEtaBin, nBinsY, lowPhiBin, highPhiBin); pairDeltaEtaDeltaPhiHistogramMixed->SetXTitle("#Delta #eta"); pairDeltaEtaDeltaPhiHistogramMixed->SetYTitle("#Delta #phi"); pairDeltaEtaDeltaPhiHistogramNormalized = new TH2D("pairDeltaEtaDeltaPhiHistogramNormalized", "Normalized Angular Correlation Pairs", nBinsX, lowEtaBin, highEtaBin, nBinsY, lowPhiBin, highPhiBin); pairDeltaEtaDeltaPhiHistogramNormalized->SetXTitle("#Delta #eta"); pairDeltaEtaDeltaPhiHistogramNormalized->SetYTitle("#Delta #phi"); // // Random number generator object // TRandom1 *particleKinematics = new TRandom1(); particleKinematics->SetSeed(1); unsigned int numberEvents10 = numberEvents/10; for(unsigned int kEvent=0; kEvent<numberEvents; kEvent++) { if(kEvent>0 && kEvent%numberEvents10==0) { cout << "\n At kEvent = " << kEvent; } // // Randomize the reaction plane angle in the lab frame // float reactionPlaneAngleThisEvent = 2.0*(particleKinematics->Rndm())*TMath::Pi(); // // Loop over particles per event // for(unsigned int kParticle=0; kParticle<particlesPerEvent; kParticle++) { particleEta[kParticle] = lowEtaBin + diffEta*(0.5 - particleKinematics->Rndm()); if(useFlow) { particlePhi[kParticle] = v2Flow->GetRandom(); if(particlePhi[kParticle] > 2.0*TMath::Pi()) particlePhi[kParticle] -= 2.0*TMath::Pi(); particlePhiLab[kParticle] = particlePhi[kParticle] + reactionPlaneAngleThisEvent; if(particlePhiLab[kParticle] > 2.0*TMath::Pi()) particlePhiLab[kParticle] -= 2.0*TMath::Pi(); } else { particlePhi[kParticle] = 2.0*(particleKinematics->Rndm())*TMath::Pi(); particlePhiLab[kParticle] = particlePhi[kParticle]; } particleEtaHistogram->Fill(particleEta[kParticle]); particlePhiHistogram->Fill(particlePhi[kParticle]); particlePhiLabHistogram->Fill(particlePhiLab[kParticle]); } // loop over particles if(kEvent > 0) { // // Fill the pair histograms for the same event // for(unsigned int kParticle=0; kParticle<particlesPerEventLessOne; kParticle++) { float phi1 = particlePhiLab[kParticle]; float eta1 = particleEta[kParticle]; unsigned int jParticleStart = kParticle + 1; for(unsigned int jParticle=jParticleStart; jParticle<particlesPerEvent; jParticle++) { float phiDelta = deltaPhi(phi1, particlePhiLab[jParticle]); // // Change the phiDelta range for plot purposes // if(phiDelta < -0.5*TMath::Pi()) phiDelta = TMath::Pi() + TMath::Pi() + phiDelta; float etaDelta = eta1 - particleEta[jParticle]; pairDeltaPhiHistogram->Fill(phiDelta); pairDeltaEtaHistogram->Fill(etaDelta, 0.5); pairDeltaEtaHistogram->Fill(-etaDelta, 0.5); pairDeltaEtaDeltaPhiHistogram->Fill(etaDelta, phiDelta, 0.5); pairDeltaEtaDeltaPhiHistogram->Fill(-etaDelta, phiDelta, 0.5); } // loop over second particle in same event pair } // loop over first particle in same event pair // // Fill the pair histograms for the mixed event // for(unsigned int kParticle=0; kParticle<particlesPerEvent; kParticle++) { float phi1 = particlePhiLab[kParticle]; float eta1 = particleEta[kParticle]; for(unsigned int jParticle=0; jParticle<particlesPerEvent; jParticle++) { float phiDelta = deltaPhi(phi1, particlePhiLabPreviousEvent[jParticle]); // // Change the phiDelta range for plot purposes // if(phiDelta < -0.5*TMath::Pi()) phiDelta = TMath::Pi() + TMath::Pi() + phiDelta; pairDeltaPhiHistogramMixed->Fill(phiDelta, mixedEventWeight); float etaDelta = eta1 - particleEtaPreviousEvent[jParticle]; pairDeltaEtaHistogramMixed->Fill(etaDelta,0.5); pairDeltaEtaHistogramMixed->Fill(-etaDelta,0.5); pairDeltaEtaDeltaPhiHistogramMixed->Fill(etaDelta, phiDelta, 0.5); pairDeltaEtaDeltaPhiHistogramMixed->Fill(-etaDelta, phiDelta, 0.5); } // loop over particle in previous event } // loop over particle in current event } // check on beyond the first event // // Move particles from current event to previous event arrays // for(unsigned int kParticle=0; kParticle<particlesPerEvent; kParticle++) { particlePhiLabPreviousEvent[kParticle] = particlePhiLab[kParticle]; particleEtaPreviousEvent[kParticle] = particleEta[kParticle]; } } // loop over events cout << "\n Finished NTUPLE scan" << endl; // // Normalize the delta-phi histograms with the mixed-event yields // float sumSameEventPhi1D = 0.0; float sumMixedEventPhi1D = 0.0; for(unsigned int iBinX=1; iBinX<nBinsOneD; iBinX++) { sumSameEventPhi1D += pairDeltaPhiHistogram->GetBinContent(iBinX); sumMixedEventPhi1D += pairDeltaPhiHistogramMixed->GetBinContent(iBinX); } if(sumSameEventPhi1D > 0.0 && sumMixedEventPhi1D > 0.0) { float normalizationFactor1D = sumMixedEventPhi1D/sumSameEventPhi1D; for(unsigned int iBinX=0; iBinX<nBinsOneD; iBinX++) { pairDeltaPhiHistogramNormalized->SetBinContent(iBinX,0.0); float sameEventContent = pairDeltaPhiHistogram->GetBinContent(iBinX); float mixedEventContent = pairDeltaPhiHistogramMixed->GetBinContent(iBinX); if(mixedEventContent > 0.0) { float normalizedYield = normalizationFactor1D*sameEventContent/mixedEventContent; pairDeltaPhiHistogramNormalized->SetBinContent(iBinX, normalizedYield); } // check for non-zero denominator } // loop over phi bins } // check for non-zero totals // // Normalize the delta-eta histograms with the mixed-event yields // float sumSameEvent1D = pairDeltaEtaHistogram->GetEntries(); float sumMixedEvent1D = pairDeltaEtaHistogramMixed->GetEntries(); if(sumSameEvent1D > 0.0 && sumMixedEvent1D > 0.0) { float normalizationFactor1D = sumMixedEvent1D/sumSameEvent1D; for(unsigned int iBinX=0; iBinX<nBinsOneD; iBinX++) { pairDeltaEtaHistogramNormalized->SetBinContent(iBinX,0.0); float sameEventContent = pairDeltaEtaHistogram->GetBinContent(iBinX); float mixedEventContent = pairDeltaEtaHistogramMixed->GetBinContent(iBinX); if(mixedEventContent > 0.0) { float normalizedYield = normalizationFactor1D*sameEventContent/mixedEventContent; pairDeltaEtaHistogramNormalized->SetBinContent(iBinX, normalizedYield); } // check for non-zero denominator } // loop over eta bins } // check for non-zero totals float sumSameEvent2D = pairDeltaEtaDeltaPhiHistogram->GetEntries(); float sumMixedEvent2D = pairDeltaEtaDeltaPhiHistogramMixed->GetEntries(); if(sumSameEvent2D > 0.0 && sumMixedEvent2D > 0.0) { float normalizationFactor2D = sumMixedEvent2D/sumSameEvent2D; for(unsigned int iBinX=0; iBinX<nBinsX; iBinX++) { for(unsigned int iBinY=0; iBinY<nBinsY; iBinY++) { pairDeltaEtaDeltaPhiHistogramNormalized->SetBinContent(iBinX, iBinY, 0.0); if(iBinX<iBinXMinPlot || iBinX>iBinXMaxPlot || iBinY<iBinYMinPlot || iBinY>iBinYMaxPlot) continue; // limit the fiducial area of the plot because of possible low statistics float sameEventContent = pairDeltaEtaDeltaPhiHistogram->GetBinContent(iBinX, iBinY); float mixedEventContent = pairDeltaEtaDeltaPhiHistogramMixed->GetBinContent(iBinX, iBinY); if(mixedEventContent > 0.0) { float normalizedYield = normalizationFactor2D*sameEventContent/mixedEventContent; pairDeltaEtaDeltaPhiHistogramNormalized->SetBinContent(iBinX, iBinY, normalizedYield); } // check for non-zero mixed event content } // loop over phi bins } // loop over eta bins } // check for non-zero total counts } // check on not reading histogram file if(readHistogramFile) { char inputFileName[200]; sprintf(inputFileName, "toyV2Generator%dEvents%dParticlesPerEvent%4.2fV2.root", numberEvents, particlesPerEvent, v2Factor); TFile *toyV2GeneratorFile = new TFile(inputFileName); if(!toyV2GeneratorFile) { cerr << "\n Unable to find ROOT file " << inputFileName << endl; return; } cout << "\n Using input ROOT file " << inputFileName << endl; particlePhiHistogram = (TH1D*)toyV2GeneratorFile->Get("particlePhiHistogram"); if(!particlePhiHistogram) { cerr << "\n Cannot find particlePhiHistogram" << endl; return; } particlePhiLabHistogram = (TH1D*)toyV2GeneratorFile->Get("particlePhiLabHistogram"); if(!particlePhiLabHistogram) { cerr << "\n Cannot find particlePhiLabHistogram" << endl; return; } particleEtaHistogram = (TH1D*)toyV2GeneratorFile->Get("particleEtaHistogram"); if(!particleEtaHistogram) { cerr << "\n Cannot find particleEtaHistogram" << endl; return; } pairDeltaPhiHistogram = (TH1D*)toyV2GeneratorFile->Get("pairDeltaPhiHistogram"); if(!pairDeltaPhiHistogram) { cerr << "\n Cannot find pairDeltaPhiHistogram" << endl; return; } pairDeltaPhiHistogramMixed = (TH1D*)toyV2GeneratorFile->Get("pairDeltaPhiHistogramMixed"); if(!pairDeltaPhiHistogramMixed) { cerr << "\n Cannot find pairDeltaPhiHistogramMixed" << endl; return; } pairDeltaPhiHistogramNormalized = (TH1D*)toyV2GeneratorFile->Get("pairDeltaPhiHistogramNormalized"); if(!pairDeltaPhiHistogramNormalized) { cerr << "\n Cannot find pairDeltaPhiHistogramNormalized" << endl; return; } pairDeltaEtaHistogram = (TH1D*)toyV2GeneratorFile->Get("pairDeltaEtaHistogram"); if(!pairDeltaEtaHistogram) { cerr << "\n Cannot find pairDeltaEtaHistogram" << endl; return; } pairDeltaEtaHistogramMixed = (TH1D*)toyV2GeneratorFile->Get("pairDeltaEtaHistogramMixed"); if(!pairDeltaEtaHistogramMixed) { cerr << "\n Cannot find pairDeltaEtaHistogramMixed" << endl; return; } pairDeltaEtaHistogramNormalized = (TH1D*)toyV2GeneratorFile->Get("pairDeltaEtaHistogramNormalized"); if(!pairDeltaEtaHistogramNormalized) { cerr << "\n Cannot find pairDeltaEtaHistogramNormalized" << endl; return; } pairDeltaEtaDeltaPhiHistogram = (TH2D*)toyV2GeneratorFile->Get("pairDeltaEtaDeltaPhiHistogram"); if(!pairDeltaEtaDeltaPhiHistogram) { cerr << "\n Cannot find pairDeltaEtaDeltaPhiHistogram" << endl; return; } pairDeltaEtaDeltaPhiHistogramMixed = (TH2D*)toyV2GeneratorFile->Get("pairDeltaEtaDeltaPhiHistogramMixed"); if(!pairDeltaEtaDeltaPhiHistogramMixed) { cerr << "\n Cannot find pairDeltaEtaDeltaPhiHistogramMixed" << endl; return; } pairDeltaEtaDeltaPhiHistogramNormalized = (TH2D*)toyV2GeneratorFile->Get("pairDeltaEtaDeltaPhiHistogramNormalized"); if(!pairDeltaEtaDeltaPhiHistogramNormalized) { cerr << "\n Cannot find pairDeltaEtaDeltaPhiHistogramNormalized" << endl; return; } } // check on readHistogramFile TCanvas *c1 = new TCanvas("c1", "Plotting Pair Events", 200, 10, 700, 500); // // Use ROOT's gStyle function to set up plot options // gStyle->SetOptStat(1110); gStyle->SetStatTextColor(kBlue); gStyle->SetFuncColor(kBlue); gStyle->SetFuncWidth(2); gStyle->SetOptFit(1111); gStyle->SetFitFormat("6.5g"); c1->SetFillColor(kWhite); c1->Divide(2,2); c1->cd(1); if(useFlow) { particlePhiHistogram->SetStats(0); particlePhiHistogram->SetMinimum(0); float fMaximum = particlePhiHistogram->GetMaximum(); int iMaximum = 1.5*fMaximum; particlePhiHistogram->SetMaximum(iMaximum); particlePhiHistogram->SetLineColor(4); particlePhiHistogram->Draw(); particlePhiLabHistogram->SetLineColor(1); particlePhiLabHistogram->Draw("same"); char labelBufferTitle[200]; sprintf(labelBufferTitle, "Events = %d, Particles/Event = %d, V2 factor = %4.2f", numberEvents, particlesPerEvent, v2Factor); TLatex *text1 = new TLatex(0.5, 0.90*iMaximum, labelBufferTitle); text1->SetTextColor(4); text1->SetTextSize(0.045); text1->Draw(); char labelBuffer2[200]; sprintf(labelBuffer2, "Blue: azimuthal distribution relative to reaction plane"); TLatex *text2 = new TLatex(0.5, 0.20*iMaximum, labelBuffer2); text2->SetTextColor(4); text2->SetTextSize(0.035); text2->Draw(); char labelBuffer3[200]; sprintf(labelBuffer3, "Black: azimuthal distribution relative to lab frame"); TLatex *text3 = new TLatex(0.5, 0.10*iMaximum, labelBuffer3); text3->SetTextColor(1); text3->SetTextSize(0.035); text3->Draw(); } else { particlePhiLabHistogram->SetStats(0); float fMaximum = particlePhiLabHistogram->GetMaximum(); int iMaximum = 1.5*fMaximum; particlePhiLabHistogram->SetMaximum(iMaximum); particlePhiLabHistogram->SetMinimum(0); particlePhiLabHistogram->Draw(); char labelBufferTitle[200]; sprintf(labelBufferTitle, "Events = %d, Particles/Event = %d, No Flow", numberEvents, particlesPerEvent); TLatex *text1 = new TLatex(0.5, 0.90*iMaximum, labelBufferTitle); text1->SetTextColor(4); text1->SetTextSize(0.045); text1->Draw(); } c1->cd(2); //pairDeltaPhiHistogramNormalized->SetStats(0); pairDeltaPhiHistogramNormalized->SetMaximum(1.3); pairDeltaPhiHistogramNormalized->SetMinimum(0.7); pairDeltaPhiHistogramNormalized->SetLineColor(2); TF1* fitFcnV2 = new TF1("fitFcnV2", v2Fit, -0.5*TMath::Pi(), 1.5*TMath::Pi(), 1); fitFcnV2->SetParameters(0, 0.20); fitFcnV2->SetParName(0, "Coeff"); pairDeltaPhiHistogramNormalized->Fit("fitFcnV2", "", "", -0.5*TMath::Pi(), 1.5*TMath::Pi()); char labelBuffer12[200]; sprintf(labelBuffer12, "Blue: fit with 1.0 + 2.0*Coeff*cos(2#Delta#phi), Coeff = %4.3f", fitFcnV2->GetParameter(0)); TLatex *text12 = new TLatex(-0.5, 0.83, labelBuffer12); text12->SetTextColor(4); text12->SetTextSize(0.035); text12->Draw(); char labelBuffer22[200]; sprintf(labelBuffer22, "Red: normalized pair #Delta#phi distribution in lab frame"); TLatex *text22 = new TLatex(-0.5, 0.77, labelBuffer22); text22->SetTextColor(2); text22->SetTextSize(0.035); text22->Draw(); c1->cd(3); pairDeltaEtaHistogramNormalized->SetStats(0); pairDeltaEtaHistogramNormalized->SetMaximum(1.5); pairDeltaEtaHistogramNormalized->SetMinimum(0); pairDeltaEtaHistogramNormalized->Draw(); c1->cd(4); pairDeltaEtaDeltaPhiHistogramNormalized->SetStats(0); pairDeltaEtaDeltaPhiHistogramNormalized->SetMaximum(1.3); pairDeltaEtaDeltaPhiHistogramNormalized->SetMinimum(0.7); pairDeltaEtaDeltaPhiHistogramNormalized->Draw("surf1"); if(writeHistogramFile) { TFile *toyV2GeneratorFile; char outputFileName[200]; sprintf(outputFileName, "toyV2Generator%dEvents%dParticlesPerEvent%4.2fV2.root", numberEvents, particlesPerEvent, v2Factor); char outputFileTitle[200]; sprintf(outputFileTitle, "Toy V2 Generator with %d Events, %d Particles/Event, and V2 = %4.2f", numberEvents, particlesPerEvent, v2Factor); toyV2GeneratorFile = new TFile(outputFileName, "recreate", outputFileTitle); particlePhiHistogram->Write(); particlePhiLabHistogram->Write(); particleEtaHistogram->Write(); pairDeltaPhiHistogram->Write(); pairDeltaPhiHistogramMixed->Write(); pairDeltaPhiHistogramNormalized->Write(); pairDeltaEtaHistogram->Write(); pairDeltaEtaHistogramMixed->Write(); pairDeltaEtaHistogramNormalized->Write(); pairDeltaEtaDeltaPhiHistogram->Write(); pairDeltaEtaDeltaPhiHistogramMixed->Write(); pairDeltaEtaDeltaPhiHistogramNormalized->Write(); toyV2GeneratorFile->Write(); toyV2GeneratorFile->Close(); } return; }
void clusterGaussReso() { TFile* file = new TFile("complete.root"); TTree* tree = (TTree *)file->Get("Signal"); int nEvents = tree->GetEntries(); double addresses[121] = {}; for (int k=0; k<121; k++){ std::stringstream ss2; ss2 << k; string str = "Crystal_"+ss2.str(); const char* charstr = str.c_str(); tree->SetBranchAddress(charstr, &addresses[k]); } TH1D* energyResoG = new TH1D("energyResoG", "Gauss_Energy_Resolution", 100, -10, 10); TH2D* posResoG = new TH2D("posResoG", "Gauss_Pos_Resolution", 11, -5, 5, 11, -5, 5); double energyThresHi = 50.; //set energy threshold to start looking for bumps double energyThresLo = .5; //energy lower bound //Going through each scan of the calorimeter for (int k=0; k<nEvents; k++) { tree->GetEntry(k); pair<int, double> bump(0, 0.); vector<pair<int, double> > geant; vector<pair<int, double> > hitMap; for(int i=0; i<121; i++) { pair<int, double> hit(i, addresses[i]); geant.push_back(hit); if (addresses[i] > energyThresHi) { hitMap.push_back(hit);} if (hit.second>bump.second) { bump = hit;} } gaussFit(bump, geant, energyResoG, posResoG); } //end of event TCanvas* canvas = new TCanvas("canvas", "canvas", 700,700); canvas->Divide(2, 1); TF1* g1d = new TF1("g1d", "gaus", -10, 10); TF2* g2d2 = new TF2("g2d2", Gaus2D, -10, 10, -10, 10, 6); g2d2->SetParameters(0., 0., 1., 1., 0., 100000); g2d2->FixParameter(4, 0.); energyResoG->Fit(g1d); canvas->cd(1); energyResoG->Draw(); posResoG->Fit(g2d2); canvas->cd(2); posResoG->Draw("BOX"); }
void plot_eff_NoErrors(const string& fInputFile, const string& fPlot, const double fOP, const string& fTitle, const string& fXAxisTitle, const string& fYAxisTitle, const string& fOutputFile, const double fYmin=0., const double fYmax=1.0, const Int_t fLogy=0, const Double_t fTitleOffsetX=1.0, const Double_t fTitleOffsetY=1.0, const Double_t fLeftMargin=0.12, const Double_t fTopMargin=0.07, const Double_t fPlotWidth=0.8) { gROOT->SetBatch(kTRUE); setEXOStyle(); gStyle->SetGridColor(kGray); gStyle->SetOptStat(kFALSE); gStyle->SetPadTopMargin(fTopMargin); gStyle->SetPadBottomMargin(1.-fTopMargin-fPlotWidth); gStyle->SetPadLeftMargin(fLeftMargin); gStyle->SetPadRightMargin(1.-fLeftMargin-fPlotWidth); gROOT->ForceStyle(); TFile *file = new TFile(fInputFile.c_str()); TH1D *h1_total = new TH1D("h1_total","h1_total",4,0.,0.8); TH1D *h1_subjet1 = new TH1D("h1_subjet1","h1_subjet1",4,0.,0.8); TH1D *h1_subjet2 = new TH1D("h1_subjet2","h1_subjet2",4,0.,0.8); TH1D *h1_subjet12 = new TH1D("h1_subjet12","h1_subjet12",4,0.,0.8); string bin_strings[4] = {"0to0p2", "0p2to0p4", "0p4to0p6", "0p6to0p8"}; for(int i=0; i<4; ++i) { TH2D *h2 = (TH2D*)file->Get((fPlot + bin_strings[i]).c_str()); int bin = h2->GetXaxis()->FindBin(fOP); h1_total->SetBinContent( i+1,h2->Integral(0,101,0,101)); h1_subjet1->SetBinContent( i+1,h2->Integral(bin,101,0,101)); h1_subjet2->SetBinContent( i+1,h2->Integral(0,101,bin,101)); h1_subjet12->SetBinContent(i+1,h2->Integral(bin,101,bin,101)); } TCanvas *c = new TCanvas("c", "",1000,800); c->cd(); TH2D *bkg = new TH2D("bkg","",100,0.,0.8,100,fYmin,fYmax); bkg->GetXaxis()->SetTitle(fXAxisTitle.c_str()); bkg->GetYaxis()->SetTitle(fYAxisTitle.c_str()); bkg->SetTitleOffset(fTitleOffsetX,"X"); bkg->SetTitleOffset(fTitleOffsetY,"Y"); bkg->Draw(); c->SetGridx(); c->SetGridy(); TGraph *g_eff_subjet1 = new TGraph(4); g_eff_subjet1->SetMarkerStyle(20); g_eff_subjet1->SetMarkerColor(kBlue+1); g_eff_subjet1->SetLineColor(kBlue+1); g_eff_subjet1->SetLineStyle(2); for(int i=0; i<4; ++i) g_eff_subjet1->SetPoint(i,h1_total->GetBinCenter(i+1),h1_subjet1->GetBinContent(i+1)/h1_total->GetBinContent(i+1)); TGraph *g_eff_subjet2 = new TGraph(4); g_eff_subjet2->SetMarkerStyle(21); g_eff_subjet2->SetMarkerColor(kGreen+1); g_eff_subjet2->SetLineColor(kGreen+1); g_eff_subjet2->SetLineStyle(2); for(int i=0; i<4; ++i) g_eff_subjet2->SetPoint(i,h1_total->GetBinCenter(i+1),h1_subjet2->GetBinContent(i+1)/h1_total->GetBinContent(i+1)); TGraph *g_eff_subjet12 = new TGraphAsymmErrors(4); g_eff_subjet12->SetMarkerStyle(22); g_eff_subjet12->SetMarkerColor(kBlack); g_eff_subjet12->SetLineColor(kBlack); g_eff_subjet12->SetLineStyle(2); for(int i=0; i<4; ++i) g_eff_subjet12->SetPoint(i,h1_total->GetBinCenter(i+1),h1_subjet12->GetBinContent(i+1)/h1_total->GetBinContent(i+1)); TGraph *g_eff_subjet12_prod = new TGraph(4); g_eff_subjet12_prod->SetMarkerStyle(26); g_eff_subjet12_prod->SetMarkerColor(kRed); g_eff_subjet12_prod->SetLineColor(kRed); g_eff_subjet12_prod->SetLineStyle(2); for(int i=0; i<4; ++i) g_eff_subjet12_prod->SetPoint(i,h1_total->GetBinCenter(i+1),(h1_subjet1->GetBinContent(i+1)*h1_subjet2->GetBinContent(i+1))/(h1_total->GetBinContent(i+1)*h1_total->GetBinContent(i+1))); g_eff_subjet1->Draw("PLsame"); g_eff_subjet2->Draw("PLsame"); g_eff_subjet12->Draw("PLsame"); g_eff_subjet12_prod->Draw("PLsame"); TLegend *legend = new TLegend(.6,.3,.85,.55); legend->SetBorderSize(0); legend->SetFillColor(0); legend->SetFillStyle(0); legend->SetTextFont(42); legend->SetTextSize(0.05); legend->AddEntry(g_eff_subjet1, "#varepsilon_{1}","lp"); legend->AddEntry(g_eff_subjet2, "#varepsilon_{2}","lp"); legend->AddEntry(g_eff_subjet12, "#varepsilon_{1 & 2}","lp"); legend->AddEntry(g_eff_subjet12_prod, "#varepsilon_{1} #times #varepsilon_{2}","lp"); legend->Draw(); TLatex l1; l1.SetTextAlign(13); l1.SetTextFont(42); l1.SetTextSize(0.045); l1.SetNDC(); l1.DrawLatex(fLeftMargin+0.03,0.91, fTitle.c_str()); l1.SetTextAlign(12); l1.SetTextSize(0.05); l1.SetTextFont(62); l1.DrawLatex(fLeftMargin,0.97, "CMS Simulation Preliminary, #sqrt{s} = 8 TeV"); c->SetLogy(fLogy); c->SaveAs(fOutputFile.c_str()); }
float fitAndDraw( const std::string& outputdir, TH1F* h1 ) { float returnConst=0.; TCanvas* c1 = new TCanvas("c1", "", 600, 600); c1->cd(); float xMin = h1->GetXaxis()->GetXmin(); float xMax = h1->GetXaxis()->GetXmax(); float yMax = 1.1*h1->GetMaximum(); TH2D* axes = new TH2D( "axes", "", 10, xMin, xMax, 10, 0., yMax ); axes->SetXTitle("Cluster Position [mm]"); // axes->SetXTitle(h1->GetName()); axes->SetYTitle("Events"); axes->Draw(); h1->SetFillColor(29); h1->Draw("same"); int opt=2; if( opt==1 ) { // gaussian fit float maxPos = h1->GetBinCenter(h1->GetMaximumBin()); TF1* f1 = new TF1(Form("f1_%s", h1->GetName()), "gaus", -10., 10.); f1->SetParameter( 1, maxPos ); h1->Fit(f1, "QRN"); for( int i=0; i<4; ++i ) { float m = f1->GetParameter(1); float s = f1->GetParameter(2); float nSigmas = 1.2; f1->SetRange( m-nSigmas*s, m+nSigmas*s ); if( i==3 ) h1->Fit(f1, "RQ"); else h1->Fit(f1, "RNQ"); } f1->SetLineColor(kRed); returnConst = f1->GetParameter(1); } else if( opt==2 ) { // average of high bins float maximum = h1->GetMaximum(); float thresh = 0.25*maximum; float total=0.; float denom = 0.; int nBins = h1->GetNbinsX(); TH1F* h1_usedBins = new TH1F( Form("usedBins_%s", h1->GetName()), "", nBins, xMin, xMax ); for( int ibin=1; ibin<nBins; ++ibin ) { if( h1->GetBinContent(ibin)<thresh ) continue; h1_usedBins->SetBinContent( ibin, h1->GetBinContent(ibin) ); // average: total += h1->GetBinCenter(ibin)*h1->GetBinContent(ibin); denom += h1->GetBinContent(ibin); //// weighted average: //total += h1->GetBinCenter(ibin)*h1->GetBinContent(ibin); //denom += h1->GetBinContent(ibin); } TLine* lineThresh = new TLine( xMin, thresh, xMax, thresh ); lineThresh->SetLineStyle(2); lineThresh->Draw("same"); returnConst = total/denom; h1_usedBins->SetFillColor(kOrange); h1_usedBins->Draw("same"); } else if( opt==3 ) { // maximum float maxBinCenter = h1->GetBinCenter(h1->GetMaximumBin()); returnConst = maxBinCenter; } TLine* lineOffset = new TLine( returnConst, 0., returnConst, yMax ); lineOffset->SetLineColor(kRed); lineOffset->SetLineWidth(3); lineOffset->Draw("same"); TPaveText* offsetText = new TPaveText( 0.65, 0.7, 0.9, 0.9, "brNDC"); offsetText->SetFillColor(0); offsetText->SetTextSize(0.035); if( returnConst>0. ) offsetText->AddText( Form("offset = +%.1f mm", returnConst) ); else offsetText->AddText( Form("offset = %.1f mm", returnConst) ); offsetText->Draw("same"); gPad->RedrawAxis(); TPaveText* labelTop = DrawTools::getLabelTop(); labelTop->Draw("same"); c1->SaveAs(Form("%s/%s.eps", outputdir.c_str(), h1->GetName())); c1->SaveAs(Form("%s/%s.png", outputdir.c_str(), h1->GetName())); c1->SaveAs(Form("%s/%s.pdf", outputdir.c_str(), h1->GetName())); delete c1; delete axes; return returnConst; }
void run() { TGraphErrors* gr0 = new TGraphErrors(0); TGraphErrors* gr1 = new TGraphErrors(0); TGraphErrors* gr2 = new TGraphErrors(0); TGraphErrors* gr3 = new TGraphErrors(0); TGraphErrors* gr23 = new TGraphErrors(0); TGraphErrors* gr_cef3 = new TGraphErrors(0); gr_cef3->SetName("cef3"); std::vector< std::pair<int, float> > run_pos; run_pos.push_back( std::pair< int, float>(225, 250.0) ); run_pos.push_back( std::pair< int, float>(226, 251.0) ); run_pos.push_back( std::pair< int, float>(227, 252.0) ); run_pos.push_back( std::pair< int, float>(228, 253.0) ); run_pos.push_back( std::pair< int, float>(229, 254.0) ); run_pos.push_back( std::pair< int, float>(230, 248.0) ); run_pos.push_back( std::pair< int, float>(231, 247.0) ); run_pos.push_back( std::pair< int, float>(232, 246.0) ); run_pos.push_back( std::pair< int, float>(233, 245.0) ); run_pos.push_back( std::pair< int, float>(234, 244.0) ); run_pos.push_back( std::pair< int, float>(235, 243.0) ); run_pos.push_back( std::pair< int, float>(236, 242.0) ); run_pos.push_back( std::pair< int, float>(237, 249.0) ); run_pos.push_back( std::pair< int, float>(238, 255.0) ); run_pos.push_back( std::pair< int, float>(239, 256.0) ); run_pos.push_back( std::pair< int, float>(240, 257.0) ); run_pos.push_back( std::pair< int, float>(241, 258.0) ); run_pos.push_back( std::pair< int, float>(242, 259.0) ); run_pos.push_back( std::pair< int, float>(243, 260.0) ); run_pos.push_back( std::pair< int, float>(246, 261.0) ); run_pos.push_back( std::pair< int, float>(247, 262.0) ); run_pos.push_back( std::pair< int, float>(248, 263.0) ); run_pos.push_back( std::pair< int, float>(249, 264.0) ); run_pos.push_back( std::pair< int, float>(250, 265.0) ); run_pos.push_back( std::pair< int, float>(251, 266.0) ); run_pos.push_back( std::pair< int, float>(252, 267.0) ); run_pos.push_back( std::pair< int, float>(253, 268.0) ); run_pos.push_back( std::pair< int, float>(254, 270.0) ); //run_pos.push_back( std::pair< int, float>(255, 272.5) ); run_pos.push_back( std::pair< int, float>(244, 275.0) ); for( unsigned i=0; i<run_pos.size(); ++i ) { hodoScan p(run_pos[i].first); std::vector<float> eff = p.Loop(); gr0->SetPoint( i, run_pos[i].second, eff[0] ); gr1->SetPoint( i, run_pos[i].second, eff[1] ); gr2->SetPoint( i, run_pos[i].second, eff[2] ); gr3->SetPoint( i, run_pos[i].second, eff[3] ); gr23->SetPoint( i, run_pos[i].second, 0.5*(eff[3]+eff[2]) ); cef3Scan c(run_pos[i].first); TH1F* h1_cef3 = c.Loop(); //TF1* f1 = new TF1(Form("f1_%d", run_pos[i].first), "gaus", 3000., 6000.); //h1_cef3->Fit( f1, "RQL" ); //for( unsigned j=0; j<4; ++j ) { // float mu = f1->GetParameter(1); // float sigma = f1->GetParameter(2); // f1->SetRange( mu-sigma, mu+sigma ); // h1_cef3->Fit( f1, "RQL" ); //} //TCanvas* c2 = new TCanvas("c2", "", 600, 600); //c2->cd(); //h1_cef3->Draw(); //c2->SaveAs(Form("provaY/%d.png", run_pos[i].first)); //delete c2; //gr_cef3->SetPoint( i, run_pos[i].second, f1->GetParameter(1) ); //gr_cef3->SetPointError( i, 0., f1->GetParError(1) ); gr_cef3->SetPoint( i, run_pos[i].second, h1_cef3->GetBinCenter(h1_cef3->GetMaximumBin())); } TCanvas* c1 = new TCanvas("c1", "", 600, 600); c1->cd(); TH2D* axes = new TH2D("axes", "", 10, 200., 300., 10, 0., 0.15 ); axes->SetXTitle("Y Position [mm]"); axes->SetYTitle("Efficiency"); axes->Draw(); gr0->SetMarkerStyle(20); gr0->SetMarkerColor(46); gr0->SetMarkerSize(1.); gr1->SetMarkerStyle(21); gr1->SetMarkerColor(29); gr1->SetMarkerSize(1.); gr2->SetMarkerStyle(22); gr2->SetMarkerColor(38); gr2->SetMarkerSize(1.); gr3->SetMarkerStyle(23); gr3->SetMarkerColor(kGreen+2); gr3->SetMarkerSize(1.); gr23->SetMarkerStyle(20); gr23->SetMarkerColor(kBlack); gr23->SetMarkerSize(1.); gr2->Draw("Psame"); gr3->Draw("Psame"); gr23->Draw("Psame"); TLegend* legend = new TLegend(0.2, 0.6, 0.55, 0.9); legend->SetFillColor(0); legend->SetTextSize(0.035); legend->AddEntry( gr2, "2", "P" ); legend->AddEntry( gr3, "3", "P" ); legend->AddEntry( gr23, "2+3", "P" ); legend->Draw("same"); c1->SaveAs("posScanY.eps"); c1->SaveAs("posScanY.png"); TFile* file = TFile::Open("scanY.root", "recreate"); file->cd(); gr_cef3->Write(); file->Close(); }
void analyze(){ int ifiles = 0; bool MC = false; bool correct = true; double drMax = 0.2; double ptMin = 0.3; double ptMax = 15; double jetPtMin = 7.; double jetEtaMax = 2.; double jetEMFMin = 0.01; const int nEtBins = 8; // === input === TChain* tree = new TChain("Events"); tree->Add("/d100/data/MinimumBias-ReReco/Jan29ReReco-v2/bambu/BSCNOBEAMHALO_000_*.root"); //tree->Add("/d100/data/MinimumBias-ReReco/Jan29ReReco-v2/bambu/BSCNOBEAMHALO_000_1.root"); // === ana config === double etBinsArray[nEtBins] = {0,5,10,15,20,30,70,120}; vector<double> etBins(etBinsArray,etBinsArray+nEtBins); string JECLevels = "L2:L3"; //string JECTag = "900GeV_L2Relative_IC5Calo:900GeV_L3Absolute_IC5Calo"; string JECTag = "900GeV_L2Relative_AK5Calo:900GeV_L3Absolute_AK5Calo"; CombinedJetCorrector *JEC = new CombinedJetCorrector(JECLevels,JECTag); // === setup output === char* outname = Form("hists.root",ifiles); TFile* outf = new TFile(outname,"recreate"); TH1::SetDefaultSumw2(); TH1D* hptTr[nEtBins+1]; TH1D* hptGen[nEtBins+1]; TTree * tree_ = new TTree("dijetTree","dijet tree"); TreeDiJetEventData jd_; jd_.SetTree(tree_); jd_.SetBranches(); for(int ih = 0; ih < nEtBins+1; ++ih){ hptTr[ih] = new TH1D(Form("hptTr%d",ih),Form("Tracks in cone |#Delta R| < %f; p_{T}^{track}; N_{track}/N_{jet}",drMax),250,ptMin,ptMax); hptGen[ih] = new TH1D(Form("hptGen%d",ih),Form("Charged Particles in cone |#Delta R| < %f; p_{T}^{chg}; N_{chg}/N_{jet}",drMax),250,ptMin,ptMax); } TH1D* hptJet = new TH1D("hptJet",";p_{T} [GeV];jets",100,0,20); TH2D* hptCor = new TH2D("hptCor",";p_{T}^{raw} [GeV];p_{T}^{corrected} [GeV]",100,0,20,100,0,20); TH1D* hDR = new TH1D("hDR",";#Delta R;tracks",100,0,3.2); TH1D* hFFz = new TH1D("hFFz","",100,0,1.2); TH1D* hXi = new TH1D("hXi","",100,-2,8); TH1D* hFFzGen = new TH1D("hFFzGen","",100,0,1.2); TH1D* hXiGen = new TH1D("hXiGen","",100,-2,8); // === setup branches mithep::Array<mithep::CaloJet> *jets; mithep::Array<mithep::Track> *tracks; mithep::Array<mithep::Vertex> *vertices; mithep::L1TriggerMask *L1T; mithep::L1TriggerMask *L1A; mithep::Array<mithep::MCParticle> *genparticles; mithep::Array<mithep::GenJet> *genjets; mithep::EventHeader *evInfo; //tree->SetBranchAddress("ItrCone5Jets",&jets); tree->SetBranchAddress("AKt5Jets",&jets); tree->SetBranchAddress("Tracks",&tracks); tree->SetBranchAddress("PrimaryVertexes",&vertices); tree->SetBranchAddress("L1TechBitsBeforeMask",&L1T); tree->SetBranchAddress("L1AlgoBitsBeforeMask",&L1A); tree->SetBranchAddress("EventHeader",&evInfo); /* if(MC){ tree->SetBranchAddress("MCParticles",&genparticles); tree->SetBranchAddress("IC5GenJets",&genjets); } */ int nevents = tree->GetEntries(); int nevtrig = 0; double njet[nEtBins] = {0.,0.,0.,0.,0.,0.,0.,0.}; double ngenjet[nEtBins] = {0.,0.,0.,0.,0.,0.,0.,0.}; // nevents = 50; for(int iev = 0; iev < nevents; ++iev){ tree->GetEntry(iev); // clear jet data jd_.ClearCounters(); // trigger info bool A0 = L1A->Get().TestBit(0); // run level UInt_t runNum=evInfo->RunNum(); // - good runs - if (!MC && runNum!=123596 && runNum!=123615 && runNum!=123732 && runNum!=123815 && runNum!=123818 && runNum!=123906 && runNum!=123908 && runNum!=124008 && runNum!=124009 && runNum!=124020 && runNum!=124022 && runNum!=124023 && runNum!=124024 && runNum!=124025 && runNum!=124027 && runNum!=124030 ) continue; // print out info (out of good runs) before any filters cout << "Run #: " << runNum << " Event: " << evInfo->EvtNum() << " Lumi: " << evInfo->LumiSec() << " PhysDeclared?: " << evInfo->IsPhysDec() << " L1A0?: " << A0 << endl; // Filter on phys declared if (!MC && (!evInfo->IsPhysDec() || !A0)) continue; // === Event Level === // if no vertex nothing to do if(vertices->GetEntries() < 1) continue; // there is a vertex const mithep::Vertex * vtx = (Vertex*)vertices->At(0); bool goodVertex = vtx->Ndof()> 4 && TMath::Abs(vtx->Z() < 15.); cout << " EventInfo - nvtx: " << vertices->GetEntries() << " vtxndof: " << vtx->Ndof() << endl; // - save event info jd_.run_ = runNum; jd_.event_ = evInfo->EvtNum(); jd_.vtxdof_ = vtx->Ndof(); jd_.vz_ = vtx->Z(); if(!goodVertex) { tree_->Fill(); continue; } // - got good event vertex - nevtrig++; // === Jet Level === int njets = jets->GetEntries(); int nGoodJets = 0; double awayEtMax=-99; double ptljet[2] = {-99,-99}; for(int i = 0; i < njets; ++i){ CaloJet* jet = (CaloJet*)jets->At(i); jet->DisableCorrections(); double ptjet = jet->Pt(); double etajet = jet->Eta(); double phijet = jet->Phi(); if (ptjet>3) cout << " raw jet "<<i<<": Pt|eta|phi: " << ptjet <<"|"<< etajet << "|" << phijet << endl; double emf = jet->EnergyFractionEm(); bool goodJet = TMath::Abs(etajet) < jetEtaMax && emf > jetEMFMin; if(!goodJet) continue; double energy = jet->E(); int jetbin = getBin(ptjet,etBins)+1; njet[jetbin] += 1.; hptJet->Fill(ptjet); double corpt = ptjet*JEC->getCorrection(ptjet,etajet,energy); hptCor->Fill(ptjet,corpt); if(correct) ptjet = corpt; if(ptjet< jetPtMin) continue; //cout << " jet" << i << " Good . corr"<<correct<<"Pt|eta|phi: " << ptjet <<"|"<< etajet << "|" << phijet << endl; } // === Dijet Ana === if (njets<2) { // nothing to do for dijet ana, fill some inclusive track info int ntracks = tracks->GetEntries(); int nHP = 0; for(int it = 0; it < ntracks; ++it){ Track* track = (Track*)(tracks->At(it)); mithep::TrackQuality& quality = track->Quality(); bool highPurity = quality.QualityMask().TestBit(2); jd_.trkNHits_[it] = track->NHits(); jd_.trkHP_[it] = highPurity; jd_.ppt_[it] = track->Pt(); jd_.peta_[it] = track->Eta(); jd_.pphi_[it] = track->Phi(); if (highPurity) ++nHP; } jd_.evtnp_ = ntracks; jd_.fracHP_ = (double)nHP/(double)ntracks; tree_->Fill(); continue; } // there are 2 jets CaloJet* jet0 = (CaloJet*)jets->At(0); CaloJet* jet1 = (CaloJet*)jets->At(1); // apply corrections jet0->DisableCorrections(); jet1->DisableCorrections(); double ptjet0 = jet0->Pt(); double ptjet1 = jet1->Pt(); double etajet0 = jet0->Eta(); double etajet1 = jet1->Eta(); double phijet0 = jet0->Phi(); double phijet1 = jet1->Phi(); FourVectorM jet0p4 = jet0->RawMom(); FourVectorM jet1p4 = jet1->RawMom(); if(correct) { double scale = JEC->getCorrection(ptjet0,etajet0,jet0->E()); ptjet0 *= scale; jet0p4 *= scale; } if(correct) { double scale = JEC->getCorrection(ptjet1,etajet1,jet1->E()); ptjet1 *= scale; jet1p4 *= scale; } // cut jet //bool goodDiJet = ptjet0>1 && ptjet1>1; //if (!goodDiJet) continue; cout << " jet 0 corr"<<correct<<"Pt|eta|phi: " << ptjet0 <<"|"<< etajet0 << "|" << phijet0 << " p4: " << jet0p4 << endl; cout << " jet 1 corr"<<correct<<"Pt|eta|phi: " << ptjet1 <<"|"<< etajet1 << "|" << phijet1 << " p4: " << jet1p4 << endl; double ljdphi = TMath::Abs(reco::deltaPhi(phijet0,phijet1)); cout << " leading jets dphi: " << ljdphi << endl; // -- Fill jet info -- // fill dijet info jd_.jdphi_ = ljdphi; jd_.mass_ = (jet0p4+jet1p4).M(); // near/away info jd_.nljet_ = ptjet0; jd_.nljeta_ = etajet0; jd_.nljphi_ = phijet0; jd_.nljemf_ = jet0->EnergyFractionEm(); jd_.aljet_ = ptjet1; jd_.aljeta_ = etajet1; jd_.aljphi_ = phijet1; jd_.aljemf_ = jet1->EnergyFractionEm(); // === Track Level === int ntracks = tracks->GetEntries(); int nHP = 0; int selTrkCt = 0; for(int j = 0; j < ntracks; ++j){ Track* track = (Track*)(tracks->At(j)); double pttrack = track->Pt(); double etatrack = track->Eta(); double phitrack = track->Phi(); mithep::TrackQuality& quality = track->Quality(); if(0){ double d0err = track->D0Err(); double sigXY = sqrt(d0err*d0err + 0.04*0.04); double qope = track->QOverPErr(); double lambdaerr = track->LambdaErr(); double pz = track->Pz(); int chg = track->Charge(); } bool highPurity = quality.QualityMask().TestBit(2); //cout << "highPurity?: " << quality.QualityMask().TestBit(2) << endl; bool goodTrack = highPurity; if (highPurity) ++nHP; //if(!goodTrack) continue; //cout << "sel track: " << selTrkCt << " pt eta phi: " << pttrack << "|" << etatrack << "|" << phitrack << endl; // -- Fill Tracks -- // fill frag candidates basic info jd_.trkNHits_[selTrkCt] = track->NHits(); jd_.trkHP_[selTrkCt] = highPurity; jd_.ppt_[selTrkCt] = pttrack; jd_.peta_[selTrkCt] = etatrack; jd_.pphi_[selTrkCt] = phitrack; // Relations to jet jd_.pndphi_[selTrkCt] = TMath::Abs(reco::deltaPhi(phitrack,phijet0)); jd_.pndeta_[selTrkCt] = etatrack - etajet0; jd_.pndr_[selTrkCt] = reco::deltaR(etatrack,phitrack,etajet0,phijet0); jd_.padphi_[selTrkCt] = TMath::Abs(reco::deltaPhi(phitrack,phijet1)); jd_.padeta_[selTrkCt] = etatrack - etajet1; jd_.padr_[selTrkCt] = reco::deltaR(etatrack,phitrack,etajet1,phijet1); // - background variables- jd_.pndrbg_[selTrkCt] = reco::deltaR(etatrack,phitrack,etajet0,phijet0+TMath::Pi()/2); jd_.padrbg_[selTrkCt] = reco::deltaR(etatrack,phitrack,etajet1,phijet1+TMath::Pi()/2); // jet cone info if (pttrack>0.3 && pttrack<60 && highPurity && track->NHits()>=8 && jd_.pndr_[selTrkCt]<0.5) ++jd_.nljCone5NP_; // fragmentation variables jd_.zn_[selTrkCt] = pttrack/ptjet0; jd_.za_[selTrkCt] = pttrack/ptjet1; // save counter ++selTrkCt; /* double dr = reco::deltaR(etatrack,phitrack,etajet,phijet); hDR->Fill(dr); if(dr > drMax) continue; hptTr[0]->Fill(pttrack); hptTr[jetbin]->Fill(pttrack); if(pttrack < ptMin) continue; double ffz = pttrack/ptjet; double xi = -log(ffz); hFFz->Fill(ffz); hXi->Fill(xi); */ } // tracks jd_.evtnp_ = selTrkCt; jd_.fracHP_ = (double)nHP/(double)ntracks; // mc input /* if(MC){ int ngenjets = genjets->GetEntries(); for(int i = 0; i < ngenjets; ++i){ GenJet* jet = (GenJet*)genjets->At(i); double ptjet = jet->Pt(); double etajet = jet->Eta(); double phijet = jet->Phi(); double energy = jet->E(); int jetbin = getBin(ptjet,etBins)+1; ngenjet[jetbin] += 1.; int nparticles = genparticles->GetEntries(); for(int j = 0; j < nparticles; ++j){ MCParticle* p = (MCParticle*)(genparticles->At(j)); int chg = p->Charge(); if(chg == 0 || chg < -10) continue; double ptpar = p->Pt(); double etapar = p->Eta(); double phipar = p->Phi(); double dr = reco::deltaR(etapar,phipar,etapar,phipar); if(dr > drMax) continue; if(ptpar < ptMin) continue; double ffz = ptpar/ptjet; double xi = -log(ffz); hFFzGen->Fill(ffz); hXiGen->Fill(xi); } } } */ // all done! tree_->Fill(); } // event end hptJet->Draw(); TCanvas* c2 = new TCanvas(); hptCor->Draw("colz"); TCanvas* c3 = new TCanvas(); c3->Divide(2,2); c3->cd(1); hDR->Draw(); c3->cd(2); hFFz->Draw(); c3->cd(3); hXi->Draw(); /* if(MC){ TCanvas* c4 = new TCanvas(); c4->Divide(2,2); c4->cd(1); c4->cd(2); hFFzGen->Draw(); c4->cd(3); hXiGen->Draw(); } */ /* for(int is = 0; is < nEtBins; ++is){ hptTr[is]->Write(); hptGen[is]->Write(); } hDR->Write(); hFFz->Write(); hXi->Write(); */ outf->Write(); outf->Close(); cout<<"---------------------------------------"<<endl; cout<<"Total Number of Events used : "<<nevtrig<<endl; cout<<"---------------------------------------"<<endl; }
void make2Dplot_MAX(TString setup, TString dir, int num, int MLSP,TString opt){ gStyle->SetOptStat(0); gStyle->SetCanvasColor(0); gStyle->SetPadColor(0); gStyle->SetMarkerStyle(15); gStyle->SetMarkerSize(0.25); gStyle->SetTextFont(42); gStyle->SetMarkerColor(37); if (num <3) {gStyle->SetPaintTextFormat("4.1f");} TString BDT =""; char cadena[128]; // Crea un fichero de salida ofstream fs(setup+".txt"); fs.setf(ios::fixed); fs.precision(1); TH2D* TwoDPlot = new TH2D("","",26,157.5, 812.5, 28, 12.5,712.5); for(int x=175; x<=800; x+=25){ // for(int x=175; x<=225; x+=25){ for(int y=25; y<=700; y+=25){ if (x - y > 99){ BDT = signalregiont2tt(x,y); cout << BDT << endl; double array[1] = { FOM(setup,BDT,dir,x,y,num) }; double arraycut[1]= { FOM(setup,BDT,dir,x,y,1) }; double temp = 0.; int mvaval = 0; double tempcut=0.; // Get the maximum of each point for all MVAs for(int i=0;i<1;i++){ if(arraycut[i]>temp){ temp = arraycut[i]; mvaval = i; tempcut=array[i]; } } if (num ==1) {TwoDPlot->Fill(x,y,temp);} if (num ==2) {TwoDPlot->Fill(x,y,tempcut);} if (num ==3) { if (BDT=="BDT1") mvaval=1; if (BDT=="BDT3") mvaval=3; if (BDT=="BDT4") mvaval=4; TwoDPlot->Fill(x,y,mvaval);} // createTableCLs(x,y,temp); } } } fs.close(); TCanvas c1("c1","c1",800,600); c1.SetLeftMargin(0.1706731); c1.SetRightMargin(0.1983173); c1.SetTopMargin(0.04895105); c1.SetBottomMargin(0.1416084); c1.Range(-289.7381,-191.8196,1334.643,1074.487); TwoDPlot->SetMarkerSize(1.); TwoDPlot->SetMarkerColor(kWhite); TwoDPlot->Draw("COLZ TEXT"); TwoDPlot->GetYaxis()->SetTitle("LSP mass"); TwoDPlot->GetXaxis()->SetTitle("Stop mass"); if (num==0) {TwoDPlot->GetZaxis()->SetTitle("Entries"); TwoDPlot->GetZaxis()->SetRangeUser(0,5000);} if (num==1) {TwoDPlot->GetZaxis()->SetTitle("FOM"); TwoDPlot->GetZaxis()->SetRangeUser(0,15);} if (num==2) {TwoDPlot->GetZaxis()->SetTitle("Optimal cut point"); TwoDPlot->GetZaxis()->SetRangeUser(0,1);} if (num==3) {TwoDPlot->GetZaxis()->SetTitle("Best performing BDT training"); TwoDPlot->GetZaxis()->SetRangeUser(0,6);} TFile* f = new TFile(dir+"_"+opt+".root","RECREATE"); TwoDPlot->Write("twodplot"); f->Write(); f->Close(); TLatex l1; l1.SetTextAlign(12); l1.SetTextSize(0.04); l1.SetNDC(); l1.DrawLatex(0.155, 0.98, "CMS Simulation, 20 fb^{-1}"); l1.DrawLatex(0.7, 0.98, "#sqrt{s} = 8 TeV"); l1.SetTextSize(0.03); if (num==3){ tex = new TLatex(0.7449749,0.8251748,"BDT1"); tex->SetNDC(); tex->SetTextAlign(12); tex->SetTextFont(42); tex->SetTextSize(0.03); tex->SetTextAngle(41.15586); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.7449749,0.7097902,"BDT2"); tex->SetNDC(); tex->SetTextAlign(12); tex->SetTextFont(42); tex->SetTextSize(0.03); tex->SetTextAngle(41.15586); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.7437186,0.5891608,"BDT3"); tex->SetNDC(); tex->SetTextAlign(12); tex->SetTextFont(42); tex->SetTextSize(0.03); tex->SetTextAngle(41.15586); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.7424623,0.4755245,"BDT4"); tex->SetNDC(); tex->SetTextAlign(12); tex->SetTextFont(42); tex->SetTextSize(0.03); tex->SetTextAngle(41.15586); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.7424623,0.3583916,"BDT5"); tex->SetNDC(); tex->SetTextAlign(12); tex->SetTextFont(42); tex->SetTextSize(0.03); tex->SetTextAngle(41.15586); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.7424623,0.2447552,"BDT6"); tex->SetNDC(); tex->SetTextAlign(12); tex->SetTextFont(42); tex->SetTextSize(0.03); tex->SetTextAngle(41.15586); tex->SetLineWidth(2); tex->Draw(); } TString dataset_name; TString datasetnombre; if (dir == "T2bw025") {dataset_name = "t2bw_025";} if (dir == "T2bw050") {dataset_name = "t2bw_050";} if (dir == "T2bw075") {dataset_name = "t2bw_075";} if (dir == "T2tt") {dataset_name = "t2tt_all";} if (dir == "T2tt") {datasetnombre = "t2tt_half";} //if (num==0) c1.Print("~/www/STOP/BDTTraining/08TeV/"+dataset_name+"/"+setup+"/Entries_Lara.png"); //if (num==1) c1.Print("~/www/STOP/BDTTraining/08TeV/"+dataset_name+"/"+setup+"/FOM_Lara.png"); //if (num==2) c1.Print("~/www/STOP/BDTTraining/08TeV/"+dataset_name+"/"+setup+"/OptimalCut_Lara.png"); //if (num==3) c1.Print("~/www/STOP/BDTTraining/08TeV/"+dataset_name+"/"+setup+"/BestBDT_Lara.png"); if (num==0) c1.Print("~/www/STOP/BDTTraining/8TeV/"+datasetnombre+"/BestSet/Entries_Lara_SR_fixcut.png"); if (num==1) c1.Print("~/www/STOP/BDTTraining/8TeV/"+datasetnombre+"/BestSet/FOM_Lara_SR_fixcut.png"); if (num==2) c1.Print("~/www/STOP/BDTTraining/8TeV/"+datasetnombre+"/BestSet/OptimalCut_Lara_SR_fixcut.png"); if (num==3) c1.Print("~/www/STOP/BDTTraining/8TeV/"+datasetnombre+"/BestSet/BestBDT_Lara_SR_fixcut.png"); }
void ShowSPDConfiguration(Int_t runNb=0, const char *ocdblocation="local://$ALICE_ROOT/OCDB", bool grid=kFALSE,bool threed=kFALSE){ gStyle->SetOptStat(0); if(grid){ TGrid::Connect("alien://"); if(!gGrid){ printf("no grid connection is available, exiting.\n"); return; } } AliITSOnlineCalibrationSPDhandler *h = new AliITSOnlineCalibrationSPDhandler(); h->ReadDeadFromDB(runNb,ocdblocation); AliCDBManager::Instance(); AliCDBManager::Instance()->SetRun(runNb); AliCDBManager::Instance()->SetDefaultStorage(ocdblocation); AliGeomManager::LoadGeometry(); if(threed) { Draw3D(h); return; } Double_t nact[2]={0.,0.}; TCanvas *c = new TCanvas("c","Active Modules ",500,700); c->Divide(1,2); c->cd(1); TH2D *hPhiZInner = new TH2D("hPhiZInner","Inner layer Active Modules ",200,-20,20,3,0,2*TMath::Pi()); hPhiZInner->SetXTitle("Z (cm)"); hPhiZInner->SetYTitle("#varphi (rad)"); hPhiZInner->Draw(); for(Int_t i=0; i<80; i++){ if((h->GetNrBad(i))<1) { TGeoHMatrix matrix; int vid = AliITSAlignMille2Module::GetVolumeIDFromIndex(i); AliITSAlignMille2Module::SensVolMatrix(vid,&matrix); Double_t local0[3],local1[3],local2[3],local3[3]; // local position of the four angles local0[0]=-0.6375; local0[1]=0; local0[2]= 3.48; local1[0]=-0.6375; local1[1]=0; local1[2]= -3.48; local2[0]=0.6375; local2[1]=0; local2[2]= -3.48; local2[0]=0.6375; local3[1]=0; local3[2]= 3.48; Double_t global0[3],global1[3],global2[3],global3[3]; matrix.LocalToMaster(local0,global0); matrix.LocalToMaster(local1,global1); matrix.LocalToMaster(local2,global2); matrix.LocalToMaster(local3,global3); Double_t phiUp = atan2(global0[1],global0[0]); if(phiUp<0) phiUp+=2*TMath::Pi(); Double_t phiDown = atan2(global2[1],global2[0]); if(phiDown<0) phiDown+=2*TMath::Pi(); TLine *lhor1 = new TLine(global0[2],phiDown,global1[2],phiDown); lhor1->Draw("same"); lhor1->SetLineColor(kBlue); lhor1->SetLineWidth(3); TLine *lver1 = new TLine(global1[2],phiDown,global2[2],phiUp); lver1->Draw("same"); lver1->SetLineColor(kBlue); lver1->SetLineWidth(3); TLine *lhor2 = new TLine(global2[2],phiUp,global3[2],phiUp); lhor2->Draw("same"); lhor2->SetLineColor(kBlue); lhor2->SetLineWidth(3); TLine *lver2 = new TLine(global3[2],phiUp,global0[2],phiDown); lver2->Draw("same"); lver2->SetLineColor(kBlue); lver2->SetLineWidth(3); nact[0]++; } } c->cd(2); TH2D *hPhiZOuter = new TH2D("hPhiZOuter","Outer layer Active Modules ",200,-20,20,3,0,2*TMath::Pi()); hPhiZOuter->SetXTitle("Z (cm)"); hPhiZOuter->SetYTitle("#varphi (rad)"); hPhiZOuter->Draw(); for(Int_t i=80; i<240; i++){ TGeoHMatrix matrix; int vid = AliITSAlignMille2Module::GetVolumeIDFromIndex(i); AliITSAlignMille2Module::SensVolMatrix(vid,&matrix); Double_t local[4][3]; // local position of the four angles local[0][0]=0.6375; local[0][1]=0; local[0][2]= -3.48; local[1][0]=0.6375; local[1][1]=0; local[1][2]= 3.48; local[2][0]=-0.6375; local[2][1]=0; local[2][2]= 3.48; local[2][0]=-0.6375; local[3][1]=0; local[3][2]= -3.48; Double_t global[4][3]; for(Int_t j=0; j<4; j++){ matrix.LocalToMaster(local[j],global[j]); } Double_t phiUp = atan2(global[0][1],global[0][0]); if(phiUp<0) phiUp+=2*TMath::Pi(); Double_t phiDown = atan2(global[2][1],global[2][0]); if(phiDown<0) phiDown+=2*TMath::Pi(); if(i>235) if(phiUp < 0.1) phiUp = TMath::Pi()*2; // printf("module %i - phiDown %f phiUp %f \n",i,phiDown,phiUp); if((h->GetNrBad(i))<1) { TLine *lhor1 = new TLine(global[0][2],phiUp,global[1][2],phiUp); lhor1->Draw("same"); lhor1->SetLineColor(kBlue); lhor1->SetLineWidth(2); TLine *lver1 = new TLine(global[1][2],phiUp,global[2][2],phiDown); lver1->Draw("same"); lver1->SetLineColor(kBlue); lver1->SetLineWidth(2); TLine *lhor2 = new TLine(global[2][2],phiDown,global[3][2],phiDown); lhor2->Draw("same"); lhor2->SetLineColor(kBlue); lhor2->SetLineWidth(2); TLine *lver2 = new TLine(global[3][2],phiDown,global[0][2],phiUp); lver2->Draw("same"); lver2->SetLineColor(kBlue); lver2->SetLineWidth(2); nact[1]++; } } printf(" \n Number of Active SPD modules (->Total) : inner %3.0f (80) %f - outer %3.0f (160) %f \n",nact[0],nact[0]/80.,nact[1],nact[1]/160.); c->SaveAs(Form("active%i.png",runNb)); }
void CommandMSUGRA(TString plotName_,Int_t tanBeta_, Bool_t plotLO_){ gROOT->SetStyle("CMS");//jmt specific gROOT->ForceStyle(); gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gStyle->SetPalette(1); gStyle->SetTextFont(42); gStyle->SetFrameBorderMode(0); //convert tanb value to string std::stringstream tmp; tmp << tanBeta_; TString tanb( tmp.str() ); // Output file std::cout << " create " << plotName_ << std::endl; TFile* output = new TFile( plotName_, "RECREATE" ); if ( !output || output->IsZombie() ) { std::cout << " zombie alarm output is a zombie " << std::endl; } //set old exclusion Limits TGraph* LEP_ch = set_lep_ch(tanBeta_); TGraph* LEP_sl = set_lep_sl(tanBeta_);//slepton curve TGraph* TEV_sg_cdf = set_tev_sg_cdf(tanBeta_);//squark gluino cdf TGraph* TEV_sg_d0 = set_tev_sg_d0(tanBeta_);//squark gluino d0 // TGraph* TEV_tlp_cdf = set_tev_tlp_cdf(tanBeta_);//trilepton cdf // TGraph* TEV_tlp_d0 = set_tev_tlp_d0(tanBeta_);//trilepton d0 TGraph* stau = set_tev_stau(tanBeta_);//stau TGraph* NoEWSB = set_NoEWSB(tanBeta_); TGraph* TEV_sn_d0_1 = set_sneutrino_d0_1(tanBeta_); TGraph* TEV_sn_d0_2 = set_sneutrino_d0_2(tanBeta_); int nPoints = nSusyGridPoints(); double m0[nPoints],m12[nPoints],squarkMass[nPoints],gluinoMass[nPoints]; susyGrid(m0,m12,squarkMass,gluinoMass); TGraph2D* squarkMasses = new TGraph2D("squarkMasses","",nPoints,m0,m12,squarkMass); TGraph2D* gluinoMasses = new TGraph2D("gluinoMasses","",nPoints,m0,m12,gluinoMass); TH2D* gluinoMassPlot = gluinoMasses->GetHistogram(); TH2D* squarkMassPlot = squarkMasses->GetHistogram(); //constant ssqquark and gluino lines TF1* lnsq[15]; TF1* lngl[15]; TGraph* lnsq_40[15]; TGraph* lngl_40[15]; TLatex* sq_text[15]; TLatex* gl_text[15]; TLatex* sq_40_text[15]; TLatex* gl_40_text[15]; for(int i = 1; i < 15; i++){ //lnsq[i] = constant_squark(tanBeta_,i); //sq_text[i] = constant_squark_text(i,*lnsq[i],tanBeta_); //lngl[i] = constant_gluino(tanBeta_,i); //gl_text[i] = constant_gluino_text(i,*lngl[i]); lnsq_40[i] = constant_mass(i*250,squarkMasses); lngl_40[i] = constant_mass(i*250,gluinoMasses); sq_40_text[i] = constant_squark_text_tanBeta40(i*250,lnsq_40[i]); gl_40_text[i] = constant_gluino_text_tanBeta40(i*250,lngl_40[i]);; } //Legends TLegend* legst = makeStauLegend(0.05,tanBeta_); TLegend* legNoEWSB = makeNoEWSBLegend(0.05,tanBeta_); TLegend* legexp = makeExpLegend( *TEV_sg_cdf,*TEV_sg_d0,*LEP_ch,*LEP_sl,*TEV_sn_d0_1,0.035,tanBeta_); //make Canvas TCanvas* cvsSys = new TCanvas("cvsnm","cvsnm",0,0,800,600); gStyle->SetOptTitle(0); cvsSys->SetFillColor(0); cvsSys->GetPad(0)->SetRightMargin(0.07); cvsSys->Range(-120.5298,26.16437,736.0927,750); // cvsSys->Range(-50.5298,26.16437,736.0927,500); cvsSys->SetFillColor(0); cvsSys->SetBorderMode(0); cvsSys->GetPad(0)->SetBorderMode(0); cvsSys->GetPad(0)->SetBorderSize(2); cvsSys->GetPad(0)->SetLeftMargin(0.1407035); cvsSys->GetPad(0)->SetTopMargin(0.08); cvsSys->GetPad(0)->SetBottomMargin(0.13); cvsSys->SetTitle("tan#beta="+tanb); output->cd(); //and now the exclusion limits TGraph* SSdilep; TGraphErrors* OSdilep; TGraphErrors* RA1; TGraphErrors* RA1_old; TGraphErrors* RA5_old; TGraphErrors* RA6_old; TGraph* RA2b_1b_loose; TGraph* RA2b_1b_tight; TGraph* RA2b_2b_loose; TGraph* RA2b_2b_tight; TGraph* RA2b_1b_loose_exp; TGraph* RA2b_1b_tight_exp; TGraph* RA2b_2b_loose_exp; TGraph* RA2b_2b_tight_exp; TGraph* RA2b_1b_loose_exp_p; TGraph* RA2b_1b_tight_exp_p; TGraph* RA2b_2b_loose_exp_p; TGraph* RA2b_2b_tight_exp_p; TGraph* RA2b_1b_loose_exp_m; TGraph* RA2b_1b_tight_exp_m; TGraph* RA2b_2b_loose_exp_m; TGraph* RA2b_2b_tight_exp_m; TGraph* RA2b_1b_loose_shade; TGraph* RA2b_1b_tight_shade; TGraph* RA2b_2b_loose_shade; TGraph* RA2b_2b_tight_shade; TSpline3* RA1_tb40 =getCLs1080ObsNLOtb40(); if (tanBeta_ == 10) { SSdilep = SSdilep_NLO(); OSdilep = OSdilep_NLO(); RA1 = RA1_NLO(); RA1_old = getRA1Observed_NLO_tanBeta10(); RA5_old = getRA5Observed_NLO_tanBeta10(); RA6_old = getRA6Observed_NLO_tanBeta10(); } if(tanBeta_ == 40) { // RA2b_1b_loose = RA2b_limit("an-scanplot-unblind-tb40-withcontam-ge1b-loose.root", "hsusyscanExcluded"); // RA2b_2b_loose = RA2b_limit("an-scanplot-unblind-tb40-withcontam-ge2b-loose.root", "hsusyscanExcluded"); // RA2b_1b_tight = RA2b_limit("an-scanplot-unblind-tb40-withcontam-ge1b-tight.root", "hsusyscanExcluded"); // RA2b_2b_tight = RA2b_limit("an-scanplot-unblind-tb40-withcontam-ge2b-tight.root", "hsusyscanExcluded"); // RA2b_1b_loose = RA2b_limit("/afs/cern.ch/user/o/owen/public/RA2b/clsplots-tb40-ge1bloose.root", "hcls"); // RA2b_2b_loose = RA2b_limit("/afs/cern.ch/user/o/owen/public/RA2b/clsplots-tb40-ge2bloose.root", "hcls"); // RA2b_1b_tight = RA2b_limit("/afs/cern.ch/user/o/owen/public/RA2b/clsplots-tb40-ge1btight.root", "hcls"); // RA2b_2b_tight = RA2b_limit("/afs/cern.ch/user/o/owen/public/RA2b/clsplots-tb40-ge2btight.root", "hcls"); /* TString ra2bfile= "RA2b_tb40_exclusion.25Sep.root"; RA2b_1b_loose = RA2b_limit(ra2bfile,"curve4_ge1bloose"); RA2b_1b_tight = RA2b_limit(ra2bfile,"curve4_ge1btight"); RA2b_2b_loose = RA2b_limit(ra2bfile,"curve4_ge2bloose"); RA2b_2b_tight = RA2b_limit(ra2bfile,"curve4_ge2btight"); RA2b_1b_loose_exp = RA2b_limit(ra2bfile,"curve4_1bloose_exp"); RA2b_1b_tight_exp = RA2b_limit(ra2bfile,"curve4_1btight_exp"); RA2b_2b_loose_exp = RA2b_limit(ra2bfile,"curve4_2bloose_exp"); RA2b_2b_tight_exp = RA2b_limit(ra2bfile,"curve4_2btight_exp"); RA2b_1b_loose_exp_p = RA2b_limit(ra2bfile,"curve4_1bloose_exp_plus"); RA2b_1b_tight_exp_p = RA2b_limit(ra2bfile,"curve4_1btight_exp_plus"); RA2b_2b_loose_exp_p = RA2b_limit(ra2bfile,"curve4_2bloose_exp_plus"); RA2b_2b_tight_exp_p = RA2b_limit(ra2bfile,"curve4_2btight_exp_plus"); RA2b_1b_loose_exp_m = RA2b_limit(ra2bfile,"curve4_1bloose_exp_minus"); RA2b_1b_tight_exp_m = RA2b_limit(ra2bfile,"curve4_1btight_exp_minus"); RA2b_2b_loose_exp_m = RA2b_limit(ra2bfile,"curve4_2bloose_exp_minus"); RA2b_2b_tight_exp_m = RA2b_limit(ra2bfile,"curve4_2btight_exp_minus"); */ RA2b_1b_loose = get_RA2b_1bloose(); RA2b_1b_tight = get_RA2b_1btight(); RA2b_2b_loose = get_RA2b_2bloose(); RA2b_2b_tight = get_RA2b_2btight(); RA2b_1b_loose_exp = get_RA2b_1bloose_exp(); RA2b_1b_tight_exp = get_RA2b_1btight_exp(); RA2b_2b_loose_exp = get_RA2b_2bloose_exp(); RA2b_2b_tight_exp = get_RA2b_2btight_exp(); RA2b_1b_loose_exp_p = get_RA2b_1bloose_exp_p(); RA2b_1b_tight_exp_p = get_RA2b_1btight_exp_p(); RA2b_2b_loose_exp_p = get_RA2b_2bloose_exp_p(); RA2b_2b_tight_exp_p = get_RA2b_2btight_exp_p(); RA2b_1b_loose_exp_m = get_RA2b_1bloose_exp_m(); RA2b_1b_tight_exp_m = get_RA2b_1btight_exp_m(); RA2b_2b_loose_exp_m = get_RA2b_2bloose_exp_m(); RA2b_2b_tight_exp_m = get_RA2b_2btight_exp_m(); cout<<"Getting the shaded regions"<<endl; RA2b_1b_loose_shade = getShadedRegion(RA2b_1b_loose_exp_p,RA2b_1b_loose_exp_m); RA2b_1b_tight_shade = getShadedRegion(RA2b_1b_tight_exp_p,RA2b_1b_tight_exp_m); RA2b_2b_loose_shade = getShadedRegion(RA2b_2b_loose_exp_p,RA2b_2b_loose_exp_m); RA2b_2b_tight_shade = getShadedRegion(RA2b_2b_tight_exp_p,RA2b_2b_tight_exp_m); cout<<"DONE Getting the shaded regions"<<endl; } double m0min = 0; if (tanBeta_ == 40) m0min=400; TH2D* hist = new TH2D("h","h",100,m0min,2000,100,120,700); hist->Draw(); hist->GetXaxis()->SetTitle("m_{0} [GeV]"); hist->GetYaxis()->SetTitle("m_{1/2} [GeV]"); hist->GetXaxis()->SetTitleOffset(.9); hist->GetXaxis()->SetTitleSize(0.06); hist->GetYaxis()->SetTitleOffset(1.0); hist->GetYaxis()->SetTitleSize(0.06); hist->GetXaxis()->SetNdivisions(506); // if (tanBeta_ == 50) hist->GetXaxis()->SetNdivisions(504); hist->GetYaxis()->SetNdivisions(506); int col[]={2,3,4}; //SSdilep->SetLineColor(kGreen+2); //SSdilep->SetLineStyle(1); //SSdilep->SetLineWidth(3); // //OSdilep->SetLineColor(kCyan+2); //OSdilep->SetLineStyle(1); //OSdilep->SetLineWidth(3); // //RA1->SetLineColor(kRed+2); //RA1->SetLineStyle(1); //RA1->SetLineWidth(3); RA1_tb40->SetLineColor(kBlack); RA1_tb40->SetLineStyle(7); RA1_tb40->SetLineWidth(3); RA1_tb40->SetName("RA1_tb40"); // //TSpline3 *sRA1 = new TSpline3("sRA1",RA1_old); //sRA1->SetLineColor(kRed+2); ////sRA1->SetLineStyle(5); //sRA1->SetLineStyle(2); //sRA1->SetLineWidth(3); // //RA5_old->SetLineColor(kGreen+2); ////RA5_old->SetLineStyle(5); //RA5_old->SetLineStyle(2); //RA5_old->SetLineWidth(3); // //RA6_old->SetLineColor(kCyan+2); ////RA6_old->SetLineStyle(1); //RA6_old->SetLineStyle(2); //RA6_old->SetLineWidth(3); if (RA2bmode.Contains("all")) { RA2b_1b_loose->SetLineColor(kRed+2); RA2b_1b_loose->SetLineStyle(2); RA2b_1b_loose->SetLineWidth(3); RA2b_1b_tight->SetLineColor(kRed+2); RA2b_1b_tight->SetLineStyle(1); RA2b_1b_tight->SetLineWidth(3); RA2b_2b_loose->SetLineColor(kGreen+2); RA2b_2b_loose->SetLineStyle(2); RA2b_2b_loose->SetLineWidth(3); RA2b_2b_tight->SetLineColor(kGreen+2); RA2b_2b_tight->SetLineStyle(1); RA2b_2b_tight->SetLineWidth(3); } else { RA2b_1b_loose->SetLineColor(kRed); RA2b_1b_loose->SetLineStyle(1); RA2b_1b_loose->SetLineWidth(3); RA2b_1b_tight->SetLineColor(kRed); RA2b_1b_tight->SetLineStyle(1); RA2b_1b_tight->SetLineWidth(3); RA2b_2b_loose->SetLineColor(kRed); RA2b_2b_loose->SetLineStyle(1); RA2b_2b_loose->SetLineWidth(3); RA2b_2b_tight->SetLineColor(kRed); RA2b_2b_tight->SetLineStyle(1); RA2b_2b_tight->SetLineWidth(3); RA2b_1b_loose_exp->SetLineColor(kBlue); RA2b_2b_loose_exp->SetLineColor(kBlue); RA2b_1b_tight_exp->SetLineColor(kBlue); RA2b_2b_tight_exp->SetLineColor(kBlue); RA2b_1b_loose_exp->SetLineStyle(5); RA2b_2b_loose_exp->SetLineStyle(5); RA2b_1b_tight_exp->SetLineStyle(5); RA2b_2b_tight_exp->SetLineStyle(5); RA2b_1b_loose_exp->SetLineWidth(3); RA2b_2b_loose_exp->SetLineWidth(3); RA2b_1b_tight_exp->SetLineWidth(3); RA2b_2b_tight_exp->SetLineWidth(3); int acolor=kCyan+2; RA2b_1b_loose_exp_p->SetLineColor(acolor); RA2b_2b_loose_exp_p->SetLineColor(acolor); RA2b_1b_tight_exp_p->SetLineColor(acolor); RA2b_2b_tight_exp_p->SetLineColor(acolor); RA2b_1b_loose_exp_p->SetLineStyle(1); RA2b_2b_loose_exp_p->SetLineStyle(1); RA2b_1b_tight_exp_p->SetLineStyle(1); RA2b_2b_tight_exp_p->SetLineStyle(1); RA2b_1b_loose_exp_p->SetLineWidth(3); RA2b_2b_loose_exp_p->SetLineWidth(3); RA2b_1b_tight_exp_p->SetLineWidth(3); RA2b_2b_tight_exp_p->SetLineWidth(3); RA2b_1b_loose_exp_m->SetLineColor(acolor); RA2b_2b_loose_exp_m->SetLineColor(acolor); RA2b_1b_tight_exp_m->SetLineColor(acolor); RA2b_2b_tight_exp_m->SetLineColor(acolor); RA2b_1b_loose_exp_m->SetLineStyle(1); RA2b_2b_loose_exp_m->SetLineStyle(1); RA2b_1b_tight_exp_m->SetLineStyle(1); RA2b_2b_tight_exp_m->SetLineStyle(1); RA2b_1b_loose_exp_m->SetLineWidth(3); RA2b_2b_loose_exp_m->SetLineWidth(3); RA2b_1b_tight_exp_m->SetLineWidth(3); RA2b_2b_tight_exp_m->SetLineWidth(3); RA2b_1b_tight_shade->SetFillStyle(fillstyle); RA2b_1b_tight_shade->SetFillColor(acolor); RA2b_1b_loose_shade->SetFillStyle(fillstyle); RA2b_1b_loose_shade->SetFillColor(acolor); RA2b_2b_tight_shade->SetFillStyle(fillstyle); RA2b_2b_tight_shade->SetFillColor(acolor); RA2b_2b_loose_shade->SetFillStyle(fillstyle); RA2b_2b_loose_shade->SetFillColor(acolor); } TLegend* myleg; float leg_x1=0.39+0.23; float leg_y1=0.65+0.05; float leg_x2= 0.55+0.25; float leg_y2= 0.84+0.05; if (RA2bmode.Contains("all")) { leg_y1 -= 0.1; } if( plotLO_ ) myleg = new TLegend(0.3,0.65,0.65,0.8,NULL,"brNDC"); else myleg = new TLegend(leg_x1,leg_y1,leg_x2,leg_y2,NULL,"brNDC"); myleg->SetFillColor(0); myleg->SetShadowColor(0); myleg->SetTextSize(0.04); myleg->SetBorderSize(0); TLegendEntry *entry=0; // entry= myleg->AddEntry("ge1bLoose","LEP2 #tilde{#chi}_{1}^{#pm}","f"); // entry->SetFillColor(3); // entry->SetLineColor(3); // entry->SetFillStyle(1001); if (RA2bmode.Contains("all")) { entry= myleg->AddEntry("ge1bLoose","#geq 1b Loose","l"); entry->SetLineColor(1); entry->SetLineStyle(2); entry->SetLineWidth(3); entry->SetLineColor(kRed+2); entry->SetTextColor(kRed+2); entry=myleg->AddEntry("ge2bLoose","#geq 2b Loose","l"); entry->SetLineColor(1); entry->SetLineStyle(2); entry->SetLineWidth(3); entry->SetLineColor(kGreen+2); entry->SetTextColor(kGreen+2); entry=myleg->AddEntry("ge1bTight","#geq 1b Tight","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetLineColor(kRed+2); entry->SetTextColor(kRed+2); entry=myleg->AddEntry("ge2bTight","#geq 2b Tight","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetLineColor(kGreen+2); entry->SetTextColor(kGreen+2); } else if (RA2bmode.Contains("ge")) { entry=myleg->AddEntry("ge1bTight","Observed Limit","l"); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetLineColor(kRed); entry->SetTextColor(kBlack); entry=myleg->AddEntry("ge1bTight_exp","Expected Limit #pm 1#sigma","lf"); entry->SetFillStyle (fillstyle); entry->SetFillColor (kCyan+2); entry->SetLineStyle(5); entry->SetLineWidth(3); entry->SetLineColor(kBlue); entry->SetTextColor(kBlack); } if (RA2bmode=="allPlusRA1") { entry=myleg->AddEntry("RA1_tb40","CMS #alpha_{T}","l"); entry->SetLineColor(kBlack); entry->SetLineStyle(7); entry->SetLineWidth(3); entry->SetTextColor(kBlack); } //constant squark and gluino mass contours for (int it=2;it<9;it++) { if(it<7){ if(lngl_40[it]!=0)lngl_40[it]->Draw("samec"); if(gl_40_text[it]!=0)gl_40_text[it]->Draw(); } if(lnsq_40[it]!=0)lnsq_40[it]->Draw("samec"); if(it<6){ if(sq_40_text[it]!=0)sq_40_text[it]->Draw(); } } //SSdilep->Draw("samec"); //OSdilep->Draw("samec"); //RA1->Draw("samec"); // //sRA1->Draw("same"); //RA5_old->Draw("c same"); //RA6_old->Draw("c same"); TString drawopt="samel"; //default choice if (RA2bmode.Contains("all")) RA2b_1b_loose->Draw(drawopt); if (RA2bmode.Contains("all")) RA2b_2b_loose->Draw(drawopt); if (RA2bmode.Contains("all")) RA2b_1b_tight->Draw(drawopt); if (RA2bmode.Contains("all")) RA2b_2b_tight->Draw(drawopt); if (RA2bmode=="allPlusRA1") RA1_tb40->Draw(drawopt); if (RA2bmode=="ge1btight") { RA2b_1b_tight_shade->Draw("f"); RA2b_1b_tight_exp_p->Draw(drawopt); RA2b_1b_tight_exp_m->Draw(drawopt); RA2b_1b_tight_exp->Draw(drawopt); RA2b_1b_tight->Draw(drawopt); } else if (RA2bmode=="ge1bloose") { RA2b_1b_loose_shade->Draw("f"); RA2b_1b_loose_exp_p->Draw(drawopt); RA2b_1b_loose_exp_m->Draw(drawopt); RA2b_1b_loose_exp->Draw(drawopt); RA2b_1b_loose->Draw(drawopt); } else if (RA2bmode=="ge2bloose") { RA2b_2b_loose_shade->Draw("f"); RA2b_2b_loose_exp_p->Draw(drawopt); RA2b_2b_loose_exp_m->Draw(drawopt); RA2b_2b_loose_exp->Draw(drawopt); RA2b_2b_loose->Draw(drawopt); } else if (RA2bmode=="ge2btight") { RA2b_2b_tight_shade->Draw("f"); RA2b_2b_tight_exp_p->Draw(drawopt); RA2b_2b_tight_exp_m->Draw(drawopt); RA2b_2b_tight_exp->Draw(drawopt); RA2b_2b_tight->Draw(drawopt); } // // //TLatex* RA1label = new TLatex(670,430.,"#alpha_{T}"); ////TLatex* RA1label = new TLatex(80,288.,"#alpha_{T}"); //RA1label->SetTextFont(42); //RA1label->SetTextSize(0.05); //RA1label->SetTextColor(kRed+2); //RA1label->Draw("same"); TLatex* RA2blabel_2b=0; TLatex* RA2blabel_1b=0; if (false) { RA2blabel_2b = new TLatex(1150,330.,"#geq 2 b-tags"); RA2blabel_2b->SetTextFont(42); RA2blabel_2b->SetTextSize(0.05); RA2blabel_2b->SetTextColor(kGreen+2); RA2blabel_2b->Draw("same"); RA2blabel_1b = new TLatex(1150,430.,"#geq 1 b-tags"); RA2blabel_1b->SetTextFont(42); RA2blabel_1b->SetTextSize(0.05); RA2blabel_1b->SetTextColor(kRed+2); RA2blabel_1b->Draw("same"); } // //TLatex* RA5label = new TLatex(400,370.,"SS Dilepton"); //RA5label->SetTextFont(42); ////RA5label->SetTextAngle(20); //RA5label->SetTextSize(0.04); //RA5label->SetTextColor(kGreen+2); //RA5label->Draw("same"); // //TLatex* RA6label = new TLatex(650,215.,"OS Dilepton"); //RA6label->SetTextFont(42); ////RA6label->SetTextAngle(8); //RA6label->SetTextSize(0.04); //RA6label->SetTextColor(kCyan+2); //RA6label->Draw("same"); //exclusion limits previous experiments if(tanBeta_ == 3){ TEV_sn_d0_1->Draw("fsame"); TEV_sn_d0_2->Draw("fsame"); } // LEP_ch->Draw("fsame"); if (tanBeta_ != 40) LEP_sl->Draw("fsame"); //remove CDF/D0 excluded regions // TEV_sg_cdf->Draw("fsame"); // TEV_sg_d0->Draw("same"); // TEV_sg_d0->Draw("fsame"); //other labels Double_t xpos = 0; Double_t xposi = 0; Double_t ypos = 0; if(tanBeta_ == 40) xposi = 180+160; if(tanBeta_ == 40) xpos = 400;//240; if(tanBeta_ == 40) ypos = -10; //TLatex* lumilabel = new TLatex(750 +xposi + 100,767.-154,"#sqrt{s} = 7 TeV, #scale[0.65]{#int}Ldt = 0.98 fb^{-1}"); TLatex* lumilabel = new TLatex(925+xpos-50,767.-154+105,"#sqrt{s} = 7 TeV, L_{int} = 1.1 fb^{-1}"); TLatex* integral_symbol = new TLatex(1287 +xposi + 100-85,767.-145+95,"#int"); lumilabel->SetTextSize(0.05); integral_symbol->SetTextSize(0.03); lumilabel->Draw("same"); // integral_symbol->Draw("same"); TLatex* cmslabel = new TLatex(10.+xpos,767.-154+105,"CMS Preliminary"); cmslabel->SetTextSize(0.05); cmslabel->Draw("same"); TString text_tanBeta; text_tanBeta = "tan#beta = "+tanb+", A_{0} = -500 GeV, #mu > 0"; TLatex* cmssmpars = new TLatex(/*530.+xpos,690.+ypos-130*/150+xpos,660,text_tanBeta); cmssmpars->SetTextSize(0.04); cmssmpars->Draw("same"); TLatex* lep_chargino = new TLatex(250,135,"LEP2 #tilde{#chi}_{1}^{#pm}"); lep_chargino->SetTextSize(0.03); lep_chargino->SetTextFont(42); // lep_chargino->Draw("same"); TLatex* lep_slepton = new TLatex(26,190,"LEP2 #tilde{#font[12]{l}}^{#pm}"); lep_slepton->SetTextSize(0.03); lep_slepton->SetTextAngle(-83); lep_slepton->SetTextFont(42); // lep_slepton->Draw("same"); //LM points TMarker* LM0 = new TMarker(200.,160.,20); TMarker* LM1 = new TMarker(60.,250.,20); TMarker* LM3 = new TMarker(330.,240.,20); TMarker* LM6 = new TMarker(80.,400.,20); LM0->SetMarkerSize(1.2); LM1->SetMarkerSize(1.2); TLatex* tLM0 = new TLatex(205.,160.," LM0"); tLM0->SetTextSize(0.035); TLatex* tLM1 = new TLatex(80.,245.,"LM1"); tLM1->SetTextSize(0.035); //TLatex* tLM3 = new TLatex(350.,235.,"LM3 (tan#beta=20)"); TLatex* tLM3 = new TLatex(350.,235.,"LM3"); tLM3->SetTextSize(0.035); TLatex* tLM6 = new TLatex(100.,395.,"LM6"); tLM6->SetTextSize(0.035); // if (tanBeta_ != 50){ // LM0->Draw("same"); // tLM0->Draw("same"); // LM1->Draw("same"); // tLM1->Draw("same"); // } /* if (tanBeta_ == 10){ LM1->Draw("same"); tLM1->Draw("same"); LM3->Draw("same"); tLM3->Draw("same"); LM6->Draw("same"); tLM6->Draw("same"); } */ //stau=LSP contour stau->Draw("fsame"); // NoEWSB->Draw("fsame"); //legends // legexp->Draw(); // legst->Draw(); //legNoEWSB->Draw(); myleg->Draw(); hist->Draw("sameaxis"); cvsSys->RedrawAxis(); cvsSys->Update(); cvsSys->Write(); if( plotLO_ ){ cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_LO.pdf"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_LO.png"); }else{ cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_"+RA2bmode+".eps"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_"+RA2bmode+".pdf"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_"+RA2bmode+".png"); } output->Write(); //output->Close(); //delete output; }
void plotAngResVsSnr2(){ TChain* cLdb = new TChain("angResTree"); TChain* cSnrLdb = new TChain("snrTree"); TChain* cWais = new TChain("angResTree"); TChain* cSnrWais = new TChain("snrTree"); // cLdb->Add("filterOffs/phaseCenter/generateAngularResolutionTreeVPOLPlots_*"); // cSnrLdb->Add("filterOffs/phaseCenter/generateSignalToNoiseRatioTreeVPOLPlots_*"); // cWais->Add("filterOffs/phaseCenter/generateAngularResolutionTreePlots_*"); // cSnrWais->Add("filterOffs/phaseCenter/generateSignalToNoiseRatioTreePlots_*"); cLdb->Add("extremeFilter/phaseCenter/generateAngularResolutionTreeVPOLPlots_*"); cSnrLdb->Add("extremeFilter/phaseCenter/generateSignalToNoiseRatioTreeVPOLPlots_*"); cWais->Add("filterOns/phaseCenter/generateAngularResolutionTreePlots_*"); cSnrWais->Add("filterOns/phaseCenter/generateSignalToNoiseRatioTreePlots_*"); Double_t deltaPhiDegLdb = 0; cLdb->SetBranchAddress("deltaPhiDeg", &deltaPhiDegLdb); Double_t deltaThetaDegLdb = 0; cLdb->SetBranchAddress("deltaThetaDeg", &deltaThetaDegLdb); UInt_t eventNumber = 0; cLdb->SetBranchAddress("eventNumber", &eventNumber); Double_t phiExpected = 0; cLdb->SetBranchAddress("phiExpected", &phiExpected); Double_t snr0Ldb = 0; cSnrLdb->SetBranchAddress("snr0", &snr0Ldb); Long64_t nEntries = cSnrLdb->GetEntries(); Long64_t maxEntry = 0; //5; //1000; //10000; Long64_t startEntry = 0; if(maxEntry<=0 || maxEntry > nEntries) maxEntry = nEntries; std::cout << "Processing " << maxEntry << " of " << nEntries << " entries." << std::endl; ProgressBar p(maxEntry-startEntry); double dPhi = 0.05; double phiRange = 6; double dTheta = 0.05; double thetaRange = 6; double rebin = 2; const int nBinsPhi = 32; std::vector<double> theSnrBinsLdb = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 21};//, 22, 23, 24, 25}; TH2D* hSnrVsPhiExpectedLdb = new TH2D("hSnrVsPhiExpectedLdb", "SNR vs. #phi_{LDB}; #phi_{LDB} (Degrees); SNR (no units); Events per bin", nBinsPhi, 0, 360, theSnrBinsLdb.size()-1, &theSnrBinsLdb[0]); TH1D* hDeltaPhiLdb = new TH1D("hDeltaPhiLdb", "#delta#phi_{LDB}; #delta#phi (Degrees); Events per bin", phiRange/(dPhi*rebin), -phiRange/2 - dPhi/2, phiRange/2 - dPhi/2); // TH2D* hDeltaPhiLdb2 = new TH2D("hDeltaPhiLdb2", "#delta#phi_{LDB} vs. SNR; SNR (no units); #delta#phi (Degrees); Events per bin", nBinsSnr, minSnr, maxSnr, phiRange/dPhi, -phiRange/2 - dPhi/2, phiRange/2 - dPhi/2); TH2D* hDeltaPhiLdb2 = new TH2D("hDeltaPhiLdb2", "#delta#phi_{LDB} vs. SNR; SNR (no units); #delta#phi (Degrees); Events per bin", theSnrBinsLdb.size()-1, &theSnrBinsLdb[0], phiRange/dPhi, -phiRange/2 - dPhi/2, phiRange/2 - dPhi/2); TH1D* hDeltaThetaLdb = new TH1D("hDeltaThetaLdb", "#delta#theta_{LDB}; #delta#theta (Degrees); Events per bin", thetaRange/dTheta, -thetaRange/2 - dTheta/2, thetaRange/2 - dTheta/2); // TH2D* hDeltaThetaLdb2 = new TH2D("hDeltaThetaLdb2", "#delta#theta_{LDB} vs. SNR; SNR (no units); #delta#theta (Degrees); Events per bin", nBinsSnr, minSnr, maxSnr, thetaRange/dTheta, -thetaRange/2 - dTheta/2, thetaRange/2 - dTheta/2); TH2D* hDeltaThetaLdb2 = new TH2D("hDeltaThetaLdb2", "#delta#theta_{LDB} vs. SNR; SNR (no units); #delta#theta (Degrees); Events per bin", theSnrBinsLdb.size()-1, &theSnrBinsLdb[0], thetaRange/dTheta, -thetaRange/2 - dTheta/2, thetaRange/2 - dTheta/2); double lowestSnr = 9999; double highestSnr = -9999; UInt_t lowEventNumber; UInt_t highEventNumber; const double phiCut = 3; for(Long64_t entry = startEntry; entry < maxEntry; entry++){ cLdb->GetEntry(entry); cSnrLdb->GetEntry(entry); // cLdbOff->GetEntry(entry); if(TMath::Abs(deltaPhiDegLdb) < phiCut){ hSnrVsPhiExpectedLdb->Fill(phiExpected, snr0Ldb); // if(snr0Ldb > 6){ hDeltaPhiLdb->Fill(deltaPhiDegLdb); hDeltaPhiLdb2->Fill(snr0Ldb, deltaPhiDegLdb); hDeltaThetaLdb->Fill(deltaThetaDegLdb); hDeltaThetaLdb2->Fill(snr0Ldb, deltaThetaDegLdb); // } if(snr0Ldb < lowestSnr){ lowestSnr = snr0Ldb; lowEventNumber = eventNumber; } if(snr0Ldb > highestSnr){ highestSnr = snr0Ldb; highEventNumber = eventNumber; } } p.inc(entry, maxEntry); } std::cout << "LDB: " << std::endl; std::cout << lowEventNumber << "\t" << lowestSnr << std::endl; std::cout << highEventNumber << "\t" << highestSnr << std::endl; auto c0 = new TCanvas(); hSnrVsPhiExpectedLdb->Draw("colz"); TObjArray* tArrLdbPhi = new TObjArray(); hDeltaPhiLdb2->FitSlicesY(NULL, 1, hDeltaPhiLdb2->GetNbinsY(), 0, "QNR", tArrLdbPhi); TH1D* hResolutionVsSnrPhiLdb = NULL; for(int i=0; i < tArrLdbPhi->GetEntries(); i++){ auto h = (TH1D*)tArrLdbPhi->At(i); // auto c0 = new TCanvas(); // TString opt = i==0? "" : "same"; // h->Draw(opt); if(i==2){ hResolutionVsSnrPhiLdb = h; hResolutionVsSnrPhiLdb->SetTitle("VPOL #delta#phi_{LDB}"); } new TCanvas(); h->Draw(); } TObjArray* tArrLdbTheta = new TObjArray(); hDeltaThetaLdb2->FitSlicesY(NULL, 1, hDeltaThetaLdb2->GetNbinsY(), 0, "QNR", tArrLdbTheta); TH1D* hResolutionVsSnrThetaLdb = NULL; for(int i=0; i < tArrLdbTheta->GetEntries(); i++){ auto h = (TH1D*)tArrLdbTheta->At(i); // auto c0 = new TCanvas(); // TString opt = i==0? "" : "same"; // h->Draw(opt); if(i==2){ hResolutionVsSnrThetaLdb = h; hResolutionVsSnrThetaLdb->SetTitle("VPOL #delta#theta_{LDB}"); } new TCanvas(); h->Draw(); } Double_t deltaPhiDegWais = 0; cWais->SetBranchAddress("deltaPhiDeg", &deltaPhiDegWais); Double_t deltaThetaDegWais = 0; cWais->SetBranchAddress("deltaThetaDeg", &deltaThetaDegWais); phiExpected = 0; cWais->SetBranchAddress("phiExpected", &phiExpected); Double_t snr0Wais = 0; cSnrWais->SetBranchAddress("snr0", &snr0Wais); std::vector<double> theSnrBinsWais = {0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 18, 21};//, 22, 23, 24, 25}; TH2D* hSnrVsPhiExpectedWais = new TH2D("hSnrVsPhiExpectedWais", "SNR vs. #phi_{WAIS}; #phi_{WAIS} (Degrees); SNR (no units); Events per bin", nBinsPhi, 0, 360, theSnrBinsWais.size()-1, &theSnrBinsWais[0]); TH1D* hDeltaPhiWais = new TH1D("hDeltaPhiWais", "#delta#phi_{WAIS}; #delta#phi (Degrees); Events per bin", phiRange/(dPhi*rebin), -phiRange/2 - dPhi/2, phiRange/2 - dPhi/2); TH2D* hDeltaPhiWais2 = new TH2D("hDeltaPhiWais2", "#delta#phi_{WAIS} vs. SNR; SNR (no units); #delta#phi (Degrees); Events per bin", theSnrBinsWais.size()-1, &theSnrBinsWais[0], phiRange/dPhi, -phiRange/2 - dPhi/2, phiRange/2 - dPhi/2); TH1D* hDeltaThetaWais = new TH1D("hDeltaThetaWais", "#delta#theta_{WAIS}; #delta#theta (Degrees); Events per bin", thetaRange/dTheta, -thetaRange/2 - dTheta/2, thetaRange/2 - dTheta/2); TH2D* hDeltaThetaWais2 = new TH2D("hDeltaThetaWais2", "#delta#theta_{WAIS} vs. SNR; SNR (no units); #delta#theta (Degrees); Events per bin", theSnrBinsWais.size()-1, &theSnrBinsWais[0], thetaRange/dTheta, -thetaRange/2 - dTheta/2, thetaRange/2 - dTheta/2); Long64_t nEntries2 = cSnrWais->GetEntries(); Long64_t maxEntry2 = 0; //5; //1000; //10000; Long64_t startEntry2 = 0; if(maxEntry2<=0 || maxEntry2 > nEntries2) maxEntry2 = nEntries2; std::cout << "Processing " << maxEntry2 << " of " << nEntries2 << " entries." << std::endl; ProgressBar p2(maxEntry2-startEntry2); for(Long64_t entry = startEntry2; entry < maxEntry2; entry++){ cWais->GetEntry(entry); cSnrWais->GetEntry(entry); if(TMath::Abs(deltaPhiDegWais) < phiCut){ hSnrVsPhiExpectedWais->Fill(phiExpected, snr0Wais); hDeltaPhiWais->Fill(deltaPhiDegWais); hDeltaPhiWais2->Fill(snr0Wais, deltaPhiDegWais); hDeltaThetaWais->Fill(deltaThetaDegWais); hDeltaThetaWais2->Fill(snr0Wais, deltaThetaDegWais); } p2.inc(entry, maxEntry2); } TObjArray* tArrWaisPhi = new TObjArray(); hDeltaPhiWais2->FitSlicesY(NULL, 1, hDeltaPhiWais2->GetNbinsY(), 0, "QNR", tArrWaisPhi); TH1D* hResolutionVsSnrPhiWais = NULL; for(int i=0; i < tArrWaisPhi->GetEntries(); i++){ auto h = (TH1D*)tArrWaisPhi->At(i); // auto c0 = new TCanvas(); // TString opt = i==0? "" : "same"; // h->Draw(opt); if(i==2){ hResolutionVsSnrPhiWais = h; hResolutionVsSnrPhiWais->SetTitle("HPOL #delta#phi_{WAIS}"); } new TCanvas(); h->Draw(); } TObjArray* tArrWaisTheta = new TObjArray(); hDeltaThetaWais2->FitSlicesY(NULL, 1, hDeltaThetaWais2->GetNbinsY(), 0, "QNR", tArrWaisTheta); TH1D* hResolutionVsSnrThetaWais = NULL; for(int i=0; i < tArrWaisTheta->GetEntries(); i++){ auto h = (TH1D*)tArrWaisTheta->At(i); // auto c0 = new TCanvas(); // TString opt = i==0? "" : "same"; // h->Draw(opt); if(i==2){ hResolutionVsSnrThetaWais = h; hResolutionVsSnrThetaWais->SetTitle("HPOL #delta#theta_{WAIS}"); } new TCanvas(); h->Draw(); } auto c0a = new TCanvas(); hSnrVsPhiExpectedWais->Draw("colz"); return; auto c1 = new TCanvas(); hDeltaPhiWais2->Draw("colz"); auto c1a = new TCanvas(); hDeltaPhiLdb2->Draw("colz"); auto c2 = new TCanvas(); hDeltaThetaWais2->Draw("colz"); auto c2a = new TCanvas(); hDeltaThetaLdb2->Draw("colz"); // auto c3 = new TCanvas(); // // hResolutionVsSnrPhiLdb->SetLineColor(kRed); // // hResolutionVsSnrThetaLdb->SetLineColor(kBlue); // hResolutionVsSnrPhiLdb->Draw(); // hResolutionVsSnrThetaLdb->Draw("same"); // auto c3a = new TCanvas(); // // hResolutionVsSnrPhiWais->SetLineColor(kRed); // // hResolutionVsSnrThetaWais->SetLineColor(kBlue); // hResolutionVsSnrPhiWais->Draw(); // hResolutionVsSnrThetaWais->Draw("same"); auto c4 = new TCanvas(); hResolutionVsSnrPhiWais->SetLineColor(kRed); hResolutionVsSnrPhiLdb->SetLineColor(kBlue); hResolutionVsSnrThetaWais->SetLineColor(kMagenta); hResolutionVsSnrThetaLdb->SetLineColor(kCyan); hResolutionVsSnrPhiWais->SetMarkerSize(0); hResolutionVsSnrPhiLdb->SetMarkerSize(0); hResolutionVsSnrThetaWais->SetMarkerSize(0); hResolutionVsSnrThetaLdb->SetMarkerSize(0); hResolutionVsSnrPhiLdb->Draw(); hResolutionVsSnrThetaLdb->Draw("same"); hResolutionVsSnrPhiWais->Draw("same"); hResolutionVsSnrThetaWais->Draw("same"); auto l4 = c4->BuildLegend(); // l1->SetNColumns(2); l4->Draw(); // hs[0]->SetMaximum(0.13); hResolutionVsSnrPhiLdb->SetTitle("Angular Resolution vs. SNR; SNR; Angular Resolution (Degrees)"); hResolutionVsSnrPhiLdb->SetMaximum(1); hResolutionVsSnrPhiLdb->SetMinimum(0); //hDeltaPhiDegPhaseLdb->SetTitle("ANITA Angular Resolution Using Fitted Phase Centres; #delta#theta or #delta#phi (Degrees); Fraction of events per bin"); }
void draw_Src(TChain *tMc, TChain *tExpA, TChain *tExpB, const char *name, const char *fname, double kSP = 0.5, double kRndm = 0.0) { char str[256]; double rAB; long NA, NB; gStyle->SetOptStat("i"); gStyle->SetOptFit(1); // gStyle->SetOptStat(0); // gStyle->SetOptFit(0); gStyle->SetTitleXSize(0.05); gStyle->SetTitleYSize(0.05); gStyle->SetLabelSize(0.05); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadBottomMargin(0.15); // gStyle->SetLineWidth(4); sprintf(str, "Monte Carlo energy deposit in %s decay;E, MeV", name); TH1D *hMc = new TH1D("hMc", str, 70, 0, 7); sprintf(str, "Monte Carlo SiPM energy deposit in %s decay;E, MeV", name); TH1D *hMcSiPM = new TH1D("hMcSiPM", str, 35, 0, 7); sprintf(str, "Monte Carlo PMT energy deposit in %s decay;E, MeV", name); TH1D *hMcPMT = new TH1D("hMcPMT", str, 35, 0, 7); sprintf(str, "Monte Carlo energy deposit in %s decay with random %2.0f%%;E, MeV", name, kRndm*100); TH1D *hMcR = new TH1D("hMcR", str, 70, 0, 7); sprintf(str, "Monte Carlo number of hits from %s decay", name); TH1D *hMcHits = new TH1D("hMcHits", str, 20, 0, 20); TH2D *hXY = new TH2D("hXY", "XY distribution of gamma flash center;X, cm;Y, cm", 25, 0, 100, 25, 0, 100); sprintf(str, "DANSS energy deposit in %s decay;E, MeV", name); TH1D *hExpA = new TH1D("hExpA", str, 70, 0, 7); TH1D *hExpB = new TH1D("hExpB", str, 70, 0, 7); TH1D *hExpC = new TH1D("hExpC", str, 70, 0, 7); sprintf(str, "SiPM energy deposit in %s decay;E, MeV", name); TH1D *hExpSiPMA = new TH1D("hExpSiPMA", str, 70, 0, 7); TH1D *hExpSiPMB = new TH1D("hExpSiPMB", str, 70, 0, 7); TH1D *hExpSiPMC = new TH1D("hExpSiPMC", str, 70, 0, 7); sprintf(str, "PMT energy deposit in %s decay;E, MeV", name); TH1D *hExpPMTA = new TH1D("hExpPMTA", str, 70, 0, 7); TH1D *hExpPMTB = new TH1D("hExpPMTB", str, 70, 0, 7); TH1D *hExpPMTC = new TH1D("hExpPMTC", str, 70, 0, 7); sprintf(str, "Number of hits from %s decay", name); TH1D *hHitsA = new TH1D("hHitsA", str, 20, 0, 20); TH1D *hHitsB = new TH1D("hHitsB", str, 20, 0, 20); TH1D *hHitsC = new TH1D("hHitsC", str, 20, 0, 20); TH1D *hTmpA = new TH1D("hTmpA", "Normalization counts A", 100, 0, 1000); TH1D *hTmpB = new TH1D("hTmpB", "Normalization counts B", 100, 0, 1000); TCut cxyz("NeutronX[0] >= 0 && NeutronX[1] >= 0 && NeutronX[2] >= 0"); TCut cz50("(NeutronX[2] - 49.5) * (NeutronX[2] - 49.5) < 100"); TCut ccc("(NeutronX[0] - 48) * (NeutronX[0] - 48) + (NeutronX[1] - 48) * (NeutronX[1] - 48) + (NeutronX[2] - 49.5) * (NeutronX[2] - 49.5) < 400"); TCut cVeto("VetoCleanHits < 2 && VetoCleanEnergy < 4"); TCut cn("SiPmCleanHits > 5"); sprintf(str, "%6.4f*SiPmCleanEnergy+%6.4f*PmtCleanEnergy", kSP, 1-kSP); tMc->Project("hMc", str, cxyz && ccc && cVeto && cn); tMc->Project("hMcSiPM", "SiPmCleanEnergy", cxyz && ccc && cVeto && cn); tMc->Project("hMcPMT", "PmtCleanEnergy", cxyz && ccc && cVeto && cn); sprintf(str, "MyRandom::GausAdd(%6.4f*SiPmCleanEnergy+%6.4f*PmtCleanEnergy, %6.4f)", kSP, 1-kSP, kRndm); tMc->Project("hMcR", str, cxyz && ccc && cVeto && cn); tMc->Project("hMcHits", "SiPmCleanHits", cxyz && ccc && cVeto); sprintf(str, "%6.4f*SiPmCleanEnergy+%6.4f*PmtCleanEnergy", kSP, 1-kSP); tExpA->Project("hXY", "NeutronX[1]+2:NeutronX[0]+2", cxyz && cz50 && cVeto && cn); tExpA->Project("hExpA", str, cxyz && ccc && cVeto && cn); tExpB->Project("hExpB", str, cxyz && ccc && cVeto && cn); tExpA->Project("hExpSiPMA", "SiPmCleanEnergy", cxyz && ccc && cVeto && cn); tExpB->Project("hExpSiPMB", "SiPmCleanEnergy", cxyz && ccc && cVeto && cn); tExpA->Project("hExpPMTA", "PmtCleanEnergy", cxyz && ccc && cVeto && cn); tExpB->Project("hExpPMTB", "PmtCleanEnergy", cxyz && ccc && cVeto && cn); tExpA->Project("hHitsA", "SiPmCleanHits", cxyz && ccc && cVeto); tExpB->Project("hHitsB", "SiPmCleanHits", cxyz && ccc && cVeto); NA = tExpA->Project("hTmpA", "SiPmCleanEnergy", "(SiPmCleanEnergy + PmtCleanEnergy) / 2 > 100"); NB = tExpB->Project("hTmpB", "SiPmCleanEnergy", "(SiPmCleanEnergy + PmtCleanEnergy) / 2 > 100"); rAB = 1.0 * NA / NB; printf("NA = %ld NB = %ld rAB = %f\n", NA, NB, rAB); hMc->Sumw2(); hMcSiPM->Sumw2(); hMcPMT->Sumw2(); hMcR->Sumw2(); hMcHits->Sumw2(); hExpA->Sumw2(); hExpB->Sumw2(); hExpSiPMA->Sumw2(); hExpSiPMB->Sumw2(); hExpPMTA->Sumw2(); hExpPMTB->Sumw2(); hHitsA->Sumw2(); hHitsB->Sumw2(); hExpC->Add(hExpA, hExpB, 1.0, -rAB); hExpSiPMC->Add(hExpSiPMA, hExpSiPMB, 1.0, -rAB); hExpPMTC->Add(hExpPMTA, hExpPMTB, 1.0, -rAB); hHitsC->Add(hHitsA, hHitsB, 1.0, -rAB); hMcHits->Scale(hHitsC->Integral() / hMcHits->Integral()); hMcR->Scale(hExpC->Integral() / hMcR->Integral()); hMc->GetYaxis()->SetLabelSize(0.05); hMcSiPM->GetYaxis()->SetLabelSize(0.05); hMcPMT->GetYaxis()->SetLabelSize(0.05); hMcR->GetYaxis()->SetLabelSize(0.05); hMcR->SetLineColor(kRed); hMcHits->GetYaxis()->SetLabelSize(0.05); hMcHits->SetLineColor(kRed); hMcHits->SetMarkerColor(kRed); hMcHits->SetMarkerStyle(kFullCircle); hXY->GetXaxis()->SetLabelSize(0.045); hXY->GetYaxis()->SetLabelSize(0.045); hXY->GetZaxis()->SetLabelSize(0.045); hExpC->GetYaxis()->SetLabelSize(0.05); hExpC->SetLineWidth(2); hExpC->SetLineColor(kBlue); hExpSiPMC->GetYaxis()->SetLabelSize(0.05); hExpPMTC->GetYaxis()->SetLabelSize(0.05); hHitsC->GetYaxis()->SetLabelSize(0.05); hHitsC->SetLineColor(kBlue); hHitsC->SetMarkerColor(kBlue); hHitsC->SetMarkerStyle(kFullSquare); hMcHits->SetStats(0); hHitsC->SetStats(0); TLegend *lg = new TLegend(0.65, 0.8, 0.95, 0.93); lg->AddEntry(hMcHits, "Monte Carlo", "L"); lg->AddEntry(hHitsC, "DANSS", "LP"); lg->SetTextSize(0.035); TCanvas *cMc = new TCanvas("cMc", "Monte Carlo", 1200, 800); cMc->Divide(2, 2); cMc->cd(1); hMc->Fit("gaus", "", "", 1.5, 3.5); cMc->cd(2); hMcSiPM->Fit("gaus", "", "", 1.5, 3.5); cMc->cd(3); hMcPMT->Fit("gaus", "", "", 1.5, 3.5); cMc->cd(4); hMcR->Fit("gaus", "", "", 1.5, 3.5); sprintf(str, "%s.pdf(", fname); cMc->SaveAs(str); TCanvas *cExp = new TCanvas("cExp", "Data", 1200, 800); cExp->Divide(2, 2); cExp->cd(1); hExpC->Fit("gaus", "", "", 1.5, 3.5); cExp->cd(2); hExpSiPMC->Fit("gaus", "", "", 1.5, 3.5); cExp->cd(3); hExpPMTC->Fit("gaus", "", "", 1.5, 3.5); cExp->cd(4); hXY->Draw("colz"); sprintf(str, "%s.pdf", fname); cExp->SaveAs(str); TCanvas *cHits = new TCanvas("cHits", "Hits", 1200, 800); cHits->Divide(2, 1); cHits->cd(1); hHitsC->Draw(); hMcHits->Draw("same,hist"); lg->Draw(); cHits->cd(2); hExpC->Draw(); hMcR->Draw("same,hist"); cHits->Update(); sprintf(str, "%s.pdf)", fname); cHits->SaveAs(str); sprintf(str, "%s.root", fname); TFile *f = new TFile(str, "RECREATE"); if (f->IsOpen()) { f->cd(); hMc->Write(); hMcSiPM->Write(); hMcPMT->Write(); hMcR->Write(); hMcHits->Write(); hXY->Write(); hExpA->Write(); hExpB->Write(); hExpC->Write(); hExpSiPMA->Write(); hExpSiPMB->Write(); hExpSiPMC->Write(); hExpPMTA->Write(); hExpPMTB->Write(); hExpPMTC->Write(); hHitsA->Write(); hHitsB->Write(); hHitsC->Write(); f->Close(); } TCanvas *cPRL = new TCanvas("PRL", "PRL", 800, 800); cPRL->SetLeftMargin(0.17); cPRL->SetRightMargin(0.03); cPRL->SetTopMargin(0.03); cPRL->SetBottomMargin(0.10); hExpC->SetLineColor(kBlack); hExpC->GetXaxis()->SetRange(0, 50); hExpC->SetTitle(";E, MeV;Events/100 keV"); hExpC->SetStats(0); hExpC->GetYaxis()->SetTitleOffset(1.7); hExpC->Draw(); hMcR->Draw("hits,same"); lg->Draw(); sprintf(str, "%s-prl.pdf", fname); cPRL->SaveAs(str); }
void CommandMSUGRA(TString plotName,Int_t tanBeta_, Bool_t plotLO_, Bool_t tb40_plotExpected) { gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gStyle->SetPalette(1); gStyle->SetTextFont(42); gStyle->SetFrameBorderMode(0); //convert tanb value to string std::stringstream tmp; tmp << tanBeta_; TString tanb( tmp.str() ); // Output file std::cout << " create " << plotName << std::endl; TFile* output = new TFile( plotName, "RECREATE" ); if ( !output || output->IsZombie() ) { std::cout << " zombie alarm output is a zombie " << std::endl; } //set old exclusion Limits TGraph* LEP_ch = set_lep_ch(tanBeta_); TGraph* LEP_sl = set_lep_sl(tanBeta_);//slepton curve TGraph* TEV_sg_cdf = set_tev_sg_cdf(tanBeta_);//squark gluino cdf TGraph* TEV_sg_d0 = set_tev_sg_d0(tanBeta_);//squark gluino d0 // TGraph* TEV_tlp_cdf = set_tev_tlp_cdf(tanBeta_);//trilepton cdf // TGraph* TEV_tlp_d0 = set_tev_tlp_d0(tanBeta_);//trilepton d0 TGraph* stau = set_tev_stau(tanBeta_);//stau TGraph* NoEWSB = set_NoEWSB(tanBeta_); TGraph* TEV_sn_d0_1 = set_sneutrino_d0_1(tanBeta_); TGraph* TEV_sn_d0_2 = set_sneutrino_d0_2(tanBeta_); //some tan beta 40 stuff (load the squark and gluino mass lines) TGraph2D* squarkMasses=0; TGraph2D* gluinoMasses=0; if (tanBeta_==40) { const int nPoints = nSusyGridPoints(); double m0[nPoints],m12[nPoints],squarkMass[nPoints],gluinoMass[nPoints]; susyGrid(m0,m12,squarkMass,gluinoMass); squarkMasses = new TGraph2D("squarkMasses","",nPoints,m0,m12,squarkMass); gluinoMasses = new TGraph2D("gluinoMasses","",nPoints,m0,m12,gluinoMass); gluinoMasses->GetHistogram(); squarkMasses->GetHistogram(); } // end of tan beta 40 stuff //constant squark and gluino lines TF1* lnsq[10]; TF1* lngl[10]; TLatex* sq_text[10]; TLatex* gl_text[10]; //versions for tan beta 40 TGraph* lnsq_40[15]; TGraph* lngl_40[15]; TLatex* sq_40_text[15]; TLatex* gl_40_text[15]; int loopmax = 6; if (tanBeta_==40) loopmax=15; for(int i = 0; i < loopmax; i++){ if (tanBeta_==10) { lnsq[i] = constant_squark(tanBeta_,i); sq_text[i] = constant_squark_text(i,*lnsq[i],tanBeta_); lngl[i] = constant_gluino(tanBeta_,i); gl_text[i] = constant_gluino_text(i,*lngl[i]); } else if (tanBeta_==40) { lnsq_40[i] = constant_mass(i*250,squarkMasses); lngl_40[i] = constant_mass(i*250,gluinoMasses); sq_40_text[i] = constant_squark_text_tanBeta40(i*250,lnsq_40[i]); gl_40_text[i] = constant_gluino_text_tanBeta40(i*250,lngl_40[i]);; } } //Legends TLegend* legst = makeStauLegend(0.05,tanBeta_); // TLegend* legNoEWSB = makeNoEWSBLegend(0.05,tanBeta_); TLegend* legexp = makeExpLegend( *TEV_sg_cdf,*TEV_sg_d0,*LEP_ch,*LEP_sl,*TEV_sn_d0_1,0.035,tanBeta_); //make Canvas TCanvas* cvsSys = new TCanvas("cvsnm","cvsnm",0,0,800,600); gStyle->SetOptTitle(0); cvsSys->SetFillColor(0); cvsSys->GetPad(0)->SetRightMargin(0.07); cvsSys->Range(-120.5298,26.16437,736.0927,750); // cvsSys->Range(-50.5298,26.16437,736.0927,500); cvsSys->SetFillColor(0); cvsSys->SetBorderMode(0); cvsSys->GetPad(0)->SetBorderMode(0); cvsSys->GetPad(0)->SetBorderSize(2); cvsSys->GetPad(0)->SetLeftMargin(0.1407035); cvsSys->GetPad(0)->SetTopMargin(0.08); cvsSys->GetPad(0)->SetBottomMargin(0.13); cvsSys->SetTitle("tan#beta="+tanb); output->cd(); TDirectory* curDir = gDirectory; // TFile* f = new TFile("limits_binc_ht1000_met350-contours.root"); // TFile* f = new TFile("limits_msugraNLO_multibtag_ht1000_met250_m12_0-550_HN_comb-contours.root"); TFile* f = ContourFile; TGraph* ra4VieObs = (TGraph*)f->Get("gObs"); TGraph* ra4VieExpM2 = (TGraph*)f->Get("gExpMinus2"); TGraph* ra4VieExpM1 = (TGraph*)f->Get("gExpMinus1"); TGraph* ra4VieExp = (TGraph*)f->Get("gExpMedian"); TGraph* ra4VieExpP1 = (TGraph*)f->Get("gExpPlus1"); TGraph* ra4VieExpP2 = (TGraph*)f->Get("gExpPlus2"); TGraph* ra4VieExpArea(0); TGraph* ra4VieObsThM(0); TGraph* ra4VieExpThM(0); if ( ContourFileM ) { ra4VieObsThM = (TGraph*)ContourFileM->Get("gObs"); ra4VieExpThM = (TGraph*)ContourFileM->Get("gExpMedian"); } TGraph* ra4VieObsThP(0); TGraph* ra4VieExpThP(0); if ( ContourFileP ) { ra4VieObsThP = (TGraph*)ContourFileP->Get("gObs"); ra4VieExpThP = (TGraph*)ContourFileP->Get("gExpMedian"); } curDir->cd(); double m0min = 0; double m0max=1600; // double m0max=1800; double xscale = m0max-m0min; if (tanBeta_ == 50) m0min=200; if (tanBeta_ == 40) {m0min=400; m0max=2000;} xscale = (m0max-m0min)/xscale; TH2D* hist = new TH2D("h","h",100,m0min,m0max,100,120,700); hist->Draw(); hist->GetXaxis()->SetTitle("m_{0} (GeV/c^{2})"); hist->GetYaxis()->SetTitle("m_{1/2} (GeV/c^{2})"); hist->GetXaxis()->SetTitleOffset(.9); hist->GetXaxis()->SetTitleSize(0.06); hist->GetYaxis()->SetTitleOffset(1.0); hist->GetYaxis()->SetTitleSize(0.06); hist->GetXaxis()->SetNdivisions(506); // if (tanBeta_ == 50) hist->GetXaxis()->SetNdivisions(504); hist->GetYaxis()->SetNdivisions(506); int col[]={2,3,4}; TSpline3 *sRA4_LP =0; TSpline3 *sRA1 = 0; TSpline3 *sRA2 = 0; TSpline3 *sRA4_old =0; TSpline3 *sRAZ =0; if (tanBeta_==10) { ra4VieObs->SetLineWidth(3); ra4VieObs->SetLineColor(2); ra4VieExp->SetLineWidth(3); // ra4VieExp->SetLineStyle(2); ra4VieExp->SetLineColor(4); // ra4VieObs->RemovePoint(0); // ra4VieObs->RemovePoint(0); // double x,y; // ra4VieObs->GetPoint(36,x,y); // std::cout << x << " " << y << std::endl; // ra4VieObs->RemovePoint(37); // ra4VieObs->RemovePoint(37); // ra4VieObs->RemovePoint(37); if ( ra4VieExpM1 && ra4VieExpP1 ) { ra4VieExpArea = new TGraph(); int np(0); double* xExp = ra4VieExpM1->GetX(); double* yExp = ra4VieExpM1->GetY(); for ( int i=0; i<ra4VieExpM1->GetN(); ++i ) ra4VieExpArea->SetPoint(np++,xExp[i],yExp[i]); xExp = ra4VieExpP1->GetX(); yExp = ra4VieExpP1->GetY(); for ( int i=ra4VieExpP1->GetN()-1; i>=0; --i ) ra4VieExpArea->SetPoint(np++,xExp[i],yExp[i]); ra4VieExpArea->SetLineColor(7); ra4VieExpArea->SetFillColor(7); ra4VieExpArea->Draw("F"); ra4VieExpM1->SetLineWidth(1); ra4VieExpM1->SetLineStyle(3); ra4VieExpM1->SetLineColor(4); ra4VieExpP1->SetLineWidth(1); ra4VieExpP1->SetLineStyle(3); ra4VieExpP1->SetLineColor(4); ra4VieExpM1->Draw(); ra4VieExpP1->Draw(); } if ( ra4VieObsThM && ra4VieObsThP ) { ra4VieObsThM->SetLineWidth(2); ra4VieObsThM->SetLineColor(2); ra4VieObsThM->SetLineStyle(2); ra4VieObsThM->Draw(); ra4VieObsThP->SetLineWidth(2); ra4VieObsThP->SetLineColor(2); ra4VieObsThP->SetLineStyle(2); ra4VieObsThP->Draw(); ra4VieExpThM->SetLineWidth(2); ra4VieExpThM->SetLineColor(4); ra4VieExpThM->SetLineStyle(2); ra4VieExpThM->Draw(); ra4VieExpThP->SetLineWidth(2); ra4VieExpThP->SetLineColor(4); ra4VieExpThP->SetLineStyle(2); ra4VieExpThP->Draw(); } ra4VieExp->Draw(); ra4VieObs->Draw(); // if ( ra4VieExpM2 && ra4VieExpP2 ) { // ra4VieExpM2->SetLineWidth(2); // ra4VieExpM2->SetLineStyle(3); // ra4VieExpM2->SetLineColor(4); // ra4VieExpP2->SetLineWidth(2); // ra4VieExpP2->SetLineStyle(3); // ra4VieExpP2->SetLineColor(4); // ra4VieExpM2->Draw(); // ra4VieExpP2->Draw(); // } } else if (tanBeta_==40 ) { } TLegend* myleg; float leg_x1=0.39+0.23; float leg_y1=0.65+0.05; float leg_x2= 0.55+0.25; float leg_y2= 0.84+0.05; if( plotLO_ ) { if ( ContourFileM && ContourFileP ) myleg = new TLegend(0.3,0.55,0.6,0.7,NULL,"brNDC"); // myleg = new TLegend(0.3,0.55,0.6,0.8,NULL,"brNDC"); else myleg = new TLegend(0.3,0.65,0.6,0.7,NULL,"brNDC"); } else if (tb40_plotExpected) myleg = new TLegend(0.25,0.76,0.44,0.91,NULL,"brNDC"); // copied from else block below else if (tanBeta_==40) myleg = new TLegend(leg_x1,leg_y1,leg_x2,leg_y2,NULL,"brNDC"); else myleg = new TLegend(0.25,0.76,0.44,0.91,NULL,"brNDC"); myleg->SetFillColor(0); myleg->SetShadowColor(0); myleg->SetTextSize(0.03); myleg->SetBorderSize(0); TLegendEntry *entry=0; if (tanBeta_ == 10 ) { // myleg->SetHeader("RA4Tmpl, (NLO, exp. unc.)"); myleg->SetHeader("95% CL exclusion limits"); myleg->AddEntry(ra4VieObs,"observed","l"); myleg->AddEntry(ra4VieExp,"median expected","l"); if ( ra4VieExpM1 && ra4VieExpP1 ) { // myleg->AddEntry(ra4VieExpP1,"exp #pm 1#sigma","l"); myleg->AddEntry(ra4VieExpArea,"expected #pm 1#sigma exp.","f"); } if ( ra4VieObsThM && ra4VieObsThP ) { myleg->AddEntry(ra4VieObsThM,"observed / sig.cont.","l"); myleg->AddEntry(ra4VieExpThM,"expected / sig.cont.","l"); // myleg->AddEntry(ra4VieObsThM,"observed #pm 1#sigma theor.","l"); // myleg->AddEntry(ra4VieExpThM,"expected #pm 1#sigma theor.","l"); } // entry=myleg->AddEntry("RA1","2011 Limits","l"); // entry->SetLineColor(1); // entry->SetLineStyle(1); // entry->SetLineWidth(3); // entry=myleg->AddEntry("sRA1","2010 Limits","l"); // entry->SetLineColor(1); // entry->SetLineStyle(2); // entry->SetLineWidth(3); } else if (tanBeta_==40) { // entry=myleg->AddEntry("obs","Observed Limit","l"); // entry->SetLineColor(1); // entry->SetLineStyle(1); // entry->SetLineWidth(3); // entry->SetTextColor(1); // entry=myleg->AddEntry("exp","Expected Limit #pm 1#sigma","lf"); // entry->SetFillColor(kGray); // entry->SetTextColor(1); // entry->SetLineColor(1); // entry->SetLineStyle(7); // entry->SetLineWidth(3); // entry->SetFillStyle(3002); } //constant squark and gluino mass contours if (tanBeta_==10) { for (int it=0;it<5;it++) { lngl[it]->Draw("same"); lnsq[it]->Draw("same"); sq_text[it]->Draw(); gl_text[it]->Draw(); } } else if (tanBeta_==40) { for (int it=2;it<9;it++) { if(it<7){ if(lngl_40[it]!=0)lngl_40[it]->Draw("samec"); if(gl_40_text[it]!=0)gl_40_text[it]->Draw(); } if(lnsq_40[it]!=0)lnsq_40[it]->Draw("samec"); if(it<6){ if(sq_40_text[it]!=0)sq_40_text[it]->Draw(); } } } if (tanBeta_==10) { // SSdilep->Draw("samec"); // OSdilep->Draw("samec"); // Multilep->Draw("samec"); // RA1->Draw("samec"); // RA2->Draw("samec"); // MT2->Draw("samec"); // sRA4_LP->Draw("samec"); // RAZ->Draw("samec"); // sRA1->Draw("same"); // sRA2->Draw("same"); // sRA4_old->Draw("samec"); // sRAZ->Draw("samec"); // RA5_old->Draw("c same"); // RA6_old->Draw("c same"); } else if (tanBeta_==40) { // //expected curves and errors bands // if ( tb40_plotExpected) { // //not drawing the expected curves for better legibility // // RA1_tb40_exp_p->Draw("samel"); // // RA1_tb40_exp_m->Draw("samel"); // // RA2b_1b_tight_exp_p->Draw("samel"); // // RA2b_1b_tight_exp_m->Draw("samel"); // //keep the expected +/-1 sigma band // RA1_tb40_exp_band->Draw("f") ; // RA2b_1b_tight_exp_band->Draw("f") ; // //important to draw lines after fill // RA1_tb40_exp->Draw("samel"); // RA2b_1b_tight_exp->Draw("samel") ; } // RA2b_1b_tight->Draw("samel"); // RA1_tb40->Draw("samel"); // } TLegend* leg2=0; if (tanBeta_==10) { // TLatex* RA1label = new TLatex(670,370.,"#alpha_{T}"); // RA1label->SetTextFont(42); // RA1label->SetTextSize(0.05); // RA1label->SetTextColor(kRed+2); // RA1label->Draw("same"); // TLatex* RA2label = new TLatex(640,465.,"Jets+MHT"); // RA2label->SetTextFont(42); // RA2label->SetTextSize(0.04); // RA2label->SetTextColor(kBlue+2); // RA2label->Draw("same"); // TLatex* RAZlabel = new TLatex(740,415.,"Razor (0.8 fb^{-1})"); // RAZlabel->SetTextFont(42); // RAZlabel->SetTextSize(0.04); // RAZlabel->SetTextColor(kMagenta+1); // RAZlabel->Draw("same"); // TLatex* RA5label = new TLatex(300,350.,"SS Dilepton"); // RA5label->SetTextFont(42); // //RA5label->SetTextAngle(-10); // RA5label->SetTextSize(0.04); // RA5label->SetTextColor(kGreen+2); // RA5label->Draw("same"); // //TLatex* RA6label = new TLatex(400,280.,"OS Dilepton"); // TLatex* RA6label = new TLatex(355,285.,"OS Dilepton"); // RA6label->SetTextFont(42); // //RA6label->SetTextAngle(-15); // RA6label->SetTextSize(0.04); // RA6label->SetTextColor(kCyan+2); // RA6label->Draw("same"); // TLatex* RA7label = new TLatex(338,215.,"Multi-Lepton"); // RA7label->SetTextFont(42); // RA7label->SetTextSize(0.04); // RA7label->SetTextColor(kYellow+2); // RA7label->Draw("same"); // TLatex* RA7lumi = new TLatex(450,185.,"(2.1 fb^{-1})"); // RA7lumi->SetTextFont(42); // RA7lumi->SetTextSize(0.04); // RA7lumi->SetTextColor(kYellow+2); // RA7lumi->Draw("same"); // TLatex* MT2label = new TLatex(400,440.,"MT2"); // MT2label->SetTextFont(42); // MT2label->SetTextSize(0.04); // MT2label->SetTextColor(kRed); // MT2label->Draw("same"); // TLatex* RA4label = new TLatex(250,400.,"1 Lepton"); // RA4label->SetTextFont(42); // RA4label->SetTextSize(0.04); // RA4label->SetTextColor(kBlue); // RA4label->Draw("same"); } else if (tanBeta_==40 && !tb40_plotExpected) { // int xposRA1 = 480; // int yposRA1 = 510; // int xposRA2b=450; // int yposRA2b=275; // TLatex* RA1label = new TLatex(xposRA1,yposRA1,"#alpha_{T}"); // RA1label->SetTextFont(42); // RA1label->SetTextSize(0.05); // RA1label->SetTextColor(kRed+2); // RA1label->Draw("same"); // TLatex* RA2blabel = new TLatex(xposRA2b,yposRA2b,"Jets+MET+b"); // RA2blabel->SetTextFont(42); // RA2blabel->SetTextSize(0.05); // RA2blabel->SetTextColor(kBlue+1); // RA2blabel->Draw("same"); // } // else if (tanBeta_==40 && tb40_plotExpected) { // leg2 = new TLegend(0.63,0.76,0.94,0.91,NULL,"brNDC"); // leg2->SetFillColor(0); // leg2->SetShadowColor(0); // leg2->SetTextSize(0.04); // leg2->SetBorderSize(0); // entry=leg2->AddEntry("RA1_tb40","#alpha_{T}","l"); // entry->SetLineColor(kRed+2); // entry->SetLineStyle(1); // entry->SetLineWidth(3); // entry->SetTextColor(kRed+2); // entry=leg2->AddEntry("RA2b_1btight","Jets+MET+b","l"); // entry->SetLineColor(kBlue+1); // entry->SetLineStyle(1); // entry->SetLineWidth(3); // entry->SetTextColor(kBlue+1); } //exclusion limits previous experiments if(tanBeta_ == 3){ TEV_sn_d0_1->Draw("fsame"); TEV_sn_d0_2->Draw("fsame"); } if (tanBeta_==10) LEP_ch->Draw("fsame"); if (tanBeta_ != 50 && tanBeta_!=40) LEP_sl->Draw("fsame"); // //remove CDF/D0 excluded regions // if (tanBeta_==10) { // TEV_sg_cdf->Draw("fsame"); // TEV_sg_d0->Draw("same"); // TEV_sg_d0->Draw("fsame"); // } //other labels Double_t xpos = 0; Double_t xposi = 0; Double_t ypos = 0; if(tanBeta_ == 50) xposi = 100; if(tanBeta_ == 50) xpos = 200; if(tanBeta_ == 50) ypos = -10; if(tanBeta_ == 40) xposi = 180+160; if(tanBeta_ == 40) xpos = 400;//240; if(tanBeta_ == 40) ypos = 100; //TLatex* lumilabel = new TLatex(750 +xposi + 100,767.-154,"#sqrt{s} = 7 TeV, #scale[0.65]{#int}Ldt = 0.98 fb^{-1}"); TLatex* lumilabel = new TLatex(450*xscale+xpos,767.-154+100,"#sqrt{s} = 7 TeV, Ldt 4.98 fb^{ -1}"); TLatex* integral_symbol = new TLatex((577+100)*xscale+xpos,767.-145+100,"#int"); lumilabel->SetTextSize(0.03); integral_symbol->SetTextSize(0.015); lumilabel->Draw("same"); integral_symbol->Draw("same"); TLatex* cmslabel = new TLatex(10.+xpos,767.-154+100,"CMS Preliminary"); cmslabel->SetTextSize(0.03); cmslabel->Draw("same"); TString text_tanBeta; TString a0str="0"; if (tanBeta_==40) a0str = "-500 GeV"; text_tanBeta = "tan#beta = "+tanb+", A_{0} = "+a0str+", #mu > 0"; int anotherOffset = (tb40_plotExpected && tanBeta_==40) ? -100 : 0; // TLatex* cmssmpars = new TLatex(/*530.+xpos,690.+ypos-130*/120+xpos,555+ypos+anotherOffset,text_tanBeta); // TLatex* cmssmpars = new TLatex(0.61,0.60,text_tanBeta); TLatex* cmssmpars = new TLatex(0.61,0.70,text_tanBeta); cmssmpars->SetNDC(1); cmssmpars->SetTextSize(0.04); cmssmpars->Draw("same"); TLatex* lep_chargino = new TLatex(250,135,"LEP2 #tilde{#chi}_{1}^{#pm}"); lep_chargino->SetTextSize(0.03); lep_chargino->SetTextFont(42); // lep_chargino->Draw("same"); TLatex* lep_slepton = new TLatex(26,190,"LEP2 #tilde{#font[12]{l}}^{#pm}"); lep_slepton->SetTextSize(0.03); lep_slepton->SetTextAngle(-83); lep_slepton->SetTextFont(42); // lep_slepton->Draw("same"); //LM points TMarker* LM0 = new TMarker(200.,160.,20); TMarker* LM1 = new TMarker(60.,250.,20); TMarker* LM3 = new TMarker(330.,240.,20); TMarker* LM6 = new TMarker(80.,400.,20); LM0->SetMarkerSize(1.2); LM1->SetMarkerSize(1.2); TLatex* tLM0 = new TLatex(205.,160.," LM0"); tLM0->SetTextSize(0.035); TLatex* tLM1 = new TLatex(80.,245.,"LM1"); tLM1->SetTextSize(0.035); //TLatex* tLM3 = new TLatex(350.,235.,"LM3 (tan#beta=20)"); TLatex* tLM3 = new TLatex(350.,235.,"LM3"); tLM3->SetTextSize(0.035); TLatex* tLM6 = new TLatex(100.,395.,"LM6"); tLM6->SetTextSize(0.035); // if (tanBeta_ != 50){ // LM0->Draw("same"); // tLM0->Draw("same"); // LM1->Draw("same"); // tLM1->Draw("same"); // } /* if (tanBeta_ == 10){ LM1->Draw("same"); tLM1->Draw("same"); LM3->Draw("same"); tLM3->Draw("same"); LM6->Draw("same"); tLM6->Draw("same"); } */ //stau=LSP contour if (tanBeta_==10) { stau->Draw("fsame"); // NoEWSB->Draw("fsame"); //legends legexp->Draw(); legst->Draw(); //legNoEWSB->Draw(); } if (tanBeta_!=40 || tb40_plotExpected) myleg->Draw(); if (tanBeta_==40 && tb40_plotExpected) leg2->Draw(); hist->Draw("sameaxis"); cvsSys->RedrawAxis(); cvsSys->Update(); cvsSys->Write(); if( plotLO_ ){ cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_LO.pdf"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+"_LO.png"); }else{ cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+".eps"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+".ps"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+".pdf"); cvsSys->SaveAs("ExclusionLimit_tanb"+tanb+".png"); } output->Write(); //output->Close(); //delete output; }
void draw_survey() { TFile * infile = new TFile("geotr.root","READ"); TTree * tr = (TTree*) infile->Get("geotr"); Int_t nstb,row,col; tr->SetBranchAddress("nstb",&nstb); tr->SetBranchAddress("row",&row); tr->SetBranchAddress("col",&col); const Double_t large_width = 58.0; // large cell width const Double_t small_width = 38.0; // small cell width Double_t x,y,z,x1,y1,x2,y2; Int_t it=0; Int_t color; TLine * cell[4][1264]; for(Int_t i=0; i<tr->GetEntries(); i++) { tr->GetEntry(i); switch(nstb) { case 1: x = -24.0 - 25.0 - 58.6 * col; y = 965.5 - 58.5 * row; z = 7208; color = (Int_t) kMagenta; break; case 2: x = -24.0 - 8.0 + 66.6 + 58.4 * col; //new position May 5 2015 y = 965.1 - 58.6 * row; z = 7188; color = (Int_t) kRed; break; case 3: if(row>16.5) { x = -22.0 - 17.7 - 38.2 * col; y = 422.7 - 37.9 * row; z = 7208; color = (Int_t) kBlue; } else { x = -22.0 - 17.7 - 38.2 * col; y = 4.75 + 438.9 - 39.0 * row; z = 7204; color = (Int_t) kCyan; }; break; case 4: x = -22.0 - 8.0 + 60. + 38.4 * col; // new position May 5 2015 y = 444. - 38.7 * row; z = 7188; color = (Int_t) kGreen+2; break; }; if(nstb<=2) { x1 = x - large_width/2.0; x2 = x + large_width/2.0; y1 = y - large_width/2.0; y2 = y + large_width/2.0; } else { x1 = x - small_width/2.0; x2 = x + small_width/2.0; y1 = y - small_width/2.0; y2 = y + small_width/2.0; }; cell[0][it] = new TLine(x1,y1,x2,y1); //t cell[1][it] = new TLine(x1,y2,x2,y2); //b cell[2][it] = new TLine(x1,y1,x1,y2); //l cell[3][it] = new TLine(x2,y1,x2,y2); //r for(Int_t j=0; j<4; j++) cell[j][it]->SetLineColor(color); it++; }; Double_t md = 1200; Int_t factor = 1; // bins per millimeter... set this too high and you'll get a memory leak! factor *= 2; TH2D * bg = new TH2D("survey","FMS cells survey [mm]",factor*md,-1*md,md,factor*md,-1*md,md); TCanvas * survey = new TCanvas("survey","survey",700,700); gStyle->SetOptStat(0); bg->Draw(); for(Int_t i=0; i<1264; i++) for(Int_t j=0; j<4; j++) cell[j][i]->Draw(); };
void createWorkspace(const std::string &infilename, int nState, bool correctCtau, bool drawRapPt2D, bool drawPtCPM2D){ gROOT->SetStyle("Plain"); gStyle->SetTitleBorderSize(0); // Set some strings const std::string workspacename = "ws_masslifetime", treename = "selectedData"; // Get the tree from the data file TFile *f = TFile::Open(infilename.c_str()); TTree *tree = (TTree*)f->Get(treename.c_str()); // Set branch addresses in tree to be able to import tree to roofit TLorentzVector* jpsi = new TLorentzVector; tree->SetBranchAddress("JpsiP",&jpsi); double CPMval = 0; tree->SetBranchAddress("CPM",&CPMval); double massErr = 0; tree->SetBranchAddress("JpsiMassErr",&massErr); double Vprob = 0; tree->SetBranchAddress("JpsiVprob",&Vprob); double lifetime = 0; tree->SetBranchAddress("Jpsict",&lifetime); double lifetimeErr = 0; tree->SetBranchAddress("JpsictErr",&lifetimeErr); // define variables necessary for J/Psi(Psi(2S)) mass,lifetime fit RooRealVar* JpsiMass = new RooRealVar("JpsiMass", "M [GeV]", onia::massMin, onia::massMax); RooRealVar* JpsiMassErr = new RooRealVar("JpsiMassErr", "#delta M [GeV]", 0, 5); RooRealVar* JpsiRap = new RooRealVar("JpsiRap", "y", -onia::rap, onia::rap); RooRealVar* JpsiPt = new RooRealVar("JpsiPt", "p_{T} [GeV]", 0. ,100.); RooRealVar* JpsiCPM = new RooRealVar("JpsiCPM", "N_{ch}", 0. ,100.); RooRealVar* Jpsict = new RooRealVar("Jpsict", "lifetime [mm]", -1., 2.5); RooRealVar* JpsictErr = new RooRealVar("JpsictErr", "Error on lifetime [mm]", 0.0001, 1); RooRealVar* JpsiVprob = new RooRealVar("JpsiVprob", "", 0.01, 1.); // Set bins Jpsict->setBins(10000,"cache"); Jpsict->setBins(100); JpsiMass->setBins(100); JpsictErr->setBins(100); // The list of data variables RooArgList dataVars(*JpsiMass,*JpsiMassErr,*JpsiRap,*JpsiPt,*JpsiCPM,*Jpsict,*JpsictErr,*JpsiVprob); // construct dataset to contain events RooDataSet* fullData = new RooDataSet("fullData","The Full Data From the Input ROOT Trees",dataVars); int entries = tree->GetEntries(); cout << "entries " << entries << endl; // loop through events in tree and save them to dataset for (int ientries = 0; ientries < entries; ientries++) { if (ientries%100000==0) std::cout << "event " << ientries << " of " << entries << std::endl; tree->GetEntry(ientries); double M =jpsi->M(); double y=jpsi->Rapidity(); double pt=jpsi->Pt(); double cpm=CPMval; if (M > JpsiMass->getMin() && M < JpsiMass->getMax() && massErr > JpsiMassErr->getMin() && massErr < JpsiMassErr->getMax() && pt > JpsiPt->getMin() && pt < JpsiPt->getMax() && cpm > JpsiCPM->getMin() && cpm < JpsiCPM->getMax() && y > JpsiRap->getMin() && y < JpsiRap->getMax() && lifetime > Jpsict->getMin() && lifetime < Jpsict->getMax() && lifetimeErr > JpsictErr->getMin() && lifetimeErr < JpsictErr->getMax() && Vprob > JpsiVprob->getMin() && Vprob < JpsiVprob->getMax() ){ JpsiPt ->setVal(pt); JpsiCPM ->setVal(cpm); JpsiRap ->setVal(y); JpsiMass ->setVal(M); JpsiMassErr ->setVal(massErr); JpsiVprob ->setVal(Vprob); //cout<<"before lifetime correction \n" // <<"Jpsict: "<<lifetime<<" JpsictErr: "<<lifetimeErr<<endl; if(correctCtau){ lifetime = lifetime * onia::MpsiPDG / M ; lifetimeErr = lifetimeErr * onia::MpsiPDG / M ; Jpsict ->setVal(lifetime); JpsictErr ->setVal(lifetimeErr); //cout<<"MpsiPDG: "<<onia::MpsiPDG<<endl; //cout<<"after lifetime correction \n" // <<"Jpsict: "<<lifetime<<" JpsictErr: "<<lifetimeErr<<endl; } else{ Jpsict ->setVal(lifetime); JpsictErr ->setVal(lifetimeErr); } fullData->add(dataVars); } }//ientries //------------------------------------------------------------------------------------------------------------------ // Define workspace and import datasets ////Get datasets binned in pT, cpm, and y for(int iRap = 1; iRap <= onia::kNbRapForPTBins; iRap++){ Double_t yMin; Double_t yMax; if(iRap==0){ yMin = onia::rapForPTRange[0]; yMax = onia::rapForPTRange[onia::kNbRapForPTBins]; } else{ yMin = onia::rapForPTRange[iRap-1]; yMax = onia::rapForPTRange[iRap]; } for(int iPT = 1; iPT <= onia::kNbPTBins[iRap]; iPT++){ //for(int iPT = 0; iPT <= 0; iPT++) Double_t ptMin; Double_t ptMax; if(iPT==0){ ptMin = onia::pTRange[iRap][0]; ptMax = onia::pTRange[iRap][onia::kNbPTBins[0]]; } else{ ptMin = onia::pTRange[iRap][iPT-1]; ptMax = onia::pTRange[iRap][iPT]; } for(int iCPM = 1; iCPM <= onia::NchBins; iCPM++){ Double_t cpmMin; Double_t cpmMax; if(iCPM==0){ cpmMin = onia::cpmRange[0]; cpmMax = onia::cpmRange[onia::NchBins]; } else{ cpmMin = onia::cpmRange[iCPM-1]; cpmMax = onia::cpmRange[iCPM]; } // output file name and workspace std::stringstream outfilename; outfilename << "tmpFiles/backupWorkSpace/fit_Psi" << nState-3 << "S_rap" << iRap << "_pt" << iPT << "_cpm" << iCPM << ".root"; // outfilename << "tmpFiles/fit_Psi" << nState-3 << "S_rap" << iRap << "_pt" << iPT << ".root"; RooWorkspace* ws = new RooWorkspace(workspacename.c_str()); // define pt and y cuts on dataset std::stringstream cutString; cutString << "(JpsiCPM > " << cpmMin << " && JpsiCPM < "<< cpmMax << ") && " << "(JpsiPt >= " << ptMin << " && JpsiPt < "<< ptMax << ") && " << "(TMath::Abs(JpsiRap) >= " << yMin << " && TMath::Abs(JpsiRap) < " << yMax << ")"; cout << "cutString: " << cutString.str().c_str() << endl; // get the dataset for the fit RooDataSet* binData = (RooDataSet*)fullData->reduce(cutString.str().c_str()); std::stringstream name; name << "data_rap" << iRap << "_pt" << iPT << "_cpm" << iCPM;; binData->SetNameTitle(name.str().c_str(), "Data For Fitting"); // Import variables to workspace ws->import(*binData); ws->writeToFile(outfilename.str().c_str()); }//iCPM }//iPT }//iRap ////--------------------------------------------------------------- ////--Integrating rapidity and pt bins, in +/- 3*sigma mass window ////--------------------------------------------------------------- if(drawRapPt2D){ double yMin = onia::rapForPTRange[0]; double yMax = onia::rapForPTRange[onia::kNbRapForPTBins]; double ptMin = onia::pTRange[0][0]; double ptMax = onia::pTRange[0][onia::kNbPTBins[0]]; double cpmMin = onia::cpmRange[0]; double cpmMax = onia::cpmRange[onia::NchBins]; std::stringstream cutRapPt; cutRapPt << "(JpsiCPM > " << cpmMin << " && JpsiCPM < "<< cpmMax << ") && " << "(JpsiPt > " << ptMin << " && JpsiPt < "<< ptMax << ") && " << "(TMath::Abs(JpsiRap) > " << yMin << " && TMath::Abs(JpsiRap) < " << yMax << ")"; cout<<"cutRapPt: "<<cutRapPt.str().c_str()<<endl; RooDataSet* rapPtData = (RooDataSet*)fullData->reduce(cutRapPt.str().c_str()); std::stringstream nameRapPt; nameRapPt << "data_rap0_pt0_cpm0"; rapPtData->SetNameTitle(nameRapPt.str().c_str(), "Data For full rap and pt"); // output file name and workspace std::stringstream outfilename; outfilename << "tmpFiles/backupWorkSpace/fit_Psi" << nState-3 << "S_rap0_pt0_cpm0.root"; RooWorkspace* ws_RapPt = new RooWorkspace(workspacename.c_str()); //Import variables to workspace ws_RapPt->import(*rapPtData); ws_RapPt->writeToFile(outfilename.str().c_str()); TH2D* rapPt; TH1D* rap1p2; double MassMin; double MassMax; rap1p2 = new TH1D("rap1p2","rap1p2",30,0, 1.8); if(nState==4){ rapPt = new TH2D( "rapPt", "rapPt", 52,-1.3,1.3,144,0,72); MassMin=3.011;//massPsi1S-onia::nSigMass*sigma1S; MassMax=3.174;//massPsi1S+onia::nSigMass*sigma1S; // sigma 27.2 MeV // mean 3.093 GeV } if(nState==5){ rapPt = new TH2D( "rapPt", "rapPt", 64,-1.6,1.6,144,0,72); // rap<1.5 //rapPt = new TH2D( "rapPt", "rapPt", 52,-1.3,1.3,144,0,72); // rap<1.2 MassMin=3.576;//massPsi2S-onia::nSigMass*sigma2S; MassMax=3.786;//massPsi2S+onia::nSigMass*sigma2S; // sigma 34.9 MeV // pT > 7 // sigma 34.3 MeV // pT > 10 // mean 3.681 GeV } cout<<"Plotting rap-Pt for Psi"<<nState-3<<"S"<<endl; cout<<"MassMin for rap-Pt plot = "<<MassMin<<endl; cout<<"MassMax for rap-Pt plot = "<<MassMax<<endl; TTree *rapPtTree = (TTree*)rapPtData->tree(); std::stringstream cutMass; cutMass<<"(JpsiMass > " << MassMin << " && JpsiMass < "<< MassMax << ")"; //following two methods can only be used in root_v30, 34 does not work rapPtTree->Draw("JpsiPt:JpsiRap>>rapPt",cutMass.str().c_str(),"colz"); cout<<"debug"<<endl; rapPtTree->Draw("TMath::Abs(JpsiRap)>>rap1p2",cutMass.str().c_str()); TCanvas* c2 = new TCanvas("c2","c2",1200,1500); rapPt->SetYTitle("p_{T}(#mu#mu) [GeV]"); rapPt->SetXTitle("y(#mu#mu)"); gStyle->SetPalette(1); gPad->SetFillColor(kWhite); rapPt->SetTitle(0); rapPt->SetStats(0); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.17); rapPt->GetYaxis()->SetTitleOffset(1.5); rapPt->Draw("colz"); TLine* rapPtLine; for(int iRap=0;iRap<onia::kNbRapForPTBins+1;iRap++){ rapPtLine= new TLine( -onia::rapForPTRange[iRap], onia::pTRange[0][0], -onia::rapForPTRange[iRap], onia::pTRange[0][onia::kNbPTBins[iRap]] ); rapPtLine->SetLineWidth( 2 ); rapPtLine->SetLineStyle( 1 ); rapPtLine->SetLineColor( kWhite ); rapPtLine->Draw(); rapPtLine= new TLine( onia::rapForPTRange[iRap], onia::pTRange[0][0], onia::rapForPTRange[iRap], onia::pTRange[0][onia::kNbPTBins[iRap]] ); rapPtLine->SetLineWidth( 2 ); rapPtLine->SetLineStyle( 1 ); rapPtLine->SetLineColor( kWhite ); rapPtLine->Draw(); int pTBegin = 0; if(nState==5) pTBegin = 1; for(int iPt=pTBegin;iPt<onia::kNbPTBins[iRap]+1;iPt++){ rapPtLine= new TLine( -onia::rapForPTRange[onia::kNbRapForPTBins], onia::pTRange[0][iPt], onia::rapForPTRange[onia::kNbRapForPTBins], onia::pTRange[0][iPt] ); rapPtLine->SetLineWidth( 2 ); rapPtLine->SetLineStyle( 1 ); rapPtLine->SetLineColor( kWhite ); rapPtLine->Draw(); } } char savename[200]; sprintf(savename,"Fit/rapPt_Psi%dS.pdf",nState-3); c2->SaveAs(savename); TCanvas* c3 = new TCanvas("c3","c3",1500,1200); rap1p2->SetYTitle("Events"); rap1p2->SetXTitle("y(#mu#mu)"); rap1p2->SetTitle(0); rap1p2->SetStats(0); rap1p2->GetYaxis()->SetTitleOffset(1.2); rap1p2->Draw(); sprintf(savename,"Fit/rapDimuon_1p2_Psi%dS.pdf",nState-3); c3->SaveAs(savename); } if(drawPtCPM2D){ double yMin = onia::rapForPTRange[0]; double yMax = onia::rapForPTRange[onia::kNbRapForPTBins]; double ptMin = onia::pTRange[0][0]; double ptMax = onia::pTRange[0][onia::kNbPTBins[0]]; double cpmMin = onia::cpmRange[0]; double cpmMax = onia::cpmRange[onia::NchBins]; std::stringstream cutRapPt; cutRapPt << "(JpsiCPM > " << cpmMin << " && JpsiCPM < "<< cpmMax << ") && " << "(JpsiPt > " << ptMin << " && JpsiPt < "<< ptMax << ") && " << "(TMath::Abs(JpsiRap) > " << yMin << " && TMath::Abs(JpsiRap) < " << yMax << ")"; cout<<"cutRapPt: "<<cutRapPt.str().c_str()<<endl; RooDataSet* rapPtData = (RooDataSet*)fullData->reduce(cutRapPt.str().c_str()); std::stringstream nameRapPt; nameRapPt << "data_rap0_pt0_cpm0"; rapPtData->SetNameTitle(nameRapPt.str().c_str(), "Data For full rap and pt"); // output file name and workspace std::stringstream outfilename; outfilename << "tmpFiles/backupWorkSpace/fit_Psi" << nState-3 << "S_rap0_pt0_cpm0.root"; RooWorkspace* ws_RapPt = new RooWorkspace(workspacename.c_str()); //Import variables to workspace ws_RapPt->import(*rapPtData); ws_RapPt->writeToFile(outfilename.str().c_str()); TH2D* PtCPM; double MassMin; double MassMax; if(nState==4){ PtCPM = new TH2D( "PtCPM", "PtCPM", 100,0,50,200,0,100); MassMin=3.011;//massPsi1S-onia::nSigMass*sigma1S; MassMax=3.174;//massPsi1S+onia::nSigMass*sigma1S; // sigma 27.2 MeV // mean 3.093 GeV } if(nState==5){ PtCPM = new TH2D( "PtCPM", "PtCPM", 100,0,50,200,0,100); // rap<1.5 //rapPt = new TH2D( "rapPt", "rapPt", 52,-1.3,1.3,144,0,72); // rap<1.2 MassMin=3.576;//massPsi2S-onia::nSigMass*sigma2S; MassMax=3.786;//massPsi2S+onia::nSigMass*sigma2S; // sigma 34.9 MeV // pT > 7 // sigma 34.3 MeV // pT > 10 // mean 3.681 GeV } cout<<"Plotting Pt-CPM for Psi"<<nState-3<<"S"<<endl; cout<<"MassMin for Pt-CPM plot = "<<MassMin<<endl; cout<<"MassMax for Pt-CPM plot = "<<MassMax<<endl; TTree *rapPtTree = (TTree*)rapPtData->tree(); std::stringstream cutMass; cutMass<<"(JpsiMass > " << MassMin << " && JpsiMass < "<< MassMax << ")"; //following two methods can only be used in root_v30, 34 does not work rapPtTree->Draw("JpsiCPM:JpsiPt>>PtCPM",cutMass.str().c_str(),"colz"); cout<<"debug"<<endl; TCanvas* c2 = new TCanvas("c2","c2",1200,1500); PtCPM->SetYTitle("N_{ch}"); PtCPM->SetXTitle("p_{T}(#mu#mu) [GeV]"); gStyle->SetPalette(1); gPad->SetFillColor(kWhite); PtCPM->SetTitle(0); PtCPM->SetStats(0); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.17); PtCPM->GetYaxis()->SetTitleOffset(1.5); PtCPM->Draw("colz"); TLine* PtCPMLine; int iRap=0; for(int iPt=0;iPt<onia::kNbPTMaxBins+1;iPt++){ int cpmBegin = 0; if(nState==5) cpmBegin = 1; for(int icpm=cpmBegin;icpm<onia::NchBins+1;icpm++){ PtCPMLine= new TLine( onia::pTRange[iRap][0], onia::cpmRange[icpm], onia::pTRange[iRap][onia::kNbPTMaxBins], onia::cpmRange[icpm] ); PtCPMLine->SetLineWidth( 2 ); PtCPMLine->SetLineStyle( 1 ); PtCPMLine->SetLineColor( kWhite ); PtCPMLine->Draw(); PtCPMLine= new TLine( onia::pTRange[iRap][iPt], onia::cpmRange[0], onia::pTRange[iRap][iPt], onia::cpmRange[onia::NchBins] ); PtCPMLine->SetLineWidth( 2 ); PtCPMLine->SetLineStyle( 1 ); PtCPMLine->SetLineColor( kWhite ); PtCPMLine->Draw(); // PtCPMLine= new TLine( onia::pTRange[0][onia::kNbPTMaxBins], onia::cpmRange[icpm], onia::pTRange[0][onia::kNbPTMaxBins], onia::cpmRange[icpm] ); // PtCPMLine->SetLineWidth( 2 ); // PtCPMLine->SetLineStyle( 1 ); // PtCPMLine->SetLineColor( kWhite ); // PtCPMLine->Draw(); } } char savename[200]; sprintf(savename,"Fit/PtCPM_Psi%dS.pdf",nState-3); c2->SaveAs(savename); } f->Close(); }
// ----------------------------------------------------------------------------- // void talk() { time_t start = TTimeStamp().GetSec(); bool draw = true; bool debug = true; // Binning int xbins = 100; int ybins = 100; double xmin = 0.0; double xmax = 1.0; double ymin = 0.0; double ymax = 1.0; double xbin_centre = ( ( xmax - xmin ) / xbins ) / 2.; double ybin_centre = ( ( ymax - ymin ) / ybins ) / 2.; // AlphaT values const int nat = 1; double at[nat]; for ( int ii = 0; ii < nat; ++ii ) { at[ii] = 0.55 + ii * 0.001; } // HT regions const int nht = 3; double ht_min[nht] = { 250., 300., 350. }; // Jet pT thresholds double pt1_min[nht] = { 71.4, 85.7, 100. }; double pt2_min[nht] = { 71.4, 85.7, 100. }; double pt3_min[nht] = { 35.7, 42.9., 50. }; // x fractions double x1_min[nht]; double x2_min[nht]; double x3_max[nht]; for ( int ii = 0; ii < nht; ++ii ) { x1_min[ii] = ( 2. * pt1_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); } for ( int ii = 0; ii < nht; ++ii ) { x2_min[ii] = ( 2. * pt2_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); } for ( int ii = 0; ii < nht; ++ii ) { x3_max[ii] = ( 2. * pt3_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); } // Loop through bins int loop = 0; int nloops = nht; for ( int iht = 0; iht < nht; ++iht ) { std::cout << "Completed " << 100.*float(loop)/float(nloops) << "%..." << std::endl; loop++; // Labeling std::stringstream ss; ss << "HT" << int(ht_min[iht]); // New canvas for plots TCanvas* c1 = 0; if (draw) c1 = new TCanvas( TString("Canvas"+ss.str()), "" ); // Pad for cross-section plot TPad* pad = 0; if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.); if (pad) { pad->SetGrid(); pad->Draw(); pad->cd(); pad->SetLogz(); } TH1F* hr = 0; if (draw) hr = pad->DrawFrame(0.,0.,1.,1.); // Histo title if (hr) { std::stringstream sss; sss << "H_{T}=" << ht_min[iht] << "(p_{T1},p_{T2},p_{T3})=" << pt1_min[iht] << "," << pt2_min[iht] << "," << pt3_min[iht] << ")" << ", (x_{1},x_{2},x_{3})=" << x1_min[iht] << "," << x2_min[iht] << "," << x3_max[iht] << ")"; hr->SetTitle( sss.str().c_str() ); hr->GetXaxis()->SetTitle( "x_{2}" ); hr->GetYaxis()->SetTitle( "x_{1}" ); } // Create 2D cross-section plot TH2D* his = 0; if (draw) his = new TH2D(TString("Histo"+ss.str()),"", xbins,xmin,xmax, ybins,ymin,ymax); // Fill 2D cross-section plot for ( int xbin = 0; xbin < xbins; ++xbin ) { for ( int ybin = 0; ybin < ybins; ++ybin ) { double x2 = ( ( xmax - xmin ) / xbins ) * xbin + xmin; double x1 = ( ( ymax - ymin ) / ybins ) * ybin + ymin; double val = ( x1*x1 + x2*x2 ) / ( ( 1 - x1 ) * ( 1 - x2 ) ); if ( !constrain( x1, x2, x3 ) ) { continue; } if ( x1 < x1_cut[ix1] ) { continue; } double alpha_t = x2 / ( 2 * sqrt(x1+x2-1) ); if (his) his->Fill( x2+xbin_centre, x1+ybin_centre, val ); } } // Draw 2D cross-section plot gStyle->SetPalette(1); if (his) { his->SetMaximum( his->GetMaximum() ); his->SetMinimum( his->GetMinimum(1.e-12) ); his->Draw("COLZsame"); } // Pad for AlphaT contours if (c1) c1->cd(); TPad* overlay = 0; if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.); if (overlay) { overlay->SetFillStyle(4000); overlay->SetFillColor(0); overlay->SetFrameFillStyle(4000); overlay->Draw(); overlay->cd(); } TH1F* hframe = 0; if (draw) overlay->DrawFrame(pad->GetUxmin(), pad->GetUymin(), pad->GetUxmax(), pad->GetUymax()); // Graphs of AlphaT contours TMultiGraph* mg = 0; if (draw) { mg = new TMultiGraph(); for ( Int_t iat = 0; iat < nat; iat++ ) { Double_t alpha_t = at[iat]; const Int_t n_ = 100; Double_t x1_[n_]; Double_t x2_[n_]; for ( Int_t j = 0; j < 100; j++ ) { x2_[j] = j*0.01; Double_t temp = ( x2_[j] - 2. * alpha_t * alpha_t ) / ( 2. * alpha_t ); x1_[j] = temp * temp + 1 - alpha_t * alpha_t; } TGraph* gr = new TGraph(n_,x2_,x1_); mg->Add(gr,"l"); } mg->Draw(); } if (c1) c1->cd(); if (c1) c1->SaveAs(TString(ss.str()+".png")); } }
void hPYphocalc(){ gStyle->SetOptStat(kFALSE); const int maxNpart = 100; int sth=0, Gth=0; TFile *f = TFile::Open(outG); if(sth==0){TString dirname = "std";} else if(sth==1){TString dirname ="Gri055";} else {TString dirname ="Gri101";} TObjString* dataname = (TObjString*)f->Get(Form("dataname")); TObjString* histoname = (TObjString*)f->Get(Form("histoname")); TFile *fdata = TFile::Open(dataname->GetName()); TString name; if(Gth==0) name = "G0"; else if(Gth<nGlau) name = Form("Glau_%d",Gth); else name = Form("bin_%d",Gth-nGlau+1); TObjString* Glaubername = (TObjString*)f->Get(Form("%s/%s/Glaubername",dirname.Data(),name.Data())); TVectorD* k0 = (TVectorD*)f->Get(Form("%s/%s/k0",dirname.Data(),name.Data())); TVectorD* theta0 = (TVectorD*)f->Get(Form("%s/%s/theta0",dirname.Data(),name.Data())); TVectorD* xmin = (TVectorD*)f->Get(Form("%s/%s/xmin",dirname.Data(),name.Data())); TVectorD* xmax = (TVectorD*)f->Get(Form("%s/%s/xmax",dirname.Data(),name.Data())); TVectorD* thetabest = (TVectorD*)f->Get(Form("%s/%s/thetabest",dirname.Data(),name.Data())); TVectorD* kbest = (TVectorD*)f->Get(Form("%s/%s/kbest",dirname.Data(),name.Data())); TVectorD* kpoint = (TVectorD*)f->Get(Form("%s/%s/kpoint",dirname.Data(),name.Data())); TVectorD* NcollAver = (TVectorD*)f->Get(Form("%s/%s/NcollAver",dirname.Data(),name.Data())); TVectorD* centbin = (TVectorD*)f->Get(Form("%s/%s/centbin",dirname.Data(),name.Data())); TFile *fGlauber = TFile::Open(Glaubername->GetName()); //(*k0)[0]=1.39; (*kbest)[0]=0.425; //(*theta0)[0]=3.41; (*thetabest)[0]=1.30; TF1 *gammafun[maxNpart]; TF1 *gammafunevt[maxNpart]; TF1 *gammafunnucl[maxNpart]; TF1 *gammafunnuclNcoll[maxNpart]; double kevt = (*k0)[0]-(*kbest)[0]; for(int iNpart=0;iNpart<maxNpart;iNpart++){ gammafun[iNpart] = new TF1("gammafun","TMath::GammaDist(x,[0],0,[1])",0,200); gammafunevt[iNpart] = new TF1("gammafunevt","TMath::GammaDist(x,[0],0,[1])",0,200); gammafunnucl[iNpart] = new TF1("gammafunnucl","TMath::GammaDist(x,[0],0,[1])",0,200); gammafunnuclNcoll[iNpart] = new TF1("gammafunnuclNcoll","TMath::GammaDist(x,[0],0,[1])",0,200); double k_=(*k0)[0]+(*kbest)[0]*(iNpart-2); double theta_=(*theta0)[0]+(*thetabest)[0]*TMath::Log(iNpart-1); gammafun[iNpart]->SetParameter(0,k_); //[1]: k value gammafun[iNpart]->SetParameter(1,theta_); //[2]: theta value gammafunevt[iNpart]->SetParameter(0,kevt); gammafunevt[iNpart]->SetParameter(1,theta_); gammafunnucl[iNpart]->SetParameter(0,(*kbest)[0]); gammafunnucl[iNpart]->SetParameter(1,theta_); gammafunnuclNcoll[iNpart]->SetParameter(0,(*kbest)[0]*(iNpart-1)); gammafunnuclNcoll[iNpart]->SetParameter(1,theta_); if(iNpart==2){ gammafunnuclNcoll[iNpart]->SetNpx(1e4); gammafunnuclNcoll[iNpart]->SetRange(1e-11,200); } } TTree *t = (TTree*)fGlauber->Get("nt_p_Pb"); Float_t Ncoll, Npart, B; Long_t Nevent; t->SetBranchAddress("Ncoll",&Ncoll); t->SetBranchAddress("Npart",&Npart); t->SetBranchAddress("B",&B); Nevent = (Long_t) t->GetEntries(); Long_t Ev; Int_t Bino; Double_t Para, Para_nucl, Para_p, Para_evt, Bi_Para_nucl, Bi_Para_evt; double yUCM[8]={}; double yPCM[8]={}; double yVCM[8]={}; double yUCM_[200]={}; double yPCM_[200]={}; double yVCM_[200]={}; double C=1e-4; double PNcoll[maxNpart]={}; TH1D *histo_obs = (TH1D*)fdata->Get(histoname->GetName()); TH1D *histo_obs_norm = (TH1D*)histo_obs->Clone(); histo_obs_norm->Scale(1/histo_obs->Integral()); TH1D* hUCM = new TH1D("hUCM","hUCM",200,0,200); TH1D* hPCM = new TH1D("hPCM","hPCM",200,0,200); TH1D* hVCM = new TH1D("hVCM","hVCM",200,0,200); TH2D* NcollvsET = new TH2D("NcollvsET","NcollvsET",100,0,100,2000,0,400); for(Ev=0;Ev<Nevent;Ev++){ t->GetEntry(Ev); PNcoll[(int)Ncoll]++; } for(int i=0;i<maxNpart;i++){ PNcoll[i]/=Nevent; cout<<PNcoll[i]<<"\t"; } cout<<endl; for(Ev=0;Ev<Nevent;Ev++){ if(Ev%100000==0) cout<<"\t"<<"Have run "<<Ev<<" events"<<endl; t->GetEntry(Ev); Para = gammafun[(int)Npart]->GetRandom(); Para_nucl = gammafunnuclNcoll[(int)Npart]->GetRandom(); Para_p = gammafunnuclNcoll[(int)Npart]->GetRandom(); Para_evt = 0; for(int i=0;i<N-1;i++) if(Para>=(*kpoint)[i] && Para<(*kpoint)[i+1]) int ibin = i; for(int Bino=0;Bino<Ncoll;Bino++){ Bi_Para_evt = gammafunevt[(int)Npart]->GetRandom(); Para_evt += Bi_Para_evt; } double PNcollET = gammafun[(int)Npart]->Eval(Para); // double k = gammafun[(int)Npart]->GetParameter(0); double theta=(*theta0)[0]+(*thetabest)[0]*TMath::Log(Npart-1); double YNcollUCM = C*Ncoll; double YNcollPCM = C/1.0/(*kbest)[0]/theta*(Para_nucl); double YNcollVCM = C/2.0*(Para_nucl/(*kbest)[0]/theta+Ncoll); yUCM[ibin] += PNcoll[(int)Ncoll]*PNcollET*YNcollUCM; yPCM[ibin] += PNcoll[(int)Ncoll]*PNcollET*YNcollPCM; yVCM[ibin] += PNcoll[(int)Ncoll]*PNcollET*YNcollVCM; yUCM_[(int)Para] += PNcoll[(int)Ncoll]*PNcollET*YNcollUCM; yPCM_[(int)Para] += PNcoll[(int)Ncoll]*PNcollET*YNcollPCM; yVCM_[(int)Para] += PNcoll[(int)Ncoll]*PNcollET*YNcollVCM; NcollvsET->Fill(Ncoll,Para); } for(int ibin=1;ibin<hUCM->GetNbinsX();ibin++){ hUCM->SetBinContent(ibin,yUCM_[ibin-1]); hPCM->SetBinContent(ibin,yPCM_[ibin-1]); hVCM->SetBinContent(ibin,yVCM_[ibin-1]); } TCanvas *c1 = new TCanvas(); TCanvas *c2 = new TCanvas(); c1->SetLogy(); c2->SetLogx(); c2->SetLogy(); c2->SetLogz(); c1->cd(); TH1D* hFrame = new TH1D("","",200,0,200); hFrame->SetTitle(""); hFrame->GetXaxis()->SetTitle("HF #Sigma E_{T} |#eta|>4"); hFrame->GetYaxis()->SetTitle("Yield no units"); hFrame->GetXaxis()->SetRangeUser(0,150); hFrame->GetYaxis()->SetRangeUser(1e-6,1); hFrame->Draw(); histo_obs_norm->SetMarkerStyle(20); histo_obs_norm->SetMarkerSize(1.0); histo_obs_norm->SetMarkerColor(1); histo_obs_norm->Draw("Psame"); hUCM->SetMarkerStyle(24); hUCM->SetMarkerSize(1.0); hUCM->SetMarkerColor(2); hPCM->SetMarkerStyle(29); hPCM->SetMarkerSize(1.0); hPCM->SetMarkerColor(4); hVCM->SetMarkerStyle(34); hVCM->SetMarkerSize(1.0); hVCM->SetMarkerColor(5); hUCM->Draw("Psame"); hPCM->Draw("Psame"); hVCM->Draw("Psame"); TLegend *leg = new TLegend(0.1,0.2,0.5,0.45); leg->SetFillColor(0); leg->SetFillStyle(0); leg->SetBorderSize(0); leg->SetTextFont(42); leg->SetTextSize(0.03); leg->AddEntry(histo_obs_norm,"minimum bias events","lp"); leg->AddEntry(hUCM,"hard scattering events(UCM)","lp"); leg->AddEntry(hPCM,"hard scattering events(PCM)","lp"); leg->AddEntry(hVCM,"hard scattering events(VCM)","lp"); leg->Draw("same"); c1->Print("paperfig3_CMS.png"); c2->cd(); gStyle->SetOptStat("nemr"); NcollvsET->GetXaxis()->SetTitle("Ncoll"); NcollvsET->GetYaxis()->SetTitle("HF #Sigma E_{T} |#eta|>4"); NcollvsET->Draw("colz"); c2->Print("NcollvsET2D.png"); ofstream fstr("result_CMS.dat"); fstr<<"i"<<"\t"<<"centbin"<<"\t"<<"kpoint"<<"\t"<<"NcollAver"<<"\t"<<"UCM"<<"\t"<<"PCM"<<"\t"<<"VCM"<<"\t"<<"pho1"<<"\t"<<"pho2"<<"\t"<<"MB"<<endl; for(int i=0;i<N-1;i++){ fstr<<i<<"\t"<<(*centbin)[i]*100<<"% to "<<(*centbin)[i+1]*100<<"% \t"<<(*kpoint)[i]<<" to "<<(*kpoint)[i+1]<<"\t"<<(*NcollAver)[i]<<"\t"<<yUCM[i]<<"\t"<<yPCM[i]<<"\t"<<yVCM[i]<<"\t"<<yPCM[i]/yUCM[i]<<"\t"<<yVCM[i]/yUCM[i]<<"\t"<<"undetermined"<<endl; } }
void Fourier() { /* TString dataname = "HIData_Minbias_2760GeV"; TString datatag = "PPRereco_INCLEFF1v4"; */ TString dataname = "PAData_Minbias_5TeV"; TString datatag = "HM_Express_INCLEFF1v5"; // TString datatag = "MB_INCLEFF1v4"; int nmin=220; int nmax=260; const int ntrgptbins=11; const int nassptbins=11; TH1D ***hdata = compare_flow_pp_phi_multipad_pt<TH1D**>(dataname.Data(),datatag.Data(),nmin,nmax,-1,-1,2.0,4.0,ntrgptbins,nassptbins,-2.4,2.4,-2.4,2.4); TH1D* hdata_zyam[ntrgptbins][nassptbins]; TF1* fitfunc_vn[ntrgptbins][nassptbins]; for(int itrg = 0; itrg<ntrgptbins; itrg++) { for(int jass = 0; jass<nassptbins; jass++) { fitfunc_vn[itrg][jass] = FitVnFunc(hdata[itrg][jass]); } } int bin_ref=1; double V2_ref = fitfunc_vn[bin_ref][bin_ref]->GetParameter(2); double V3_ref = fitfunc_vn[bin_ref][bin_ref]->GetParameter(3); double V2_ref_err = fitfunc_vn[bin_ref][bin_ref]->GetParError(2); double V3_ref_err = fitfunc_vn[bin_ref][bin_ref]->GetParError(3); double v2[ntrgptbins]; double v3[ntrgptbins]; double v2_err[ntrgptbins]; double v3_err[ntrgptbins]; double pttrg[ntrgptbins] = {0.0}; double pttrg_err[ntrgptbins] = {0.0}; TH1D* hpt[ntrgptbins]; for(int itrg = 0; itrg<ntrgptbins; itrg++) { TString filename = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/%s/merged/%s_%s_nmin%d_nmax%d_etatrg%.1f-%.1f_etaass%.1f-%.1f_centmin%d_centmax%d.root",dataname.Data(),dataname.Data(),datatag.Data(),nmin,nmax,-1,-1,-2.4,2.4,-2.4,2.4); hpt[itrg] = (TH1D*)GetHist(filename,Form("ptcorr_signal_trg_%d",itrg)); pttrg[itrg] = hpt[itrg]->GetMean(); } for(int itrg = 0; itrg<ntrgptbins; itrg++) { v2[itrg] = fitfunc_vn[itrg][bin_ref]->GetParameter(2)/sqrt(fabs(V2_ref)); v3[itrg] = fitfunc_vn[itrg][bin_ref]->GetParameter(3)/sqrt(fabs(V3_ref)); v2_err[itrg] = fitfunc_vn[itrg][bin_ref]->GetParError(2)/fitfunc_vn[itrg][bin_ref]->GetParameter(2)*v2[itrg]; v3_err[itrg] = fitfunc_vn[itrg][bin_ref]->GetParError(3)/fitfunc_vn[itrg][bin_ref]->GetParameter(3)*v3[itrg]; } ofstream fcout(Form("data/%s_%s_nmin%d_nmax%d_centmin%d_centmax%d_ptass%d.txt",dataname.Data(),datatag.Data(),nmin,nmax,-1,-1,bin_ref)); fcout << "pT v_2 v_2 err." << endl; for(int itrg = 0; itrg<ntrgptbins; itrg++) fcout << pttrg[itrg] << " "<< v2[itrg] << " " << v2_err[itrg] <<endl; fcout<<endl<<endl; fcout << "pT v_3 v_3 err." << endl; for(int itrg = 0; itrg<ntrgptbins; itrg++) fcout << pttrg[itrg] << " "<< v3[itrg] << " " << v3_err[itrg] <<endl; fcout<<endl<<endl; TGraphErrors* g_v2 = new TGraphErrors(ntrgptbins,pttrg,v2,pttrg_err,v2_err); TGraphErrors* g_v3 = new TGraphErrors(ntrgptbins,pttrg,v3,pttrg_err,v3_err); g_v3->SetMarkerStyle(24); TCanvas* cv = new TCanvas("cv","cv",600,550); TH2D* hdummy = new TH2D("dummy",";p_{T} (GeV/c);v_{2}",100,0,12.0,100,0,0.25); hdummy->Draw(); g_v2->Draw("PESAME"); g_v3->Draw("PESAME"); }
void Factorization_eta_mc() { const int nfiles = 24; TString filename[nfiles]; filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent020_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent2040_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent4060_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent020_pttrg033_ptassallweight_etaass34_pixel_eff0_v42.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent2040_pttrg033_ptassallweight_etaass34_pixel_eff0_v42.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent4060_pttrg033_ptassallweight_etaass34_pixel_eff0_v42.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent5060_pttrg053_ptassallweight_etaass45_eff0_v42.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent5060_pttrg053_ptassallweight_etaass45_eff0_v42.root"); // filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent020_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n2500_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n5001200_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n0160_pttrg033_ptassallweight_etaass445_eff0_v42.root"); /* filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent2040_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent4060_pttrg033_ptassallweight_etaass445_eff0_v42.root"); */ filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n2500_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n5001200_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n0160_pttrg033_ptassallweight_etaass34_eff0_v42.root"); /* filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent020_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent2040_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent4060_pttrg033_ptassallweight_etaass34_eff0_v42.root"); */ filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent5060_pttrg053_ptassallweight_etaass34_eff0_v42.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent5060_pttrg053_ptassallweight_etaass34_eff0_v42.root"); filename[16] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent020_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[17] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2040_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[18] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4060_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[19] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent020_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[20] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2040_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[21] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4060_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[22] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[23] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff0_v42.root"); /* filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg053_ptassallweight_etaass45_eff0_v18.root"); */ const int ntrgbins = 16; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr0[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraphErrors* gr_total[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; // double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kBlue, kBlue, kBlue,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal0[ntrgbins]; TH2D* hbackground0[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal0_1D[ntrgbins][6]; TH1D* hbackground0_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; double Vn[ntrgbins1][6]; double VnError[ntrgbins1][6]; double rn[ntrgbins2]; double rn_err[ntrgbins2]; double Vn0[ntrgbins1][6]; double Vn0Error[ntrgbins1][6]; double rn0[ntrgbins2]; double rn0_err[ntrgbins2]; double Vn1[ntrgbins1][6]; double Vn1Error[ntrgbins1][6]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; double rn_total[ntrgbins2]; double rn_total_err[ntrgbins2]; for(int i=0;i<ntrgbins;i++) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/backgroundcosn_trg%d",i)); hsignal[i] = (TH2D*)hsignal0[i]->Clone(Form("signalcosn_trg%d",i)); hbackground[i] = (TH2D*)hbackground0[i]->Clone(Form("backgroundcosn_trg%d",i)); hsignal[i]->Add(hsignal1[i]); hbackground[i]->Add(hbackground1[i]); for(int nbin=1;nbin<4;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal0_1D[i][nbin] = (TH1D*)hsignal0[i]->ProjectionX(Form("signal0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground0_1D[i][nbin] = (TH1D*)hbackground0[i]->ProjectionX(Form("background0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); Vn[i][nbin]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i][nbin]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn0[i][nbin]=hsignal0_1D[i][nbin]->GetMean()-hbackground0_1D[i][nbin]->GetMean(); Vn0Error[i][nbin]=sqrt(hsignal0_1D[i][nbin]->GetMeanError()*hsignal0_1D[i][nbin]->GetMeanError()+hbackground0_1D[i][nbin]->GetMeanError()*hbackground0_1D[i][nbin]->GetMeanError()); Vn1[i][nbin]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); Vn1Error[i][nbin]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<hsignal0_1D[i][nbin]->GetMean()<<" "<<hbackground0_1D[i][nbin]->GetMean()<<" "<<Vn0[i][nbin]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<Vn1[i][nbin]<<endl; delete hsignal_1D[i][nbin]; delete hsignal0_1D[i][nbin]; delete hsignal1_1D[i][nbin]; delete hbackground_1D[i][nbin]; delete hbackground0_1D[i][nbin]; delete hbackground1_1D[i][nbin]; } delete hsignal0[i]; delete hsignal1[i]; delete hsignal[i]; delete hbackground0[i]; delete hbackground1[i]; delete hbackground[i]; } for(int nbin=1;nbin<4;nbin++) { for(int i=0;i<ntrgbins2;i++) { rn[ntrgbins2-i-1]=Vn[i][nbin]/Vn[ntrgbins1-i-1][nbin]; rn_err[ntrgbins2-i-1]=sqrt((VnError[ntrgbins1-i-1][nbin]/Vn[ntrgbins1-i-1][nbin])**2+(VnError[i][nbin]/Vn[i][nbin])**2); rn0[ntrgbins2-i-1]=Vn0[i][nbin]/Vn0[ntrgbins1-i-1][nbin]; rn0_err[ntrgbins2-i-1]=sqrt((Vn0Error[ntrgbins1-i-1][nbin]/Vn0[ntrgbins1-i-1][nbin])**2+(Vn0Error[i][nbin]/Vn0[i][nbin])**2); rn1[ntrgbins2-i-1]=Vn1[i][nbin]/Vn1[ntrgbins1-i-1][nbin]; rn1_err[ntrgbins2-i-1]=sqrt((Vn1Error[ntrgbins1-i-1][nbin]/Vn1[ntrgbins1-i-1][nbin])**2+(Vn1Error[i][nbin]/Vn1[i][nbin])**2); rn_ratio[ntrgbins2-i-1] = rn0[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]; rn_ratio_err[ntrgbins2-i-1] = sqrt(rn0_err[ntrgbins2-i-1]*rn0_err[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]); rn_total[ntrgbins2-i-1] = sqrt(rn0[ntrgbins2-i-1]*rn1[ntrgbins2-i-1]); rn_total_err[ntrgbins2-i-1] = sqrt(rn0_err[ntrgbins2-i-1]*rn0_err[ntrgbins2-i-1]/rn0[ntrgbins2-i-1]/rn0[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]/rn1[ntrgbins2-i-1])*0.5*rn_total[ntrgbins2-i-1]; if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<Vn0[i][nbin]<<" "<<Vn0[ntrgbins1-i-1][nbin]<<" "<<rn0[ntrgbins2-i-1]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<Vn1[i][nbin]<<" "<<Vn1[ntrgbins1-i-1][nbin]<<" "<<rn1[ntrgbins2-i-1]<<endl; } gr[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn,eta_err,rn_err); gr[jj][nbin]->SetMarkerColor(color[nbin]); gr0[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn0,eta_err,rn0_err); gr0[jj][nbin]->SetMarkerColor(color[nbin]); gr1[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn1,eta_err,rn1_err); gr1[jj][nbin]->SetMarkerColor(color[nbin]); gr_ratio[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_ratio,eta_err,rn_ratio_err); gr_ratio[jj][nbin]->SetMarkerColor(color[nbin]); gr_total[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_total,eta_err,rn_total_err); gr_total[jj][nbin]->SetMarkerColor(color[nbin]); /* gr[jj][nbin]->SetMarkerSize(gr[jj][1]->GetMarkerSize()*0.8); gr0[jj][nbin]->SetMarkerSize(gr0[jj][1]->GetMarkerSize()*0.8); gr1[jj][nbin]->SetMarkerSize(gr1[jj][1]->GetMarkerSize()*0.8); gr_ratio[jj][nbin]->SetMarkerSize(gr_ratio[jj][1]->GetMarkerSize()*0.8); */ // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5)*(-x-4.5))/(1+[0]*(x-4.5)*(x-4.5))",0,3.0); // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1+[0]*(x-4.5))",0,3.0); if(jj<8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-4.6))/exp([0]*(x-4.6))",0.0,2.5); else fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-3.5))/exp([0]*(x-3.5))",0.0,1.1); fit[jj][nbin]->SetParameter(0,0.01); gr[jj][nbin]->Fit(Form("fit_%d_%d",nbin,jj),"RNO"); fit[jj][nbin]->SetLineColor(color[nbin]); fit[jj][nbin]->SetLineStyle(9); fit[jj][nbin]->SetLineWidth(1); if(jj<8) { slope[nbin][jj] = fit[jj][nbin]->GetParameter(0); slope_err[nbin][jj] = fit[jj][nbin]->GetParError(0); } else { slope1[nbin][jj-8] = fit[jj][nbin]->GetParameter(0); slope1_err[nbin][jj-8] = fit[jj][nbin]->GetParError(0); } // fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1-4.5*[0])",0,4.5); fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"exp(-[0]*x)",0,5); fit1_aver[jj][nbin]->SetParameter(0,fit[jj][nbin]->GetParameter(0)); fit1_aver[jj][nbin]->SetParError(0,fit[jj][nbin]->GetParError(0)); fit1_aver[jj][nbin]->SetLineStyle(1); fit1_aver[jj][nbin]->SetLineColor(color[nbin]); gr1_band[jj][nbin] = new TGraph(53); for(int mm=0;mm<26;mm++) { gr1_band[jj][nbin]->SetPoint(mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)+fit1_aver[jj][nbin]->GetParError(0)))); gr1_band[jj][nbin]->SetPoint(51-mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)-fit1_aver[jj][nbin]->GetParError(0)))); } gr1_band[jj][nbin]->SetPoint(52,0,1); gr1_band[jj][nbin]->SetFillColor(color[nbin]-10); } } ofstream ff("r2r3_eta_mc.txt"); double cent[8]={0.01,0.025,0.075,0.15,0.25,0.35,0.45,0.55}; double cent_err[8]={0}; TGraphErrors* gr_slope[6]; TGraphErrors* gr1_slope[6]; for(int nbin=1;nbin<4;nbin++) { gr_slope[nbin] = new TGraphErrors(8,cent,slope[nbin],cent_err,slope_err[nbin]); gr_slope[nbin]->SetName(Form("gr_slope_%d",nbin)); cout<<"i="<<nbin+1<<endl; ff<<"i="<<nbin+1<<endl; for(int j=0;j<8;j++) { cout<<slope[nbin][j]<<" "; ff<<slope[nbin][j]<<", ";} cout<<endl; ff<<endl; for(int j=0;j<8;j++) { cout<<slope_err[nbin][j]<<" "; ff<<slope_err[nbin][j]<<", ";} cout<<endl; ff<<endl; } for(int nbin=1;nbin<4;nbin++) { gr1_slope[nbin] = new TGraphErrors(8,cent,slope1[nbin],cent_err,slope1_err[nbin]); gr1_slope[nbin]->SetName(Form("gr1_slope_%d",nbin)); } ff.close(); TString histtitle[8] = {"0-0.2%","0-5%","5-10%","10-20%","20-30%","30-40%","40-50%","50-60%"}; TLine* ll = new TLine(0,1.,5.0,1.); TCanvas* c = new TCanvas("c","c",850,500); makeMultiPanelCanvas(c,3,2,0.01,0.0,0.2,0.2,0.02); // TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.905,1.019); TH2D* htmp = new TH2D("htmp",";#eta^{a};#sqrt{r_{2}(#eta^{a},#eta^{b}) #times r_{2}(-#eta^{a},-#eta^{b})}",100,-0.1,2.5,100,0.905-0.8,1.019+0.5); fixedFontHist(htmp,1.8,2.2); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<6;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); /* gr_total[jj][1]->SetMarkerStyle(34); gr_total[jj][1]->SetMarkerColor(1); gr_total[jj][1]->Draw("Psame"); gr[jj][1]->SetMarkerStyle(28); gr[jj][1]->SetMarkerColor(1); gr[jj][1]->Draw("Psame"); */ gr_total[jj+8][1]->SetMarkerStyle(21); gr_total[jj+8][1]->SetMarkerColor(4); gr_total[jj+8][1]->Draw("Psame"); } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c->cd(1); latex2->DrawLatex(0.26,0.05,"0-20%"); latex2->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); latex2->DrawLatex(0.6,0.1,"4.4 < #eta^{b} < 5"); c->cd(2); latex2->DrawLatex(0.08,0.05,"20-40%"); latex2->DrawLatex(0.07,0.3,"0.3 < p_{T}^{a} < 3 GeV/c"); latex2->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); c->cd(3); latex2->DrawLatex(0.08,0.05,"40-60%"); c->cd(6); latex2->SetTextSize(0.92*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,"40-60%"); c->cd(5); latex2->SetTextSize(0.95*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,"20-40%"); c->cd(4); latex2->SetTextSize(latex2->GetTextSize()); latex2->DrawLatex(0.26,0.24,"0-20%"); latex2->DrawLatex(0.6,0.3,"3 < #eta^{b} < 4"); TLegend* legend2 = new TLegend(0.2,0.24,0.7,0.54); legend2->SetFillStyle(0); legend2->AddEntry(gr_total[16][1],"Data","P"); legend2->AddEntry(gr_total[8][1],"Hydjet, gen-level","P"); legend2->AddEntry(gr_total[0][1],"Hydjet, reco-level","P"); c->cd(1); legend2->Draw("same"); // SaveCanvas(c,"HI/FactBreak","epetadeco_HI_MCcompareTotal_r2"); return; TCanvas* ccaa = new TCanvas("ccaa","ccaa",900,500); makeMultiPanelCanvas(ccaa,4,2,0.01,0.0,0.2,0.2,0.02); for(int jj=0;jj<8;jj++) { ccaa->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr0[jj][1]->SetMarkerStyle(21); gr0[jj][1]->Draw("Psame"); gr1[jj][1]->SetMarkerStyle(25); gr1[jj][1]->Draw("Psame"); } TCanvas* ccbb = new TCanvas("ccbb","ccbb",900,500); makeMultiPanelCanvas(ccbb,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmpaa = new TH2D("htmpaa",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.97,1.03); for(int jj=0;jj<8;jj++) { ccbb->cd(jj+1); htmpaa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->SetMarkerStyle(21); gr_ratio[jj][1]->Draw("Psame"); } TCanvas* cc = new TCanvas("cc","cc",900,500); makeMultiPanelCanvas(cc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp1 = new TH2D("htmp1",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.831,1.06); fixedFontHist(htmp1,1.8,2.2); htmp1->GetXaxis()->CenterTitle(); htmp1->GetYaxis()->CenterTitle(); htmp1->GetYaxis()->SetTitleSize(htmp1->GetYaxis()->GetTitleSize()*1.2); htmp1->GetXaxis()->SetTitleSize(htmp1->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { cc->cd(jj+1); htmp1->Draw(); ll->Draw("Lsame"); gr[jj][2]->SetMarkerStyle(21); gr[jj][2]->Draw("Psame"); fit[jj][2]->Draw("Lsame"); gr[jj+8][2]->SetMarkerStyle(25); // fit[jj+8][2]->SetLineStyle(5); gr[jj+8][2]->Draw("Psame"); // fit[jj+8][2]->Draw("Lsame"); } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.5*latex3->GetTextSize()); cc->cd(1); latex3->DrawLatex(0.26,0.05,histtitle[0]); latex3->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cc->cd(2); latex3->DrawLatex(0.08,0.05,histtitle[1]); latex3->DrawLatex(0.07,0.28,"0.3 < p_{T}^{a} < 3 GeV/c"); latex3->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); cc->cd(4); latex3->DrawLatex(0.08,0.05,histtitle[3]); cc->cd(3); latex3->DrawLatex(0.08,0.05,histtitle[2]); cc->cd(8); latex3->DrawLatex(0.08,0.24,histtitle[7]); cc->cd(7); latex3->DrawLatex(0.08,0.24,histtitle[6]); cc->cd(6); latex3->SetTextSize(0.96*latex3->GetTextSize()); latex3->DrawLatex(0.08,0.24,histtitle[5]); cc->cd(5); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.26,0.24,histtitle[4]); TLegend* legend3 = new TLegend(0.24,0.14,0.51,0.38); legend3->SetFillStyle(0); legend3->AddEntry(gr[0][1],"4.4<#eta^{b}<5","P"); legend3->AddEntry(gr[8][1],"3<#eta^{b}<4","P"); cc->cd(1); legend3->Draw("same"); /* TCanvas* ccc = new TCanvas("ccc","ccc",900,500); makeMultiPanelCanvas(ccc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{4}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp2,1.8,2.2); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.2); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { ccc->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][3]->Draw("Psame"); fit[jj][3]->Draw("Lsame"); gr[jj+8][3]->Set_arkerStyle(25); fit[jj+8][3]->SetLineStyle(5); gr[jj+8][3]->Draw("Psame"); fit[jj+8][3]->Draw("Lsame"); } */ TCanvas* c1 = new TCanvas("c1","c1",500,500); TH2D* htmp2 = new TH2D("htmp2",";Centrality;C",100,0,1.0,100,0.0,0.06); htmp2->Draw(); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); gr_slope[1]->SetMarkerColor(1); gr_slope[2]->SetMarkerColor(1); gr_slope[1]->SetMarkerStyle(21); gr_slope[2]->SetMarkerStyle(22); gr_slope[1]->Draw("PESAME"); gr_slope[2]->Draw("PESAME"); gr1_slope[1]->SetMarkerColor(1); gr1_slope[2]->SetMarkerColor(1); gr1_slope[1]->SetMarkerStyle(25); gr1_slope[2]->SetMarkerStyle(26); gr1_slope[1]->Draw("PESAME"); gr1_slope[2]->Draw("PESAME"); return; TFile* f_slope_out = new TFile("gr_slope_v2v3.root","recreate"); gr_slope[1]->Write(); gr_slope[2]->Write(); gr1_slope[1]->Write(); gr1_slope[2]->Write(); f_slope_out->Close(); return; SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); SaveCanvas(ccaa,"HI/FactBreak","epetadeco_HI_r2ratio"); // SaveCanvas(c1,"HI/FactBreak","epetadeco_HI_C"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_HI_cos"); }
void diaphragm_spectrum() { gROOT->Reset(); TFile * tfin = new TFile("data/kaon_mcraytracing.root"); TH2D * hphotons; tfin->GetObject( "CedarMCTester/Photons/RayTracing/Diaphragm", hphotons ); TCanvas c("c","c", 600, 600 ); c.cd(); gStyle->SetOptStat(0); gStyle->SetGridColor( kGray); c.SetRightMargin(0.15); c.SetLeftMargin(0.12); c.SetGrid(); plot_diaphragm_spectrum( hphotons); c.Print("output/diaphragm_photons.pdf", "pdf" ); TH2D * hphotoelectrons; tfin->GetObject( "CedarMCTester/Photoelectrons/RayTracing/Diaphragm", hphotoelectrons ); plot_diaphragm_spectrum( hphotoelectrons); c.Print("output/diaphragm_photoelectrons.pdf", "pdf" ); TCanvas * c2 = new TCanvas( "c2", "c2", 900, 300 ); c2->cd(); TFile * tfinpion = new TFile("data/pion_mcraytracing.root"); TH2D * hpepion; tfinpion->GetObject( "CedarMCTester/Photoelectrons/RayTracing/Diaphragm", hpepion ); gROOT->GetColor( kRed+2)->SetAlpha(0.02); hphotoelectrons->SetMarkerColor( kRed+2 ); hphotoelectrons->Draw(); hphotoelectrons->GetXaxis()->SetRangeUser(98, 104 ); gROOT->GetColor( kBlue+2)->SetAlpha(0.02); hpepion->SetMarkerColor( kBlue+2 ); hpepion->Draw("same"); c2->SetGrid(); c2->Print("output/diaphragm_pionvskaon.pdf", "pdf" ); TImage * img = TImage::Create(); img->FromPad(c2); img->WriteImage( "output/diaphragm_pionvskaon.png" ); TH1D * hkaon = hphotoelectrons->ProjectionX( "hkaon", 0, -1 ); TH1D * hpion = hpepion->ProjectionX( "hpion", 0, -1 ); TCanvas * c3 = new TCanvas( "c2", "c2", 900, 500 ); c3->cd(); gROOT->GetColor( kRed+2)->SetAlpha(1); gROOT->GetColor( kBlue+2)->SetAlpha(1); hkaon->SetLineColor( kRed+2); hkaon->Scale(1.0/11.0); hpion->SetLineColor( kBlue+2); hpion->GetXaxis()->SetRangeUser(98,104); hpion->SetBit( TH1::kNoTitle, true ); hpion->Draw(); hkaon->SetBit( TH1::kNoTitle, true ); hkaon->Draw("same"); c3->SetGrid(); c3->Print("output/diaphragm_pkcomp.pdf", "pdf" ); }
void Factorization_eta_v2v3_paper() { const int nfiles = 24; TString filename[nfiles]; filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass445_eff1_v42.root"); /* filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); */ filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[16] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[17] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[18] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[19] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[20] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[21] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[22] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[23] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass45_eff1_v42.root"); const int ntrgbins = 16; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr0[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; // double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kBlue, kBlue, kBlue,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal0[ntrgbins]; TH2D* hbackground0[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal0_1D[ntrgbins][6]; TH1D* hbackground0_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; double Vn[ntrgbins1][6]; double VnError[ntrgbins1][6]; double rn[ntrgbins2]; double rn_err[ntrgbins2]; double Vn0[ntrgbins1][6]; double Vn0Error[ntrgbins1][6]; double rn0[ntrgbins2]; double rn0_err[ntrgbins2]; double Vn1[ntrgbins1][6]; double Vn1Error[ntrgbins1][6]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; for(int i=0;i<ntrgbins;i++) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/backgroundcosn_trg%d",i)); /* if(jj==6 || jj==7) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/backgroundcosn_trg%d",i)); } */ hsignal[i] = (TH2D*)hsignal0[i]->Clone(Form("signalcosn_trg%d",i)); hbackground[i] = (TH2D*)hbackground0[i]->Clone(Form("backgroundcosn_trg%d",i)); hsignal[i]->Add(hsignal1[i]); hbackground[i]->Add(hbackground1[i]); for(int nbin=1;nbin<4;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal0_1D[i][nbin] = (TH1D*)hsignal0[i]->ProjectionX(Form("signal0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground0_1D[i][nbin] = (TH1D*)hbackground0[i]->ProjectionX(Form("background0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); Vn[i][nbin]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i][nbin]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn0[i][nbin]=hsignal0_1D[i][nbin]->GetMean()-hbackground0_1D[i][nbin]->GetMean(); Vn0Error[i][nbin]=sqrt(hsignal0_1D[i][nbin]->GetMeanError()*hsignal0_1D[i][nbin]->GetMeanError()+hbackground0_1D[i][nbin]->GetMeanError()*hbackground0_1D[i][nbin]->GetMeanError()); Vn1[i][nbin]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); Vn1Error[i][nbin]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<hsignal0_1D[i][nbin]->GetMean()<<" "<<hbackground0_1D[i][nbin]->GetMean()<<" "<<Vn0[i][nbin]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<Vn1[i][nbin]<<endl; delete hsignal_1D[i][nbin]; delete hsignal0_1D[i][nbin]; delete hsignal1_1D[i][nbin]; delete hbackground_1D[i][nbin]; delete hbackground0_1D[i][nbin]; delete hbackground1_1D[i][nbin]; } delete hsignal0[i]; delete hsignal1[i]; delete hsignal[i]; delete hbackground0[i]; delete hbackground1[i]; delete hbackground[i]; } for(int nbin=1;nbin<4;nbin++) { for(int i=0;i<ntrgbins2;i++) { rn[ntrgbins2-i-1]=Vn[i][nbin]/Vn[ntrgbins1-i-1][nbin]; rn_err[ntrgbins2-i-1]=sqrt((VnError[ntrgbins1-i-1][nbin]/Vn[ntrgbins1-i-1][nbin])**2+(VnError[i][nbin]/Vn[i][nbin])**2); rn0[ntrgbins2-i-1]=Vn0[i][nbin]/Vn0[ntrgbins1-i-1][nbin]; rn0_err[ntrgbins2-i-1]=sqrt((Vn0Error[ntrgbins1-i-1][nbin]/Vn0[ntrgbins1-i-1][nbin])**2+(Vn0Error[i][nbin]/Vn0[i][nbin])**2); rn1[ntrgbins2-i-1]=Vn1[i][nbin]/Vn1[ntrgbins1-i-1][nbin]; rn1_err[ntrgbins2-i-1]=sqrt((Vn1Error[ntrgbins1-i-1][nbin]/Vn1[ntrgbins1-i-1][nbin])**2+(Vn1Error[i][nbin]/Vn1[i][nbin])**2); rn_ratio[ntrgbins2-i-1] = rn0[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]; rn_ratio_err[ntrgbins2-i-1] = sqrt(rn0_err[ntrgbins2-i-1]*rn0_err[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]); if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<Vn0[i][nbin]<<" "<<Vn0[ntrgbins1-i-1][nbin]<<" "<<rn0[ntrgbins2-i-1]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<Vn1[i][nbin]<<" "<<Vn1[ntrgbins1-i-1][nbin]<<" "<<rn1[ntrgbins2-i-1]<<endl; } gr[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn,eta_err,rn_err); gr[jj][nbin]->SetMarkerColor(color[nbin]); gr0[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn0,eta_err,rn0_err); gr0[jj][nbin]->SetMarkerColor(color[nbin]); gr1[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn1,eta_err,rn1_err); gr1[jj][nbin]->SetMarkerColor(color[nbin]); gr_ratio[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_ratio,eta_err,rn_ratio_err); gr_ratio[jj][nbin]->SetMarkerColor(color[nbin]); /* gr[jj][nbin]->SetMarkerSize(gr[jj][1]->GetMarkerSize()*0.8); gr0[jj][nbin]->SetMarkerSize(gr0[jj][1]->GetMarkerSize()*0.8); gr1[jj][nbin]->SetMarkerSize(gr1[jj][1]->GetMarkerSize()*0.8); gr_ratio[jj][nbin]->SetMarkerSize(gr_ratio[jj][1]->GetMarkerSize()*0.8); */ // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5)*(-x-4.5))/(1+[0]*(x-4.5)*(x-4.5))",0,3.0); // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1+[0]*(x-4.5))",0,3.0); if(jj<8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-4.6))/exp([0]*(x-4.6))",0.0,2.4); else fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-3.5))/exp([0]*(x-3.5))",0.0,1.1); fit[jj][nbin]->SetParameter(0,0.01); gr[jj][nbin]->Fit(Form("fit_%d_%d",nbin,jj),"RNO"); fit[jj][nbin]->SetLineColor(color[nbin]); fit[jj][nbin]->SetLineStyle(7); fit[jj][nbin]->SetLineWidth(1); if(jj<8) { slope[nbin][jj] = fit[jj][nbin]->GetParameter(0); slope_err[nbin][jj] = fit[jj][nbin]->GetParError(0); } else { slope1[nbin][jj-8] = fit[jj][nbin]->GetParameter(0); slope1_err[nbin][jj-8] = fit[jj][nbin]->GetParError(0); } // fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1-4.5*[0])",0,4.5); fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"exp(-[0]*x)",0,5); fit1_aver[jj][nbin]->SetParameter(0,fit[jj][nbin]->GetParameter(0)); fit1_aver[jj][nbin]->SetParError(0,fit[jj][nbin]->GetParError(0)); fit1_aver[jj][nbin]->SetLineStyle(1); fit1_aver[jj][nbin]->SetLineColor(color[nbin]); gr1_band[jj][nbin] = new TGraph(53); for(int mm=0;mm<26;mm++) { gr1_band[jj][nbin]->SetPoint(mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)+fit1_aver[jj][nbin]->GetParError(0)))); gr1_band[jj][nbin]->SetPoint(51-mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)-fit1_aver[jj][nbin]->GetParError(0)))); } gr1_band[jj][nbin]->SetPoint(52,0,1); gr1_band[jj][nbin]->SetFillColor(color[nbin]-10); } } ofstream ff("r2r3_eta.txt"); double cent[8]={0.01,0.025,0.075,0.15,0.25,0.35,0.45,0.55}; double cent_err[8]={0}; TGraphErrors* gr_slope[6]; TGraphErrors* gr1_slope[6]; for(int nbin=1;nbin<4;nbin++) { gr_slope[nbin] = new TGraphErrors(8,cent,slope[nbin],cent_err,slope_err[nbin]); gr_slope[nbin]->SetName(Form("gr_slope_%d",nbin)); cout<<"i="<<nbin+1<<endl; ff<<"i="<<nbin+1<<endl; for(int j=0;j<8;j++) { cout<<slope[nbin][j]<<" "; ff<<slope[nbin][j]<<", ";} cout<<endl; ff<<endl; for(int j=0;j<8;j++) { cout<<slope_err[nbin][j]<<" "; ff<<slope_err[nbin][j]<<", ";} cout<<endl; ff<<endl; } for(int nbin=1;nbin<4;nbin++) { gr1_slope[nbin] = new TGraphErrors(8,cent,slope1[nbin],cent_err,slope1_err[nbin]); gr1_slope[nbin]->SetName(Form("gr1_slope_%d",nbin)); } ff.close(); TString histtitle[8] = {"0-0.2% centrality","0-5%","5-10%","10-20%","20-30%","30-40%","40-50%","50-60%"}; TLine* ll = new TLine(-0.12,1.,2.49,1.); TCanvas* c = new TCanvas("c","c",920,500); makeMultiPanelCanvas(c,4,2,0.01,0.0,0.25,0.2,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.12,2.49,100,0.831-0.02,1.06-0.02); fixedFontHist(htmp,1.8,2.8); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); htmp->GetXaxis()->SetLabelSize(htmp->GetXaxis()->GetLabelSize()*0.95); htmp->GetXaxis()->SetNdivisions(510); for(int jj=0;jj<8;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr[jj][1]->SetMarkerStyle(21); gr[jj][1]->Draw("Psame"); fit[jj][1]->Draw("Lsame"); cout<<fit[jj][1]->GetChisquare()/fit[jj][1]->GetNDF()<<endl; gr[jj+8][1]->SetMarkerStyle(25); // fit[jj+8][1]->SetLineStyle(5); gr[jj+8][1]->Draw("Psame"); // fit[jj+8][1]->Draw("Lsame"); /* gr[jj+16][1]->SetMarkerStyle(28); gr[jj+16][1]->SetMarkerColor(1); gr[jj+16][1]->Draw("Psame"); */ } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c->cd(1); latex2->DrawLatex(0.31,0.05,histtitle[0]); latex2->DrawLatex(0.29,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); c->cd(2); latex2->DrawLatex(0.08,0.05,histtitle[1]); latex2->SetTextSize(0.98*latex2->GetTextSize()); latex2->DrawLatex(0.1,0.285,"0.3 < p_{T}^{a} < 3.0 GeV/c"); latex2->DrawLatex(0.1,0.18,"p_{T}^{b} > 0 GeV/c"); latex2->SetTextSize(latex2->GetTextSize()/0.98); c->cd(4); latex2->DrawLatex(0.08,0.05,histtitle[3]); c->cd(3); latex2->DrawLatex(0.08,0.05,histtitle[2]); c->cd(8); latex2->DrawLatex(0.08,0.24,histtitle[7]); c->cd(7); latex2->DrawLatex(0.08,0.24,histtitle[6]); c->cd(6); latex2->SetTextSize(0.96*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,histtitle[5]); c->cd(5); latex2->SetTextSize(0.85*latex2->GetTextSize()); latex2->DrawLatex(0.31,0.24,histtitle[4]); TLegend* legend2 = new TLegend(0.26,0.16,0.78,0.46); legend2->SetFillStyle(0); legend2->AddEntry(gr[0][1],"4.4 < #eta^{b} < 5.0","P"); legend2->AddEntry(gr[8][1],"3.0 < #eta^{b} < 4.0","P"); legend2->AddEntry(fit[0][1],"Exponential fits","L"); c->cd(1); legend2->Draw("same"); TCanvas* ccaa = new TCanvas("ccaa","ccaa",900,500); makeMultiPanelCanvas(ccaa,4,2,0.01,0.0,0.2,0.2,0.02); for(int jj=0;jj<8;jj++) { ccaa->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr0[jj][1]->SetMarkerStyle(21); gr0[jj][1]->Draw("Psame"); gr1[jj][1]->SetMarkerStyle(25); gr1[jj][1]->Draw("Psame"); } TCanvas* ccbb = new TCanvas("ccbb","ccbb",900,500); makeMultiPanelCanvas(ccbb,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmpaa = new TH2D("htmpaa",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.97,1.03); for(int jj=0;jj<8;jj++) { ccbb->cd(jj+1); htmpaa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->SetMarkerStyle(21); gr_ratio[jj][1]->Draw("Psame"); } TCanvas* cc = new TCanvas("cc","cc",920,500); makeMultiPanelCanvas(cc,4,2,0.01,0.0,0.25,0.2,0.02); TH2D* htmp1 = new TH2D("htmp1",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.12,2.49,100,0.831-0.02,1.06-0.02); fixedFontHist(htmp1,1.8,2.8); htmp1->GetXaxis()->CenterTitle(); htmp1->GetYaxis()->CenterTitle(); htmp1->GetYaxis()->SetTitleSize(htmp1->GetYaxis()->GetTitleSize()*1.2); htmp1->GetXaxis()->SetTitleSize(htmp1->GetXaxis()->GetTitleSize()*1.); htmp1->GetXaxis()->SetLabelSize(htmp1->GetXaxis()->GetLabelSize()*0.95); htmp1->GetXaxis()->SetNdivisions(510); for(int jj=0;jj<8;jj++) { cc->cd(jj+1); htmp1->Draw(); ll->Draw("Lsame"); gr[jj][2]->SetMarkerStyle(21); gr[jj][2]->Draw("Psame"); fit[jj][2]->Draw("Lsame"); cout<<fit[jj][2]->GetChisquare()/fit[jj][2]->GetNDF()<<endl; gr[jj+8][2]->SetMarkerStyle(25); // fit[jj+8][2]->SetLineStyle(5); gr[jj+8][2]->Draw("Psame"); // fit[jj+8][2]->Draw("Lsame"); /* gr[jj+16][2]->SetMarkerStyle(28); gr[jj+16][2]->SetMarkerColor(1); gr[jj+16][2]->Draw("Psame"); fit[jj+16][2]->Draw("Lsame"); */ } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.5*latex3->GetTextSize()); cc->cd(1); latex3->DrawLatex(0.31,0.05,histtitle[0]); latex3->DrawLatex(0.29,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cc->cd(2); latex3->DrawLatex(0.08,0.05,histtitle[1]); latex3->SetTextSize(0.98*latex3->GetTextSize()); latex3->DrawLatex(0.1,0.285,"0.3 < p_{T}^{a} < 3.0 GeV/c"); latex3->DrawLatex(0.1,0.18,"p_{T}^{b} > 0 GeV/c"); latex3->SetTextSize(latex3->GetTextSize()/0.98); cc->cd(4); latex3->DrawLatex(0.08,0.05,histtitle[3]); cc->cd(3); latex3->DrawLatex(0.08,0.05,histtitle[2]); cc->cd(8); latex3->DrawLatex(0.08,0.24,histtitle[7]); cc->cd(7); latex3->DrawLatex(0.08,0.24,histtitle[6]); cc->cd(6); latex3->SetTextSize(0.96*latex3->GetTextSize()); latex3->DrawLatex(0.08,0.24,histtitle[5]); cc->cd(5); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.31,0.24,histtitle[4]); TLegend* legend3 = new TLegend(0.26,0.16,0.78,0.46); legend3->SetFillStyle(0); legend3->AddEntry(gr[0][1],"4.4 < #eta^{b} < 5.0","P"); // legend3->AddEntry(gr[16][1],"4<#eta^{b}<5","P"); legend3->AddEntry(gr[8][1],"3.0 < #eta^{b} < 4.0","P"); legend3->AddEntry(fit[0][1],"Exponential fits","L"); cc->cd(1); legend3->Draw("same"); /* TCanvas* ccc = new TCanvas("ccc","ccc",900,500); makeMultiPanelCanvas(ccc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{4}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp2,1.8,2.2); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.2); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { ccc->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][3]->Draw("Psame"); fit[jj][3]->Draw("Lsame"); gr[jj+8][3]->Set_arkerStyle(25); fit[jj+8][3]->SetLineStyle(5); gr[jj+8][3]->Draw("Psame"); fit[jj+8][3]->Draw("Lsame"); } */ SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); return; TCanvas* c1 = new TCanvas("c1","c1",500,500); TH2D* htmp2 = new TH2D("htmp2",";Centrality;C",100,0,1.0,100,0.0,0.06); htmp2->Draw(); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); gr_slope[1]->SetMarkerColor(1); gr_slope[2]->SetMarkerColor(1); gr_slope[1]->SetMarkerStyle(21); gr_slope[2]->SetMarkerStyle(22); gr_slope[1]->Draw("PESAME"); gr_slope[2]->Draw("PESAME"); gr1_slope[1]->SetMarkerColor(1); gr1_slope[2]->SetMarkerColor(1); gr1_slope[1]->SetMarkerStyle(25); gr1_slope[2]->SetMarkerStyle(26); gr1_slope[1]->Draw("PESAME"); gr1_slope[2]->Draw("PESAME"); TFile* f_slope_out = new TFile("gr_slope_v2v3.root","recreate"); gr_slope[1]->Write(); gr_slope[2]->Write(); gr1_slope[1]->Write(); gr1_slope[2]->Write(); f_slope_out->Close(); double c2th_05[4] = {1,0.961347696746,0.880663601763,0.754486161464}; double c2th_05_err[4] = {0,0.000356333410703,0.000338330912667,0.000274987058522}; double c2th_510[4] = {1,0.972713667246,0.915076778092,0.833525975859}; double c2th_510_err[4] = {0,0.000405999641418,0.000387338629763,0.000306789774481}; double c2th_2025[4] = {1,0.984223594381,0.952359517332,0.902163004038}; double c2th_2025_err[4] = {0,0.00034410202865,0.000327502849547,0.000264412975357}; double c3th_05[4] = {1,0.969266017011,0.906673110779,0.811457263278}; double c3th_05_err[4] = {0,0.000169783126377,0.000162733412441,0.000127976935994}; double c3th_510[4] = {1,0.967235903665,0.902375220756,0.794138304113}; double c3th_510_err[4] = {0,0.000140808705408,0.000136143144565,0.000110350606241}; double c3th_2025[4] = {1,0.969550353187,0.904351369862,0.80580447205}; double c3th_2025_err[4] = {0,9.57789409787e-05,9.14453396096e-05,7.07914090744e-05}; double etath[4] = {0,0.5,1,2}; double etath_err[4] = {0}; TGraphErrors* gr_c2th_05 = new TGraphErrors(4,etath,c2th_05,etath_err,c2th_05_err); TGraphErrors* gr_c2th_510 = new TGraphErrors(4,etath,c2th_510,etath_err,c2th_510_err); TGraphErrors* gr_c2th_2025 = new TGraphErrors(4,etath,c2th_2025,etath_err,c2th_2025_err); TGraphErrors* gr_c3th_05 = new TGraphErrors(4,etath,c3th_05,etath_err,c3th_05_err); TGraphErrors* gr_c3th_510 = new TGraphErrors(4,etath,c3th_510,etath_err,c3th_510_err); TGraphErrors* gr_c3th_2025 = new TGraphErrors(4,etath,c3th_2025,etath_err,c3th_2025_err); gr_c2th_05->SetMarkerStyle(31); gr_c2th_510->SetMarkerStyle(31); gr_c2th_2025->SetMarkerStyle(31); gr_c3th_05->SetMarkerStyle(31); gr_c3th_510->SetMarkerStyle(31); gr_c3th_2025->SetMarkerStyle(31); TCanvas* cth = new TCanvas("cth","",900,330); makeMultiPanelCanvas(cth,3,1,0.01,0.0,0.2,0.17,0.02); TH2D* htmp8 = new TH2D("htmp8",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.67,1.06); fixedFontHist(htmp8,0.9,1.3); htmp8->GetXaxis()->CenterTitle(); htmp8->GetYaxis()->CenterTitle(); htmp8->GetYaxis()->SetTitleSize(htmp8->GetYaxis()->GetTitleSize()*1.4); htmp8->GetXaxis()->SetTitleSize(htmp8->GetXaxis()->GetTitleSize()*1.2); cth->cd(1); htmp8->Draw(); ll->Draw("Lsame"); gr[1][1]->SetMarkerStyle(20); gr[1][1]->Draw("Psame"); gr_c2th_05->Draw("LPsame"); cth->cd(2); htmp8->Draw(); ll->Draw("Lsame"); gr[2][1]->SetMarkerStyle(20); gr[2][1]->Draw("Psame"); gr_c2th_510->Draw("LPsame"); cth->cd(3); htmp8->Draw(); ll->Draw("Lsame"); gr[4][1]->SetMarkerStyle(20); gr[4][1]->Draw("Psame"); gr_c2th_2025->Draw("LPsame"); TLegend* legend_cth = new TLegend(0.25,0.24,0.75,0.4); legend_cth->SetFillStyle(0); legend_cth->AddEntry(gr[1][1],"Data","P"); legend_cth->AddEntry(gr_c2th_05,"3D hydro. model","PL"); cth->cd(1); legend_cth->Draw("same"); TLatex* latex8 = new TLatex(); latex8->SetNDC(); latex8->SetTextSize(latex3->GetTextSize()); cth->cd(1); latex8->DrawLatex(0.8,0.25,histtitle[1]); latex8->DrawLatex(0.285,0.88,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cth->cd(2); latex8->DrawLatex(0.68,0.25,histtitle[2]); latex8->DrawLatex(0.07,0.45,"4.4 < #eta^{b} < 5"); latex8->DrawLatex(0.07,0.35,"0.3 < p_{T}^{a} < 3 GeV/c"); latex8->DrawLatex(0.07,0.25,"p_{T}^{b} > 0 GeV/c"); cth->cd(3); latex8->DrawLatex(0.68,0.25,histtitle[4]); TCanvas* cth3 = new TCanvas("cth3","",900,330); makeMultiPanelCanvas(cth3,3,1,0.01,0.0,0.2,0.17,0.02); TH2D* htmp9 = new TH2D("htmp9",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.12,2.49,100,0.7,1.06); fixedFontHist(htmp9,0.9,1.3); htmp9->GetXaxis()->CenterTitle(); htmp9->GetYaxis()->CenterTitle(); htmp9->GetYaxis()->SetTitleSize(htmp9->GetYaxis()->GetTitleSize()*1.4); htmp9->GetXaxis()->SetTitleSize(htmp9->GetXaxis()->GetTitleSize()*1.2); cth3->cd(1); htmp9->Draw(); ll->Draw("Lsame"); gr[1][2]->SetMarkerStyle(20); gr[1][2]->Draw("Psame"); gr_c3th_05->Draw("LPsame"); cth3->cd(2); htmp9->Draw(); ll->Draw("Lsame"); gr[2][2]->SetMarkerStyle(20); gr[2][2]->Draw("Psame"); gr_c3th_510->Draw("LPsame"); cth3->cd(3); htmp9->Draw(); ll->Draw("Lsame"); gr[4][2]->SetMarkerStyle(20); gr[4][2]->Draw("Psame"); gr_c3th_2025->Draw("LPsame"); cth3->cd(1); legend_cth->Draw("same"); cth3->cd(1); latex8->DrawLatex(0.8,0.25,histtitle[1]); latex8->DrawLatex(0.285,0.88,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cth3->cd(2); latex8->DrawLatex(0.68,0.25,histtitle[2]); latex8->DrawLatex(0.07,0.45,"4.4 < #eta^{b} < 5"); latex8->DrawLatex(0.07,0.35,"0.3 < p_{T}^{a} < 3 GeV/c"); latex8->DrawLatex(0.07,0.25,"p_{T}^{b} > 0 GeV/c"); cth3->cd(3); latex8->DrawLatex(0.68,0.25,histtitle[4]); /* SaveCanvas(cth,"HI/FactBreak","epetadeco_HI_theory_r2"); SaveCanvas(cth3,"HI/FactBreak","epetadeco_HI_theory_r3"); */ SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); // SaveCanvas(ccaa,"HI/FactBreak","epetadeco_HI_r2ratio"); // SaveCanvas(c1,"HI/FactBreak","epetadeco_HI_C"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_HI_cos"); }