File indexing completed on 2024-04-06 12:22:42
0001
0002
0003
0004
0005 {
0006 inputFile1 = new TFile("BiasCheck_0.root", "READ");
0007 inputFile1->cd("MassVsEta");
0008 sigmaCanvas1 = (TCanvas*)gDirectory->Get("sigmaCanvas");
0009 sigmaHisto1 = (TH1D*)sigmaCanvas1->GetPrimitive("sigmaHisto");
0010 meanCanvas1 = (TCanvas*)gDirectory->Get("meanCanvas");
0011 meanHisto1 = (TH1D*)meanCanvas1->GetPrimitive("meanHisto");
0012
0013 inputFile = new TFile("BiasCheck_3.root", "READ");
0014 inputFile->cd("MassVsEta");
0015 sigmaCanvas = (TCanvas*)gDirectory->Get("sigmaCanvas");
0016 sigmaHisto = (TH1D*)sigmaCanvas->GetPrimitive("sigmaHisto");
0017 meanCanvas = (TCanvas*)gDirectory->Get("meanCanvas");
0018 meanHisto = (TH1D*)meanCanvas->GetPrimitive("meanHisto");
0019
0020 func = new TF1("linear", "[0] + [1]*x", 20., 82.);
0021 func->SetParameter(0, 3.09625);
0022 func->SetParameter(1, -0.0000380253);
0023
0024 expectedMeanHisto = (TH1D*)meanHisto->Clone("expectedMeanHisto");
0025
0026 std::cout << "NbinsX = " << meanHisto->GetNbinsX() << std::endl;
0027 for( int i=1; i<=meanHisto->GetNbinsX(); ++i ) {
0028 double sigma = sigmaHisto->GetBinContent(i);
0029 expectedMeanHisto->SetBinContent(i, 0);
0030 if( sigma != 0 ) {
0031 std::cout << "mean("<<i<<") = " << meanHisto->GetBinContent(i) << std::endl;
0032
0033 std::cout << "expected mean("<<i<<") = " << func->Eval(sigma*1000) << std::endl;
0034 expectedMeanHisto->SetBinContent(i, func->Eval(sigma*1000));
0035 expectedMeanHisto->SetBinError(i, 0);
0036 }
0037 }
0038
0039 newCanvas = new TCanvas("newCanvas", "newCanvas", 1000, 800);
0040 newCanvas->cd();
0041 newCanvas->Draw();
0042 meanHisto1->Draw();
0043 meanHisto->Draw("same");
0044 meanHisto->SetLineColor(2);
0045 expectedMeanHisto->SetMarkerColor(4);
0046 expectedMeanHisto->SetMarkerStyle(5);
0047 expectedMeanHisto->SetMarkerSize(5);
0048 expectedMeanHisto->SetLineColor(4);
0049 expectedMeanHisto->Draw("samep");
0050
0051 leg = new TLegend(0.1,0.7,0.48,0.9);
0052 leg->SetHeader("CrystalBall fit peak");
0053 leg->AddEntry(meanHisto1, "before correction", "l");
0054 leg->AddEntry(meanHisto, "after correction", "l");
0055 leg->AddEntry(expectedMeanHisto, "Expected from model", "p");
0056 leg->Draw("same");
0057
0058 meanHisto1->GetXaxis()->SetRangeUser(-2.4, 2.4);
0059 meanHisto1->GetYaxis()->SetRangeUser(3.088, 3.099);
0060 meanHisto1->GetXaxis()->SetTitle("muon #eta");
0061 meanHisto1->GetYaxis()->SetTitle("peak (GeV)");
0062 }