Double_t chisq(Double_t* x, Double_t* p); Double_t chi2cdf(Double_t* x, Double_t* p); void pl_over_TIS(Double_t dChi2Lim, Double_t dChi2Lim2, Double_t dSpillDuration, Int_t iNTISBins, Bool_t bDifferentialTISAnalysis, Double_t dSigmaDX04, Double_t dSigmaDY04, Double_t dSigmaDT04) { gStyle->SetOptStat(0); // gStyle->SetOptStat("emr"); // gStyle->SetOptFit(0); gStyle->SetLabelSize(0.07, "x"); gStyle->SetLabelSize(0.07, "y"); gStyle->SetLabelSize(0.06, "z"); Bool_t gbChi2LimFitRange = kFALSE; TCanvas* tCanvas = new TCanvas("tCanvas", "", 0., 0., 1800., 900.); tCanvas->Divide(6, 3); TH1* tHisto; TH1* tHisto1; TH2* tHisto2; TProfile* tProfile; TEfficiency* tEff; TLine* tLine; Int_t iNDetectedPoints; Int_t iNTotalPoints; Double_t dMeanEfficiency; Double_t dMeanEfficiencyErrorLow; Double_t dMeanEfficiencyErrorUp; std::vector dSigmaDX04TIS(iNTISBins, dSigmaDX04); std::vector dSigmaDY04TIS(iNTISBins, dSigmaDY04); std::vector dSigmaDT04TIS(iNTISBins, dSigmaDT04); if(gbChi2LimFitRange) { TFile::Open("./calib_ana.cor_out.root", "READ"); if(gFile) { for(Int_t iTISBin = 1; iTISBin <= iNTISBins; iTISBin++) { tHisto = dynamic_cast(gFile->FindObjectAny("hSelTypeNNResidualX_WidthTIS")); dSigmaDX04TIS.at(iTISBin - 1) = tHisto->GetBinContent(1, iTISBin); tHisto = dynamic_cast(gFile->FindObjectAny("hSelTypeNNResidualY_WidthTIS")); dSigmaDY04TIS.at(iTISBin - 1) = tHisto->GetBinContent(1, iTISBin); tHisto = dynamic_cast(gFile->FindObjectAny("hSelTypeNNResidualT_WidthTIS")); dSigmaDT04TIS.at(iTISBin - 1) = tHisto->GetBinContent(1, iTISBin); } tHisto = dynamic_cast(gFile->FindObjectAny("hSelTypeNNResidualX_Width")); dSigmaDX04 = tHisto->GetBinContent(1); tHisto = dynamic_cast(gFile->FindObjectAny("hSelTypeNNResidualY_Width")); dSigmaDY04 = tHisto->GetBinContent(1); tHisto = dynamic_cast(gFile->FindObjectAny("hSelTypeNNResidualT_Width")); dSigmaDT04 = tHisto->GetBinContent(1); gFile->Close(); delete gFile; } else { cout<<"Could not open output calibration file. Using default 04 sigmas."< dFitRangeDX04TIS(iNTISBins, dFitRangeDX04); std::vector dFitRangeDY04TIS(iNTISBins, dFitRangeDY04); std::vector dFitRangeDT04TIS(iNTISBins, dFitRangeDT04); if(gbChi2LimFitRange) { if(bDifferentialTISAnalysis) { for(Int_t iTISBin = 1; iTISBin <= iNTISBins; iTISBin++) { dFitRangeDX04TIS.at(iTISBin - 1) = TMath::Sqrt(dChi2Lim)*dSigmaDX04TIS.at(iTISBin - 1); dFitRangeDY04TIS.at(iTISBin - 1) = TMath::Sqrt(dChi2Lim)*dSigmaDY04TIS.at(iTISBin - 1); dFitRangeDT04TIS.at(iTISBin - 1) = TMath::Sqrt(dChi2Lim)*dSigmaDT04TIS.at(iTISBin - 1); } } } tCanvas->cd(1); tHisto = dynamic_cast(gROOT->FindObjectAny("hAllDXSel24")); tHisto->Draw(); gPad->SetLogy(); // tHisto->GetYaxis()->SetRangeUser(1., 10000000.); tHisto->GetXaxis()->SetRangeUser(-20., 20.); tHisto = dynamic_cast(gROOT->FindObjectAny("hSelDXSel24")); tHisto->SetLineColor(kGreen + 2); tHisto->Draw("SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(2); tHisto = dynamic_cast(gROOT->FindObjectAny("hAllDYSel24")); tHisto->Draw(); gPad->SetLogy(); // tHisto->GetYaxis()->SetRangeUser(1., 1000000.); tHisto->GetXaxis()->SetRangeUser(-20., 20.); tHisto = dynamic_cast(gROOT->FindObjectAny("hSelDYSel24")); tHisto->SetLineColor(kGreen + 2); tHisto->Draw("SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(3); tHisto = dynamic_cast(gROOT->FindObjectAny("hAllDTSel24")); tHisto->Draw(); gPad->SetLogy(); // tHisto->GetYaxis()->SetRangeUser(1., 1000000.); // tHisto->GetXaxis()->SetRangeUser(-0.5, 0.5); tHisto->GetXaxis()->SetRangeUser(-3., 3.); tHisto = dynamic_cast(gROOT->FindObjectAny("hSelDTSel24")); tHisto->SetLineColor(kGreen + 2); tHisto->Draw("SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(4); tHisto = dynamic_cast(gROOT->FindObjectAny("hAllChi2Sel24")); tHisto->Draw(); // gPad->SetLogy(); // tHisto->GetYaxis()->SetRangeUser(100., 10000.); tHisto->GetXaxis()->SetRangeUser(0., 10.); tHisto->Smooth(); gPad->Modified(); gPad->Update(); TF1* tChiSq24 = new TF1("tChiSq24", chisq, 0., 15., 2); tChiSq24->FixParameter(0, 3.); tChiSq24->SetParameter(1, tHisto->Integral("width")); tChiSq24->SetNpx(1000000); tChiSq24->SetLineWidth(1); TFitResultPtr tFitResult24 = tHisto->Fit(tChiSq24, "SNQ", "", 0., dChi2Lim2); cout<GetChisquare())<GetNDF())<GetChisquare()/tChiSq24->GetNDF())<SetRange(0., 10.); tHisto = dynamic_cast(gROOT->FindObjectAny("hSelChi2Sel24")); tHisto->SetLineColor(kGreen + 2); tHisto->Smooth(); tHisto->Draw("SAME"); tChiSq24->Draw("SAME"); tCanvas->cd(5); tEff = dynamic_cast(gROOT->FindObjectAny("hSelHitTupleEfficiencyTIS")); tEff->SetTitle("Sel2-MRef"); tEff->SetLineColor(kBlue + 2); tEff->SetMarkerColor(kBlue + 2); tEff->Draw("AP"); gPad->Update(); tEff->GetPaintedGraph()->GetXaxis()->SetLimits(0., dSpillDuration); tEff->GetPaintedGraph()->GetYaxis()->SetRangeUser(0., 1.); tEff->GetPaintedGraph()->GetYaxis()->SetTitleOffset(1.25); gPad->Update(); gPad->Modified(); iNDetectedPoints = tEff->GetPassedHistogram()->GetEntries(); iNTotalPoints = tEff->GetTotalHistogram()->GetEntries(); dMeanEfficiency = 1.*iNDetectedPoints/iNTotalPoints; dMeanEfficiencyErrorUp = TEfficiency::ClopperPearson(iNTotalPoints, iNDetectedPoints, TMath::Erf(1./TMath::Sqrt2()), kTRUE) - dMeanEfficiency; dMeanEfficiencyErrorLow = dMeanEfficiency - TEfficiency::ClopperPearson(iNTotalPoints, iNDetectedPoints, TMath::Erf(1./TMath::Sqrt2()), kFALSE); tLine = new TLine(gPad->GetUxmin(), dMeanEfficiency, dSpillDuration, dMeanEfficiency); tLine->SetLineColor(kBlue + 2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); tCanvas->cd(7); tHisto = dynamic_cast(gROOT->FindObjectAny("hAllDX04")); tHisto->Draw(); gPad->SetLogy(); // tHisto->GetYaxis()->SetRangeUser(1., 10000000.); tHisto->GetXaxis()->SetRangeUser(-20., 20.); TF1* tFitAllDX04 = new TF1("tFitAllDX04", "gaus", -dFitRangeDX04, dFitRangeDX04); tFitAllDX04->SetNpx(1000000); tFitAllDX04->SetLineWidth(1); tHisto->Fit(tFitAllDX04, "SNQR"); // tFitAllDX04->SetRange(-5., 5.); tFitAllDX04->Draw("SAME"); tHisto = dynamic_cast(gROOT->FindObjectAny("hSelDX04")); tHisto->SetLineColor(kGreen + 2); tHisto->Draw("SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(8); tHisto = dynamic_cast(gROOT->FindObjectAny("hAllDY04")); tHisto->Draw(); gPad->SetLogy(); // tHisto->GetYaxis()->SetRangeUser(1., 1000000.); tHisto->GetXaxis()->SetRangeUser(-20., 20.); // tHisto->Smooth(); // TODO: re-enable if needed TF1* tFitAllDY04 = new TF1("tFitAllDY04", "gaus", -dFitRangeDY04, dFitRangeDY04); tFitAllDY04->SetNpx(1000000); tFitAllDY04->SetLineWidth(1); tHisto->Fit(tFitAllDY04, "SNQR"); // tFitAllDY04->SetRange(-5., 5.); tFitAllDY04->Draw("SAME"); tHisto = dynamic_cast(gROOT->FindObjectAny("hSelDY04")); tHisto->SetLineColor(kGreen + 2); tHisto->Draw("SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(9); tHisto = dynamic_cast(gROOT->FindObjectAny("hAllDT04")); tHisto->Draw(); gPad->SetLogy(); // tHisto->GetYaxis()->SetRangeUser(1., 1000000.); // tHisto->GetXaxis()->SetRangeUser(-0.5, 0.5); tHisto->GetXaxis()->SetRangeUser(-3., 3.); TF1* tFitAllDT04 = new TF1("tFitAllDT04", "gaus", -dFitRangeDT04, dFitRangeDT04); tFitAllDT04->SetNpx(1000000); tFitAllDT04->SetLineWidth(1); tHisto->Fit(tFitAllDT04, "SNQR"); // tFitAllDT04->SetRange(-5., 5.); tFitAllDT04->Draw("SAME"); tHisto = dynamic_cast(gROOT->FindObjectAny("hSelDT04")); tHisto->SetLineColor(kGreen + 2); tHisto->Draw("SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(10); tHisto = dynamic_cast(gROOT->FindObjectAny("hAllChi204")); tHisto->Clone("hAllChi204_copy"); // necessary here due to 'TH1::Smooth' impacting 'TH1::Integral' tHisto->Draw(); // gPad->SetLogy(); // tHisto->GetYaxis()->SetRangeUser(100., 10000.); tHisto->GetXaxis()->SetRangeUser(0., 15.); tHisto->Smooth(); gPad->Modified(); gPad->Update(); TF1* tChiSq04 = new TF1("tChiSq04", chisq, 0., 15., 2); tChiSq04->FixParameter(0, 3.); tChiSq04->SetParameter(1, tHisto->Integral("width")); tChiSq04->SetNpx(1000000); tChiSq04->SetLineWidth(1); TFitResultPtr tFitResult04 = tHisto->Fit(tChiSq04, "SNQ", "", 0., dChi2Lim); cout<GetChisquare())<GetNDF())<GetChisquare()/tChiSq04->GetNDF())<SetRange(0., 15.); tHisto = dynamic_cast(gROOT->FindObjectAny("hSelChi204")); tHisto->SetLineColor(kGreen + 2); tHisto->Smooth(); tHisto->Draw("SAME"); tChiSq04->Draw("SAME"); tCanvas->cd(11); tEff = dynamic_cast(gROOT->FindObjectAny("hSelHitTupleMatchAcceptanceTIS")); tEff->SetTitle("DUT-MRef"); tEff->SetLineColor(kBlue + 2); tEff->SetMarkerColor(kBlue + 2); tEff->Draw("AP"); gPad->Update(); tEff->GetPaintedGraph()->GetXaxis()->SetLimits(0., dSpillDuration); tEff->GetPaintedGraph()->GetYaxis()->SetRangeUser(0., 1.); tEff->GetPaintedGraph()->GetYaxis()->SetTitleOffset(1.25); gPad->Modified(); iNDetectedPoints = tEff->GetPassedHistogram()->GetEntries(); iNTotalPoints = tEff->GetTotalHistogram()->GetEntries(); dMeanEfficiency = 1.*iNDetectedPoints/iNTotalPoints; dMeanEfficiencyErrorLow = dMeanEfficiency - TEfficiency::ClopperPearson(iNTotalPoints, iNDetectedPoints, TMath::Erf(1./TMath::Sqrt2()), kFALSE); dMeanEfficiencyErrorUp = TEfficiency::ClopperPearson(iNTotalPoints, iNDetectedPoints, TMath::Erf(1./TMath::Sqrt2()), kTRUE) - dMeanEfficiency; cout<GetUxmin(), dMeanEfficiency, dSpillDuration, dMeanEfficiency); tLine->SetLineColor(kBlue + 2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); tEff = dynamic_cast(gROOT->FindObjectAny("hSelHitTupleMatchEfficiencyTIS")); // tEff->SetTitle("DUT-MRef"); tEff->SetLineColor(kGreen + 2); tEff->SetMarkerColor(kGreen + 2); tEff->Draw("P SAME"); gPad->Update(); gPad->Modified(); iNDetectedPoints = tEff->GetPassedHistogram()->GetEntries(); iNTotalPoints = tEff->GetTotalHistogram()->GetEntries(); dMeanEfficiency = 1.*iNDetectedPoints/iNTotalPoints; dMeanEfficiencyErrorLow = dMeanEfficiency - TEfficiency::ClopperPearson(iNTotalPoints, iNDetectedPoints, TMath::Erf(1./TMath::Sqrt2()), kFALSE); dMeanEfficiencyErrorUp = TEfficiency::ClopperPearson(iNTotalPoints, iNDetectedPoints, TMath::Erf(1./TMath::Sqrt2()), kTRUE) - dMeanEfficiency; cout<GetUxmin(), dMeanEfficiency, dSpillDuration, dMeanEfficiency); tLine->SetLineColor(kGreen + 2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); TH1* tHistoPassed = tEff->GetCopyPassedHisto(); TH1* tHistoTotal = tEff->GetCopyTotalHisto(); tHistoPassed->Scale(1./ROOT::Math::chisquared_cdf(dChi2Lim, 3)); for(Int_t iTISBin = 1; iTISBin <= iNTISBins; iTISBin++) { if(tHistoPassed->GetBinContent(iTISBin) > tHistoTotal->GetBinContent(iTISBin)) { cout<SetBinContent(iTISBin, tHistoTotal->GetBinContent(iTISBin)); } } tHistoPassed->Sumw2(kFALSE); tEff = new TEfficiency(*tHistoPassed, *tHistoTotal); tEff->SetDirectory(gROOT); tEff->SetLineColor(2); tEff->SetMarkerColor(2); tEff->Draw("P SAME"); gPad->Update(); gPad->Modified(); iNDetectedPoints = tEff->GetPassedHistogram()->Integral(); iNTotalPoints = tEff->GetTotalHistogram()->GetEntries(); dMeanEfficiency = 1.*iNDetectedPoints/iNTotalPoints; dMeanEfficiencyErrorLow = dMeanEfficiency - TEfficiency::ClopperPearson(iNTotalPoints, iNDetectedPoints, TMath::Erf(1./TMath::Sqrt2()), kFALSE); dMeanEfficiencyErrorUp = TEfficiency::ClopperPearson(iNTotalPoints, iNDetectedPoints, TMath::Erf(1./TMath::Sqrt2()), kTRUE) - dMeanEfficiency; cout<GetUxmin(), dMeanEfficiency, dSpillDuration, dMeanEfficiency); tLine->SetLineColor(2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); tCanvas->cd(13); tHisto2 = dynamic_cast(gROOT->FindObjectAny("hAllSelHitTupleMatchResidualXTIS")); tHisto = tHisto2->ProjectionX(); tHisto1 = tHisto2->ProjectionX("hAllSelHitTupleMatchResidualXTIS_pxx"); tHisto->SetTitle(Form("DUT-MRef;%s;global #color[1]{#mu}/#color[602]{#sigma}(#Deltax) [cm]", tHisto2->GetXaxis()->GetTitle())); tHisto->Reset("ICES"); tHisto1->Reset("ICES"); for(Int_t iTISBin = 1; iTISBin <= iNTISBins; iTISBin++) { TH1D* tProjection = tHisto2->ProjectionY("_py", iTISBin, iTISBin); if(tProjection->GetEntries()) { if(!static_cast(tProjection->Fit("gaus", "Q0", "", -dFitRangeDX04TIS.at(iTISBin - 1), dFitRangeDX04TIS.at(iTISBin - 1)))) { tHisto->SetBinContent(iTISBin, (tProjection->GetFunction("gaus"))->GetParameter("Sigma")); tHisto->SetBinError(iTISBin, (tProjection->GetFunction("gaus"))->GetParError(2)); tHisto1->SetBinContent(iTISBin, (tProjection->GetFunction("gaus"))->GetParameter("Mean")); tHisto1->SetBinError(iTISBin, (tProjection->GetFunction("gaus"))->GetParError(1)); } } delete tProjection; } tHisto->SetLineColor(kBlue + 2); tHisto->SetMarkerColor(kBlue + 2); tHisto->GetYaxis()->SetRangeUser(-1., 3.); tHisto->GetYaxis()->SetTitleOffset(1.25); tHisto->Draw("PE1"); gPad->Modified(); gPad->Update(); tLine = new TLine(gPad->GetUxmin(), tFitAllDX04->GetParameter(2), dSpillDuration, tFitAllDX04->GetParameter(2)); tLine->SetLineColor(2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); tLine = new TLine(gPad->GetUxmin(), tFitAllDX04->GetParameter(1), dSpillDuration, tFitAllDX04->GetParameter(1)); tLine->SetLineColor(2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); tHisto1->SetLineColor(kBlack); tHisto1->SetMarkerColor(kBlack); tHisto1->Draw("PE1 SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(14); tHisto2 = dynamic_cast(gROOT->FindObjectAny("hAllSelHitTupleMatchResidualYTIS")); tHisto = tHisto2->ProjectionX(); tHisto1 = tHisto2->ProjectionX("hAllSelHitTupleMatchResidualYTIS_pxx"); tHisto->SetTitle(Form("DUT-MRef;%s;global #color[1]{#mu}/#color[602]{#sigma}(#Deltay) [cm]", tHisto2->GetXaxis()->GetTitle())); tHisto->Reset("ICES"); tHisto1->Reset("ICES"); for(Int_t iTISBin = 1; iTISBin <= iNTISBins; iTISBin++) { TH1D* tProjection = tHisto2->ProjectionY("_py", iTISBin, iTISBin); if(tProjection->GetEntries()) { tProjection->Smooth(); if(!static_cast(tProjection->Fit("gaus", "Q0", "", -dFitRangeDY04TIS.at(iTISBin - 1), dFitRangeDY04TIS.at(iTISBin - 1)))) { tHisto->SetBinContent(iTISBin, (tProjection->GetFunction("gaus"))->GetParameter("Sigma")); tHisto->SetBinError(iTISBin, (tProjection->GetFunction("gaus"))->GetParError(2)); tHisto1->SetBinContent(iTISBin, (tProjection->GetFunction("gaus"))->GetParameter("Mean")); tHisto1->SetBinError(iTISBin, (tProjection->GetFunction("gaus"))->GetParError(1)); } } delete tProjection; } tHisto->SetLineColor(kBlue + 2); tHisto->SetMarkerColor(kBlue + 2); tHisto->GetYaxis()->SetRangeUser(-1., 3.); tHisto->GetYaxis()->SetTitleOffset(1.25); tHisto->Draw("PE1"); gPad->Modified(); gPad->Update(); tLine = new TLine(gPad->GetUxmin(), tFitAllDY04->GetParameter(2), dSpillDuration, tFitAllDY04->GetParameter(2)); tLine->SetLineColor(2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); tLine = new TLine(gPad->GetUxmin(), tFitAllDY04->GetParameter(1), dSpillDuration, tFitAllDY04->GetParameter(1)); tLine->SetLineColor(2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); tHisto1->SetLineColor(kBlack); tHisto1->SetMarkerColor(kBlack); tHisto1->Draw("PE1 SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(15); tHisto2 = dynamic_cast(gROOT->FindObjectAny("hAllSelHitTupleMatchResidualTTIS")); tHisto = tHisto2->ProjectionX(); tHisto1 = tHisto2->ProjectionX("hAllSelHitTupleMatchResidualTTIS_pxx"); tHisto->SetTitle(Form("DUT-MRef;%s;global #color[1]{#mu}/#color[602]{#sigma}(#Deltat) [ns]", tHisto2->GetXaxis()->GetTitle())); tHisto->Reset("ICES"); tHisto1->Reset("ICES"); for(Int_t iTISBin = 1; iTISBin <= iNTISBins; iTISBin++) { TH1D* tProjection = tHisto2->ProjectionY("_py", iTISBin, iTISBin); if(tProjection->GetEntries()) { if(!static_cast(tProjection->Fit("gaus", "Q0", "", -dFitRangeDT04TIS.at(iTISBin - 1), dFitRangeDT04TIS.at(iTISBin - 1)))) { tHisto->SetBinContent(iTISBin, (tProjection->GetFunction("gaus"))->GetParameter("Sigma")); tHisto->SetBinError(iTISBin, (tProjection->GetFunction("gaus"))->GetParError(2)); tHisto1->SetBinContent(iTISBin, (tProjection->GetFunction("gaus"))->GetParameter("Mean")); tHisto1->SetBinError(iTISBin, (tProjection->GetFunction("gaus"))->GetParError(1)); } } delete tProjection; } tHisto->SetLineColor(kBlue + 2); tHisto->SetMarkerColor(kBlue + 2); tHisto->GetYaxis()->SetRangeUser(-0.1, 0.15); tHisto->GetYaxis()->SetTitleOffset(1.25); tHisto->Draw("PE1"); gPad->Modified(); gPad->Update(); tLine = new TLine(gPad->GetUxmin(), tFitAllDT04->GetParameter(2), dSpillDuration, tFitAllDT04->GetParameter(2)); tLine->SetLineColor(2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); tLine = new TLine(gPad->GetUxmin(), tFitAllDT04->GetParameter(1), dSpillDuration, tFitAllDT04->GetParameter(1)); tLine->SetLineColor(2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); gPad->Update(); tHisto1->SetLineColor(kBlack); tHisto1->SetMarkerColor(kBlack); tHisto1->Draw("PE1 SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(16); tHisto2 = dynamic_cast(gROOT->FindObjectAny("hAllSelHitTupleDutCluSizeTIS")); tProfile = tHisto2->ProfileX(); tProfile->SetTitle(Form("DUT-MRef;%s;mean cluster size [cells]", tHisto2->GetXaxis()->GetTitle())); tProfile->SetLineColor(kBlue + 2); tProfile->SetMarkerColor(kBlue + 2); tProfile->GetYaxis()->SetRangeUser(1., 2.); tProfile->GetYaxis()->SetTitleOffset(1.25); tProfile->Draw("PE1"); tHisto2 = dynamic_cast(gROOT->FindObjectAny("hSelHitTupleDutCluSizeTIS")); tProfile = tHisto2->ProfileX(); tProfile->SetLineColor(kGreen + 2); tProfile->SetMarkerColor(kGreen + 2); tProfile->Draw("PE1 SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(17); tHisto2 = dynamic_cast(gROOT->FindObjectAny("hAllSelHitTupleDutToTTIS")); tProfile = tHisto2->ProfileX(); tProfile->SetTitle(Form("DUT-MRef;%s;mean average ToT [ns]", tHisto2->GetXaxis()->GetTitle())); tProfile->SetLineColor(kBlue + 2); tProfile->SetMarkerColor(kBlue + 2); tProfile->GetYaxis()->SetRangeUser(1., 3.); tProfile->GetYaxis()->SetTitleOffset(1.25); tProfile->Draw("PE1"); tHisto2 = dynamic_cast(gROOT->FindObjectAny("hSelHitTupleDutToTTIS")); tProfile = tHisto2->ProfileX(); tProfile->SetLineColor(kGreen + 2); tProfile->SetMarkerColor(kGreen + 2); tProfile->Draw("PE1 SAME"); gPad->Modified(); gPad->Update(); tCanvas->cd(12); TF1* tChiSqAccTheory = new TF1("tChiSqAccTheory", chi2cdf, 0., 30., 1); tChiSqAccTheory->SetParameter(0, 3); tChiSqAccTheory->SetNpx(1000000); tChiSqAccTheory->SetLineColor(2); tChiSqAccTheory->SetLineWidth(1); tHisto = dynamic_cast(gROOT->FindObjectAny("hAllChi204_copy")); // Int_t iNChiSqBins = tHisto->GetXaxis()->GetNbins(); Int_t iNChiSqBins = 300; std::vector dChiSqQuantilesTheory(iNChiSqBins); std::vector dChiSqQuantiles(iNChiSqBins); tEff = new TEfficiency("tChiSqAccReco", "; #chi^{2} limit []; #chi^{2} acceptance []", iNChiSqBins, // tHisto->GetXaxis()->GetXmin(), tHisto->GetXaxis()->GetXmax()); 0., 30.); tEff->SetTitle("DUT-MRef"); tEff->SetLineColor(kBlue + 2); tEff->SetMarkerColor(kBlue + 2); for(Int_t iChi2Bin = 1; iChi2Bin <= iNChiSqBins; iChi2Bin++) { Double_t dChiSqLim = tEff->GetTotalHistogram()->GetXaxis()->GetBinUpEdge(iChi2Bin); tEff->SetTotalEvents(iChi2Bin + 1, tHisto->GetEntries()); Int_t iPassedIntegral = static_cast(tHisto->Integral(1, tHisto->FindBin(dChiSqLim) - 1)); tEff->SetPassedEvents(iChi2Bin + 1, iPassedIntegral); dChiSqQuantilesTheory[iChi2Bin - 1] = ROOT::MathMore::chisquared_quantile(tEff->GetEfficiency(iChi2Bin), 3.); dChiSqQuantiles[iChi2Bin - 1] = dChiSqLim; } delete tHisto; gPad->SetGridx(); gPad->SetGridy(); tEff->Draw("AP"); gPad->Update(); gPad->Modified(); tEff->GetPaintedGraph()->GetYaxis()->SetRangeUser(0., 1.); tEff->GetPaintedGraph()->GetXaxis()->SetLimits(0., 30.); gPad->Modified(); tChiSqAccTheory->Draw("SAME"); tCanvas->cd(18); TGraph* tChiSqQQPlot = new TGraph(iNChiSqBins, dChiSqQuantilesTheory.data(), dChiSqQuantiles.data()); tChiSqQQPlot->SetTitle("DUT-MRef"); tChiSqQQPlot->GetXaxis()->SetTitle("#chi^{2} theory Q []"); tChiSqQQPlot->GetYaxis()->SetTitle("#chi^{2} reco Q []"); tChiSqQQPlot->SetMarkerStyle(21); tChiSqQQPlot->SetMarkerSize(0.5); tChiSqQQPlot->SetMarkerColor(kBlue + 2); tChiSqQQPlot->Draw("AP"); gPad->Update(); tChiSqQQPlot->SetMinimum(0.); tChiSqQQPlot->SetMaximum(10.); tChiSqQQPlot->GetXaxis()->SetLimits(0., 10.); gPad->Update(); gPad->Modified(); tLine = new TLine(0., 0., 10., 10.); tLine->SetLineColor(2); tLine->SetLineWidth(1); tLine->SetLineStyle(1); tLine->Draw("SAME"); tCanvas->cd(6); TPaveText* tPave = new TPaveText(gStyle->GetPadLeftMargin(), gStyle->GetPadBottomMargin(), 1. - gStyle->GetPadRightMargin(), 1. - gStyle->GetPadTopMargin(), "NB"); tPave->SetTextSizePixels(17); tPave->SetFillColor(kWhite); tPave->SetShadowColor(kWhite); tPave->AddText("Sel24 #chi^{2}-fit"); tPave->AddText(Form("#chi^{2}/ndf = %.3f / %d = %.3f", tChiSq24->GetChisquare(), tChiSq24->GetNDF(), tChiSq24->GetChisquare()/tChiSq24->GetNDF())); tPave->AddText("04 #chi^{2}-fit"); tPave->AddText(Form("#chi^{2}/ndf = %.3f / %d = %.3f", tChiSq04->GetChisquare(), tChiSq04->GetNDF(), tChiSq04->GetChisquare()/tChiSq04->GetNDF())); tEff = dynamic_cast(gROOT->FindObjectAny("hSelHitTupleMatchAcceptanceTIS")); tPave->AddText(Form("NN acceptance: %.0f / %.0f", tEff->GetPassedHistogram()->GetEntries(), tEff->GetTotalHistogram()->GetEntries())); tPave->AddLine(0., 1./5., 1., 1./5.); tPave->AddLine(0., 3./5., 1., 3./5.); tPave->Draw("NDC"); tCanvas->SaveAs("pl_over_TIS.pdf"); cout<GetParameter(2), tFitAllDX04->GetParError(2))<GetParameter(2), tFitAllDY04->GetParError(2))<GetParameter(2), 1000.*tFitAllDT04->GetParError(2))<