// ------------------------------------------------------- int plot(){ TGraphErrors* intrinsic, *full; TGraphErrors* Ratio; TCanvas* canvas[20]; TCanvas* canvas2[4]; TFile *file; TString fileName; for(int j=10; j<12; j++){ fileName.Form("c%i",j); canvas[j] = new TCanvas(fileName,fileName,0,0,500,500); canvas[j] ->cd(); char file1[100] = ""; char file2[100] = ""; fileName.Form("root_files/jet_energy_resolution_for_1_eta_bin_%i_pTGamma_bin_imbalance_PFCHS_mc.root",j+1); //fileName.Form("root_files/Scale_for_%i_eta_bin_PFCHS_mc.root",j+1); file = TFile::Open(fileName); file->GetObject("Graph",full); full -> SetMarkerColor(1); full -> SetLineColor(1); full -> GetFunction("fResolutionAlpha")->SetLineColor(3); full ->SetMaximum(0.12); full ->SetMinimum(0.00); full ->Draw("AP"); delete file; TLatex* info = new TLatex(); char legname[100] = {0}; info->SetTextFont(132); info-> SetNDC(); info->SetTextSize(0.040); sprintf(legname,"#Chi^{2} = %f",full->GetFunction("fResolutionAlpha")->GetChisquare()); info->DrawLatex(0.60,0.80,legname); delete info; info = new TLatex(); info->SetTextFont(132); info-> SetNDC(); info->SetTextSize(0.040); sprintf(legname,"ndof = %i",full->GetFunction("fResolutionAlpha")->GetNDF()); info->DrawLatex(0.60,0.70,legname); fileName.Form("jet_energy_resolution_imbalance_for_%i_pt_bin.pdf",j+1); canvas[j]->SaveAs(fileName); /* const int numEntries = 9; double xIntrinsic[numEntries] = {0}; double yIntrinsic[numEntries] = {0}; double xIntrinsicError[numEntries] = {0}; double yIntrinsicError[numEntries] = {0}; double xFull[numEntries] = {0}; double yFull[numEntries] = {0}; double xFullError[numEntries] = {0}; double yFullError[numEntries] = {0}; double x[numEntries] = {0}; double y[numEntries] = {0}; double xError[numEntries] = {0}; double yError[numEntries] = {0}; for(int i=0; i<numEntries; i++){ intrinsic -> GetPoint(i+0,xIntrinsic[i],yIntrinsic[i]); full -> GetPoint(i+0,xFull[i],yFull[i]); cout<<"xFull["<<i<<"] = "<<xFull[i]<<endl; cout<<"xIntrinsic["<<i<<"] = "<<xIntrinsic[i]<<endl; xIntrinsicError[i] = intrinsic -> GetErrorX(i+0); yIntrinsicError[i] = intrinsic -> GetErrorY(i+0); xFullError[i] = full -> GetErrorX(i+0); yFullError[i] = full -> GetErrorY(i+0); y[i] = yFull[i]/yIntrinsic[i] -1 ; x[i] = 1./2.*(xFull[i]+xIntrinsic[i]); yError[i] = TMath::Sqrt(TMath::Power((1./yIntrinsic[i]),2)*TMath::Power(yFullError[i],2)+TMath::Power((yFull[i]/(TMath::Power(yIntrinsic[i],2))),2)*TMath::Power(yIntrinsicError[i],2)); cout<<"y["<<i<<"] = "<<y[i]*100<<endl<<endl; cout<<"yError["<<i<<"] = "<<yError[i]*100<<endl<<endl; xError[i] = 1./2.*TMath::Sqrt(TMath::Power(xFullError[i],2)+TMath::Power(xIntrinsicError[i],2)); } fileName.Form("c2%i",j); canvas2[j] = new TCanvas(fileName,fileName,0,0,500,500); canvas2[j] ->cd(); Ratio = new TGraphErrors(numEntries,x,y,xError,yError); char titleName[100] = {0}; sprintf(titleName,"MCClosure - %s",file2); Ratio->SetTitle(titleName); Ratio-> GetYaxis()->SetTitle("JER/intrinsic -1"); Ratio->GetYaxis()->SetTitleOffset(1.5); Ratio->SetMarkerStyle(20); Ratio->SetMarkerSize(1.1); Ratio ->SetMaximum(0.1); Ratio ->SetMinimum(-0.1); Ratio->Draw("AP"); TF1* line = new TF1("line","0.",0,600); line->SetLineColor(2); line->Draw("same"); TLatex* info = new TLatex(); char legname[100] = {0}; info->SetTextFont(132); info-> SetNDC(); info->SetTextSize(0.040); sprintf(legname,"%i. eta Bin",j+1); info->DrawLatex(0.60,0.80,legname); fileName.Form("MCClosure_for_%i_eta_bin%s.pdf",j+1,file1); canvas2[j]->SaveAs(fileName); */ } return 0; }
drawMultiplicity(const char* infilename, const char* system, Int_t rWrite, Int_t rPerformance) { prepareAll(); TFile *f = new TFile(infilename, "read"); int minMultBin = 0; // 0, 2, 3 int maxMultBin = 6; // 2, 6, 8 double EvMultall = 0; for (int i = minMultBin; i < maxMultBin; i++) { if (i == minMultBin) TH1D* hEvMult =(TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i)); else hEvMult->Add((TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i))); EvMultall += ((TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i)))->GetEntries(); cout << "MultBin " << i << " " << ((TH1D*)f->Get(Form("EvMultcutPass%stpcM%i",system,i)))->GetEntries() << endl; //delete hEvMult; } cout << "Number of events (all bins): " << EvMultall << endl; TCanvas *c2 = new TCanvas("mult", "Event Multiplicity"); c2->SetGridx(); c2->SetGridy(); c2->SetFillColor(10); c2->SetLogy(); hEvMult->GetXaxis()->SetTitle("multiplicity"); hEvMult->GetYaxis()->SetTitle("number of events"); hEvMult->GetXaxis()->SetRangeUser(0,4000); hEvMult->Draw(""); if (rPerformance){ TLatex *alice = new TLatex(0.35,0.27,"Performance"); alice->SetNDC(); alice->SetTextColor(myDarkRed); alice->SetTextFont(42); alice->SetTextSize(0.05); alice->SetLineWidth(2); alice->Draw(); TLatex *alice2 = new TLatex(0.32,0.21,"LHC10h - Pass2"); alice2->SetNDC(); alice2->SetTextColor(myDarkRed); alice->SetTextFont(42); alice2->SetTextSize(0.05); alice2->SetLineWidth(2); alice2->Draw(); TText *date = new TText(0.38,0.15,cStamp2); date->SetNDC(); date->SetTextFont(42); date->SetTextSize(0.04); date->Draw(); //Acquire canvas proportions Double_t AliLogo_LowX = 0.37; Double_t AliLogo_LowY = 0.33; Double_t AliLogo_Height = 0.22; //ALICE logo is a png file that is 821x798 pixels->should be wider than a square Double_t AliLogo_Width = (821./798.) * AliLogo_Height * gPad->GetWh() / gPad->GetWw(); TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo",AliLogo_LowX,AliLogo_LowY,AliLogo_LowX+AliLogo_Width,AliLogo_LowY+AliLogo_Height); // myPadLogo->SetFillColor(2); // color to first figure out where is the pad then comment ! myPadSetUp(myPadLogo,0,0,0,0); //myPadLogo->SetFixedAspectRatio(1); myPadLogo->Draw(); myPadLogo->cd(); TASImage *myAliceLogo = new TASImage("alice_logo_transparent.png"); myAliceLogo->Draw(); } if (rWrite == 1) c2->SaveAs(Form("multiplicity%s.png",system)); if (rWrite == 2) c2->SaveAs(Form("multiplicity%s.eps",system)); }
void pi0MassFit(const int iMultOption = 0, const int iFitOption = 0, const float fitStart = 0.095, const float fitEnd = 0.175, const bool usePbPbData = true, const bool usepPbData = false, const bool useSimData = false) { // // iMultOption = 0, 1, 2, 3 controls the track multiplicity selection [120-150, 150-195, 185-220, 220-260] // iFitOption = 0 or 1 controls the background fitting choice as mixed event or linear parameterized background // bool goodDataSource = false; char *dataText = new char[200]; if(usePbPbData) { if(usepPbData || useSimData) { cerr << "\n Cannot only specify one data source as true" << endl; return; } goodDataSource = true; cout << "\n Using PbPbData source" << endl; sprintf(dataText, "CMS PbPb #sqrt{s_{NN}}=2.76 TeV"); } if(usepPbData) { if(usePbPbData || useSimData) { cerr << "\n Cannot only specify one data source as true" << endl; return; } goodDataSource = true; cout << "\n Using pPbData source" << endl; sprintf(dataText, "CMS pPb #sqrt{s_{NN}}=5.0 TeV"); } if(useSimData) { if(usePbPbData || usepPbData) { cerr << "\n Cannot only specify one data source as true" << endl; return; } goodDataSource = true; cout << "\n Using SimData source" << endl; sprintf(dataText, "HIJING PbPb #sqrt{s_{NN}}=2.76 TeV"); } if(!goodDataSource) { cerr << "\n The data source was not specified" << endl; return; } bool mixedEventBackgroundFit = true; if(iFitOption !=0 && iFitOption !=1) { cerr << "\n Invalid choice of iFitOption " << iFitOption << endl; return; } if(iFitOption == 0) { cout << "\n Using mixed-event background fitting" << endl; } TF1 *parameterizedBackgroundFit[4] = {0, 0, 0, 0}; TF1 *parameterizedBackground[4] = {0, 0, 0, 0}; if(iFitOption == 1) { mixedEventBackgroundFit = false; cout << "\n Using linear parameterized background fitting"; cout << "\n Start fit region at " << fitStart << ", end fit region at " << fitEnd; cout << endl; for(int kPt=0; kPt<4; kPt++) { char *fitName = new char[200]; sprintf(fitName, "parametrizedFit%d", kPt); parameterizedBackgroundFit[kPt] = new TF1(fitName, fitFunctionLinear, fitStart, fitEnd, 5); parameterizedBackgroundFit[kPt]->SetParName(0, "bkgConst"); parameterizedBackgroundFit[kPt]->SetParName(1, "bkgLin"); parameterizedBackgroundFit[kPt]->SetParName(2, "peakAmpl"); parameterizedBackgroundFit[kPt]->SetParName(3, "peakCent"); parameterizedBackgroundFit[kPt]->SetParName(4, "peakSigma"); parameterizedBackgroundFit[kPt]->SetParameters(-30., 2000., 1800., 0.134, 0.012); // initialized guesses for the fit sprintf(fitName, "parametrizedBackground%d", kPt); parameterizedBackground[kPt] = new TF1(fitName, fitFunctionLinear, fitStart, fitEnd, 2); // used for the background evaluation after the fits have been made parameterizedBackground[kPt]->SetParName(0, "bkgConst"); parameterizedBackground[kPt]->SetParName(1, "bkgLin"); } // assume 4 pT bins } // check on iFitOption = 1 TCanvas *c1 = new TCanvas("c1","",112,22,1019,540); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(0); c1->SetLeftMargin(0.2); c1->SetRightMargin(0.02325581); c1->SetBottomMargin(0.15); c1->SetFrameLineWidth(2); c1->SetFrameBorderMode(0); c1->Divide(4,2,0.0,0.0); Canvas(); TString _trueHistogramFile = "inputTrue.root"; TFile *_ftrueHistogram = new TFile(_trueHistogramFile, "r"); if(!_ftrueHistogram) { cerr << "\n Unable to find input histogram file " << _trueHistogramFile << endl; return; } char *multText = new char[10]; char *signalText = new char[100]; char *bkgText = new char[100]; char *multiplicityText = new char[200]; int lowMultiplicity = 120; int highMultiplicity = 150; bool goodMultOption = false; if(iMultOption == 0) { sprintf(multText, "EcalFlowNtpMult100"); goodMultOption = true; sprintf(multiplicityText, "120 #leq N_{track}^{offline} < 150"); } if(iMultOption == 1) { sprintf(multText, "EcalFlowNtpMult130"); lowMultiplicity = 150; highMultiplicity = 185; goodMultOption = true; sprintf(multiplicityText, "150 #leq N_{track}^{offline} < 185"); } if(iMultOption == 2) { sprintf(multText, "EcalFlowNtpMult160"); lowMultiplicity = 185; highMultiplicity = 220; goodMultOption = true; sprintf(multiplicityText, "185 #leq N_{track}^{offline} < 220"); } if(iMultOption == 3) { sprintf(multText, "EcalFlowNtpMult190"); lowMultiplicity = 220; highMultiplicity = 260; goodMultOption = true; sprintf(multiplicityText, "220 #leq N_{track}^{offline} < 260"); } if(goodMultOption) { sprintf(signalText, "%s/NeutralPions/pi0MassSameEventPtBin", multText); sprintf(bkgText, "%s/NeutralPions/pi0MassMixedEventPtBin", multText); } else { cerr << "\n Multiplicity option " << iMultOption << " is not valid" << endl; return; } char *histogramName = new char[200]; const int iRange = 10; TH1D *_mixedHisto[iRange]; TH1D *_trueHisto[iRange]; TH1D *pi0MassSubtracted[iRange]; TH1D *pi0MassMixedCopy[iRange]; TF1 *fitFcn[iRange]; float peakCentroid[iRange]; float peakCentroidError[iRange]; float peakWidth[iRange]; float peakWidthError[iRange]; float fMaxHistValue[iRange]; const int iFile=9; double _PeakRegion[iFile], _PeakRegionErr[iFile]; double _SideBand[iFile], _SideBandErr[iFile]; double v2Sig[iFile], v2SigErr[iFile]; char *_filePeakRegion = new char[200]; char *_fileSideBand = new char[200]; sprintf(_filePeakRegion, "PeakRegion_%dMult%d.txt", lowMultiplicity, highMultiplicity); sprintf(_fileSideBand, "SideBand_%dMult%d.txt", lowMultiplicity, highMultiplicity); ifstream PeakRegion; PeakRegion.open(_filePeakRegion, ifstream::in); if(!PeakRegion.is_open()) { cerr << "\n Unable to open peak region text file " << _filePeakRegion << endl; return; } // safety check int nPoints=0; if(PeakRegion.is_open()) { cout << "---< Reading peak region data points first >---" << _filePeakRegion <<endl; std::string line; while(std::getline(PeakRegion,line,'\n')) { double x,ex; sscanf(line.c_str(),"%lg %lg",&x,&ex); // res variable is not used _PeakRegion[nPoints] = x; _PeakRegionErr[nPoints] = ex; cout << "x=" << _PeakRegion[nPoints] << '\t' << "ex=" << _PeakRegionErr[nPoints] << endl; nPoints++; } } ifstream SideBand; SideBand.open(_fileSideBand, ifstream::in); if(!SideBand.is_open()) { cout << "\n Unable to open sideband text file " << _fileSideBand << endl; return; } // safety check int nPoints1=0; if(SideBand.is_open()) { cout << "---< Reading side band data points next >---" << _fileSideBand << endl; std::string line1; while(std::getline(SideBand,line1,'\n')) { double x1,ex1; sscanf(line1.c_str(),"%lg %lg",&x1,&ex1); // variable is not used _SideBand[nPoints1] = x1; _SideBandErr[nPoints1] = ex1; cout << "x=" << _SideBand[nPoints1] << '\t' << "ex=" << _SideBandErr[nPoints1]<<endl; nPoints1++; } } const int nMassBins = 200; const float lowFalsePairMassCut=0.200; const float highFalsePairMassCut=0.250; const float subtractedStart=0.06; const float subtractedEnd=0.20; const float maximumPi0MassForHistogram = 0.30; cout << "\n Fitting the foreground histograms" << endl; for(int iptBin=0; iptBin<8; iptBin++) { sprintf(histogramName, "%s%d", signalText, iptBin); _trueHisto[iptBin] = (TH1D*)_ftrueHistogram->Get(histogramName); if(!_trueHisto[iptBin]) { cerr << "\n For iptBin = " << iptBin << " unable to find " << histogramName << endl; return; } sprintf(histogramName, "%s%d", bkgText, iptBin); _mixedHisto[iptBin] = (TH1D*)_ftrueHistogram->Get(histogramName); if(!_mixedHisto[iptBin]) { cerr << "\n For iptBin = " << iptBin << " unable to find " << histogramName << endl; return; } } const float pTbins[11] = {0.7, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0, 8.0}; float histogramMaximumValue = _trueHisto[0]->GetMaximum(); const int iPad = 8; for(int nn=0; nn<iPad; nn++) { if(nn < 4){ c1->cd(nn+1); if(!_trueHisto[nn]) { cerr << "\n _trueHisto[nn] = " << _trueHisto[nn] << endl; return; } _trueHisto[nn]->SetTitle(""); _trueHisto[nn]->SetMarkerStyle(20); _trueHisto[nn]->SetMarkerSize(0.8); _trueHisto[nn]->SetMaximum(57000); _trueHisto[nn]->SetMinimum(-1087.21); _trueHisto[nn]->GetYaxis()->SetTitle("dN/dm_{#gamma#gamma} [MeV/c^{2}]^{-1}"); _trueHisto[nn]->GetYaxis()->SetNoExponent(); _trueHisto[nn]->GetYaxis()->SetLabelFont(42); _trueHisto[nn]->GetYaxis()->SetLabelSize(0.05); _trueHisto[nn]->GetYaxis()->SetTitleSize(0.08); _trueHisto[nn]->GetYaxis()->SetTitleFont(42); _trueHisto[nn]->GetYaxis()->SetTitleOffset(1.4); char name1[8]; sprintf(name1,"h2_%d",nn); pi0MassSubtracted[nn] = new TH1D(name1, "", nMassBins, 0.0, maximumPi0MassForHistogram); pi0MassSubtracted[nn]->SetMarkerStyle(20); pi0MassSubtracted[nn]->SetMarkerSize(0.8); pi0MassSubtracted[nn]->GetXaxis()->SetTitle("m_{#gamma#gamma} [GeV/c^{2}]"); pi0MassSubtracted[nn]->GetXaxis()->SetLabelFont(42); pi0MassSubtracted[nn]->GetXaxis()->SetLabelSize(0.05); pi0MassSubtracted[nn]->GetXaxis()->SetTitleSize(0.06); pi0MassSubtracted[nn]->GetXaxis()->SetTitleFont(42); pi0MassSubtracted[nn]->GetYaxis()->SetTitle("dN/dm_{#gamma#gamma} [MeV/c^{2}]^{-1}"); pi0MassSubtracted[nn]->GetYaxis()->SetLabelFont(42); pi0MassSubtracted[nn]->GetYaxis()->SetLabelSize(0.05); pi0MassSubtracted[nn]->GetYaxis()->SetTitleSize(0.07); pi0MassSubtracted[nn]->GetYaxis()->SetTitleOffset(1.4); pi0MassSubtracted[nn]->GetYaxis()->SetTitleFont(42); pi0MassSubtracted[nn]->GetZaxis()->SetLabelFont(42); pi0MassSubtracted[nn]->GetZaxis()->SetLabelSize(0.035); pi0MassSubtracted[nn]->GetZaxis()->SetTitleSize(0.035); pi0MassSubtracted[nn]->GetZaxis()->SetTitleFont(42); if(mixedEventBackgroundFit) { _trueHisto[nn]->Draw(); if(!_mixedHisto[nn]) { cerr << "\n _mixedHisto[nn] = " << _mixedHisto[nn] << endl; return; } cout << "\n _mixedHisto[nn] = " << _mixedHisto[nn] << endl; _mixedHisto[nn]->SetLineColor(kRed); _mixedHisto[nn]->SetLineWidth(2); char name[8]; sprintf(name,"h1_%d",nn); pi0MassMixedCopy[nn] = new TH1D(name,"", nMassBins, 0.0, maximumPi0MassForHistogram); pi0MassMixedCopy[nn]->GetYaxis()->SetTitle("dN/dm_{#gamma#gamma} [MeV/c^{2}]^{-1}"); pi0MassMixedCopy[nn]->GetYaxis()->SetNoExponent(); pi0MassMixedCopy[nn]->GetYaxis()->SetLabelFont(42); pi0MassMixedCopy[nn]->GetYaxis()->SetLabelSize(0.05); pi0MassMixedCopy[nn]->GetYaxis()->SetTitleSize(0.08); pi0MassMixedCopy[nn]->GetYaxis()->SetTitleFont(42); double sameEventCount = 0.0; double MixedEventCount = 0.0; // float MixedEventNormalizationFactor = 0.0; // not used // float MixedEventNormalizationErrorFactor = 0.0; // not used for(int kBin=1; kBin<nMassBins; kBin++) { double binCenter = _mixedHisto[nn]->GetBinCenter(kBin); if(binCenter >= lowFalsePairMassCut && binCenter <= highFalsePairMassCut) { sameEventCount += _trueHisto[nn]->GetBinContent(kBin); MixedEventCount += _mixedHisto[nn]->GetBinContent(kBin); } // check if mass bin is within the normalization region } // loop over mass bins if(MixedEventCount > 0.0 && sameEventCount > 0.0 ) { // background subtraction for unpartitioned yields double sameEventYield = 0.0; double sameEventYieldError = 0.0; double sameEventTotal = 0.0; double normalizationFactorMixed = sameEventCount/MixedEventCount; // MixedEventNormalizationFactor = normalizationFactorMixed; // not used // MixedEventNormalizationErrorFactor = sqrt(1.0/sameEventCount + 1.0/MixedEventCount); // not used for(int kBin=1; kBin<=nMassBins; kBin++) { double sameEventContent = _trueHisto[nn]->GetBinContent(kBin); double MixedEventContent = _mixedHisto[nn]->GetBinContent(kBin); double MixedEventFractionalErrorSquared = 0.0; if(MixedEventContent > 0.0) MixedEventFractionalErrorSquared = 1.0/MixedEventContent; double MixedEventNormalizedContent = normalizationFactorMixed*MixedEventContent; pi0MassMixedCopy[nn]->SetBinContent(kBin, MixedEventNormalizedContent); double combinedErrorSquared = sameEventContent + MixedEventNormalizedContent*MixedEventNormalizedContent*MixedEventFractionalErrorSquared; sameEventYieldError += combinedErrorSquared; double binCenter = _trueHisto[nn]->GetBinCenter(kBin); double sameEventSubtracted = sameEventContent - MixedEventNormalizedContent; double sameEventSubtractedError = sqrt(combinedErrorSquared); if(binCenter >= subtractedStart && binCenter <= subtractedEnd) { sameEventTotal += sameEventContent; sameEventYield += sameEventSubtracted; } if(sameEventContent > 0.0) { pi0MassSubtracted[nn]->SetBinContent(kBin, sameEventSubtracted); pi0MassSubtracted[nn]->SetBinError(kBin, sameEventSubtractedError); } // loop over mixed event histogram } // background subtraction for unpartitioned yields pi0MassMixedCopy[nn]->SetLineColor(kRed); pi0MassMixedCopy[nn]->GetXaxis()->SetTitle("#gamma#gamma Invariant mass (GeV/c^{2})"); pi0MassMixedCopy[nn]->Draw("same"); } // check non-zero same-event and mixed-event counts } // check on doing mixed-event background fit if(!mixedEventBackgroundFit) { char *fitName = new char[200]; sprintf(fitName, "parametrizedFit%d", nn); parameterizedBackgroundFit[nn]->SetLineColor(kBlue); _trueHisto[nn]->Fit(fitName, "", "", fitStart, fitEnd); float bkgConst = parameterizedBackgroundFit[nn]->GetParameter(0); float bkgLin = parameterizedBackgroundFit[nn]->GetParameter(1); peakCentroid[nn] = parameterizedBackgroundFit[nn]->GetParameter(3); peakCentroidError[nn] = parameterizedBackgroundFit[nn]->GetParError(3); peakWidth[nn] = parameterizedBackgroundFit[nn]->GetParameter(4); peakWidthError[nn] = parameterizedBackgroundFit[nn]->GetParError(4); parameterizedBackground[nn]->SetParameters(bkgConst, bkgLin); parameterizedBackground[nn]->SetLineColor(kRed);; parameterizedBackground[nn]->Draw("same"); for(int kBin=1; kBin<=nMassBins; kBin++) { double binCenter = _trueHisto[nn]->GetBinCenter(kBin); if(binCenter < fitStart || binCenter > fitEnd) { pi0MassSubtracted[nn]->SetBinContent(kBin, 0.0); pi0MassSubtracted[nn]->SetBinError(kBin, 0.0); } // check for mass value outside the fit range else { double sameEventContent = _trueHisto[nn]->GetBinContent(kBin); double sameEventError = _trueHisto[nn]->GetBinError(kBin); double calculatedBackground = parameterizedBackground[nn]->Eval(binCenter); double subtractedYield = sameEventContent - calculatedBackground; pi0MassSubtracted[nn]->SetBinContent(kBin, subtractedYield); pi0MassSubtracted[nn]->SetBinError(kBin, sameEventError); } // mass value within the fitted range } // loop over mass bins } // check on doing parameterized background fit if(nn==0){ c1->cd(nn+1); TLatex *tex = new TLatex(0.02, 0.9*histogramMaximumValue, dataText); tex->SetTextFont(42); tex->SetTextSize(0.06974556); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.02, 0.8*histogramMaximumValue,"|#eta|<1.5"); tex->SetTextFont(42); tex->SetTextSize(0.06974556); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.09, 0.20*histogramMaximumValue, multiplicityText); tex->SetTextFont(42); tex->SetTextSize(0.06974556); tex->SetLineWidth(2); tex->Draw(); TLatex *tex2 = new TLatex(0.08, 0.10*histogramMaximumValue, Form("%5.1f < p_{T} < %5.1f (GeV/c)",pTbins[nn],pTbins[nn+1])); tex2->SetTextFont(42); tex2->SetTextSize(0.06974556); tex2->SetLineWidth(2); tex2->Draw(); } if(nn>0){ TLatex *tex = new TLatex(0.014, 0.6*histogramMaximumValue ,Form("%5.1f < p_{T} < %5.1f (GeV/c)",pTbins[nn],pTbins[nn+1])); tex->SetTextFont(42); tex->SetTextSize(0.06974556); tex->SetLineWidth(2); tex->Draw(); } // check on upper left panel (c1->cd(nn+1))->SetGrid(); } // Check on < 4 condition (top set of plots) if(nn >=4 && nn<=7) { c1->cd(nn+1); cout<<"nn = "<<nn<<'\t'<<nn-4<<endl; fMaxHistValue[nn-4] = 2.0*pi0MassSubtracted[nn-4]->GetBinContent(pi0MassSubtracted[nn-4]->GetMaximumBin()); pi0MassSubtracted[nn-4]->SetMaximum(fMaxHistValue[nn-4]); pi0MassSubtracted[nn-4]->SetMinimum(-0.07*fMaxHistValue[nn-4]); float sumSubtractedYield = 0; float sumSubtractedError = 0.0; float backgroundYield = 0.0; float backgroundYieldError = 0.0; if(!mixedEventBackgroundFit) { float bkgConstError = parameterizedBackgroundFit[nn-4]->GetParError(0); float bkgLin = parameterizedBackgroundFit[nn-4]->GetParameter(1); float bkgLinError = fabs(parameterizedBackgroundFit[nn-4]->GetParError(1)); float bkgFractionalError = 0.0; if(bkgLin > 0.0) { bkgFractionalError = bkgLinError/bkgLin; } for(int kBin=1; kBin<=nMassBins; kBin++) { double binCenter = pi0MassSubtracted[nn-4]->GetBinCenter(kBin); if(binCenter >= fitStart && binCenter <= fitEnd) { sumSubtractedYield += pi0MassSubtracted[nn-4]->GetBinContent(kBin); double error = pi0MassSubtracted[nn-4]->GetBinError(kBin); sumSubtractedError += error*error; backgroundYield += parameterizedBackground[nn-4]->Eval(binCenter); double backgroundLinearError = bkgFractionalError*binCenter; backgroundYieldError += backgroundLinearError*backgroundLinearError; } // mass value within the fitted range } // loop over mass bins sumSubtractedError = sqrt(sumSubtractedError); backgroundYieldError = sqrt(backgroundYieldError + bkgConstError* bkgConstError); // according to the background fit parameter errors } // check on parameterized background fit if(mixedEventBackgroundFit) { char name2[100]; sprintf(name2,"fitFcn_%d",nn); fitFcn[nn-4] = new TF1(name2, gaussPeak, subtractedStart, subtractedEnd, 3); fitFcn[nn-4]->SetParName(0, "peak Amplitude"); fitFcn[nn-4]->SetParName(1, "peak Centroid"); fitFcn[nn-4]->SetParName(2, "peak Sigma"); fitFcn[nn-4]->SetParameters(13519, 0.135, 0.03); pi0MassSubtracted[nn-4]->Fit(name2, "", "", subtractedStart, subtractedEnd); fitFcn[nn-4]->SetLineColor(kRed); pi0MassSubtracted[nn-4]->Draw(); peakCentroid[nn-4] = fitFcn[nn-4]->GetParameter(1); peakCentroidError[nn-4] = fitFcn[nn-4]->GetParError(1); peakWidth[nn-4] = fabs(fitFcn[nn-4]->GetParameter(2)); peakWidthError[nn-4] = fitFcn[nn-4]->GetParError(2); } // check on mixed-event background fit char fName[200]; sprintf(fName, "Mass = %5.1f #pm %5.1f MeV", 1000.0*peakCentroid[nn-4], 1000.0*peakCentroidError[nn-4]); TLatex *tSB1 = new TLatex(0.04, 0.9*fMaxHistValue[nn-4], fName); tSB1->SetTextColor(4); tSB1->SetTextSize(0.055); tSB1->Draw(); char fName1[200]; sprintf(fName1, "Width = %5.1f #pm %5.1f MeV", 1000.0*peakWidth[nn-4], 1000.0*peakWidthError[nn-4]); TLatex *tSB2 = new TLatex(0.04, 0.8*fMaxHistValue[nn-4], fName1); tSB2->SetTextColor(4); tSB2->SetTextSize(0.055); tSB2->Draw(); TLine *line3 = new TLine(0.00,0.0,0.3,0.0); line3->SetLineColor(kGreen); line3->SetLineWidth(2); line3->Draw(); TLine *line2 = new TLine(peakCentroid[nn-4],0.0,peakCentroid[nn-4],fMaxHistValue[nn-4]/2.0); line2->SetLineWidth(2); line2->SetLineColor(kMagenta); line2->Draw(); if(mixedEventBackgroundFit) { // float subtractedYieldErrors = 0.0; float binLowForYield = peakCentroid[nn-4] - 2.0*peakWidth[nn-4]; float binHighForYield = peakCentroid[nn-4] + 2.0*peakWidth[nn-4]; for(int kBin=1; kBin<=nMassBins; kBin++) { double binCenter = pi0MassSubtracted[nn-4]->GetBinCenter(kBin); if(binCenter >= binLowForYield && binCenter <= binHighForYield) { sumSubtractedYield += pi0MassSubtracted[nn-4]->GetBinContent(kBin); backgroundYield += pi0MassMixedCopy[nn-4]->GetBinContent(kBin); double binError = pi0MassSubtracted[nn-4]->GetBinError(kBin); sumSubtractedError += binError*binError; } // check mass bin } // sum over mass bins sumSubtractedError = sqrt(sumSubtractedError); // float backgroundYieldError = MixedEventNormalizationErrorFactor* // MixedEventNormalizationErrorFactor*backgroundYield; // // the variable MixedEventNormalizationErrorFactor has not been defined for this code segment // float MixedEventNormalizationErrorFactor = 0.1; // guess at correct value backgroundYieldError = MixedEventNormalizationErrorFactor*backgroundYield; // // The subtractedYieldErrors variable is not used // // subtractedYieldErrors = sqrt(sumSubtractedError*sumSubtractedError + backgroundYieldError*backgroundYieldError); // } // check on doing mixedEvent background fitting char fName3[200]; sprintf(fName3, "Signal yield = %d #pm %d", int(sumSubtractedYield), int(sumSubtractedError)); TLatex *tSB3 = new TLatex(0.02, 0.72*fMaxHistValue[nn-4], fName3); tSB3->SetTextColor(4); tSB3->SetTextSize(0.050); tSB3->Draw(); char fName4[200]; sprintf(fName4, "Background yield = %d #pm %d", int(backgroundYield), int(backgroundYieldError)); TLatex *tSB4 = new TLatex(0.02, 0.64*fMaxHistValue[nn-4], fName4); tSB4->SetTextColor(4); tSB4->SetTextSize(0.050); tSB4->Draw(); char fName5[200]; sprintf(fName5, "S/(S+B) = %5.3f", (sumSubtractedYield/(sumSubtractedYield+backgroundYield))); TLatex *tSB5 = new TLatex(0.02, 0.54*fMaxHistValue[nn-4], fName5); tSB5->SetTextColor(kBlue); tSB5->SetTextSize(0.055); tSB5->Draw(); // float S_B = sumSubtractedYield/backgroundYield; // variable not used float FracSig = sumSubtractedYield/(sumSubtractedYield+backgroundYield); float FracBkg = 1-FracSig; float a0 = sumSubtractedYield; float c0 = sumSubtractedYield+backgroundYield; float b0 = backgroundYield; // float Db0 = backgroundYieldError; // variable not used float Da0 = sumSubtractedError; //Alternative method: double v2Signal1 = ((_PeakRegion[nn-4])*(c0/a0)) - ((_SideBand[nn-4])*(b0/a0)); double v2Obs = FracSig*_PeakRegion[nn-4] + FracBkg*_SideBand[nn-4]; double v2Signal = (v2Obs - FracBkg*_SideBand[nn-4])/FracSig; v2Sig[nn-4] = (v2Obs - FracBkg*_SideBand[nn-4])/FracSig; double TermI = (c0/a0)*(c0/a0)*_PeakRegionErr[nn-4]*_PeakRegionErr[nn-4]; double TermII = (b0/a0)*(b0/a0)*_SideBandErr[nn-4]*_SideBandErr[nn-4]; double TermIII = (_PeakRegion[nn-4] - _SideBand[nn-4])*(_PeakRegion[nn-4] - _SideBand[nn-4])*(c0/a0)*(c0/a0)*(Da0/a0)*(Da0/a0); double Error = TermI+TermII+TermIII; // double v2SigError = Error; double v2SigError = sqrt((_PeakRegionErr[nn-4]*_PeakRegionErr[nn-4]) + (FracBkg*FracBkg*_SideBandErr[nn-4]*_SideBandErr[nn-4]))/FracSig; v2SigErr[nn-4] = sqrt((_PeakRegionErr[nn-4]*_PeakRegionErr[nn-4]) + (FracBkg*FracBkg*_SideBandErr[nn-4]*_SideBandErr[nn-4]))/FracSig; cout<<"***********************************"<<endl; cout<<Form("%5.1f < p_{T} < %5.1f (GeV/c)",pTbins[nn-4],pTbins[nn-3])<<endl; cout<<"------------"<<nn-4<<"-------------"<<endl; cout<<_PeakRegionErr[nn-4]<<'\t'<<_SideBandErr[nn-4]<<endl; cout<<"a0 ="<<a0<<'\t'<<"b0 = "<<b0<<'\t'<<"c0 = "<<c0<<endl; cout<<"Term I = "<<TermI<<'\t'<<"Term II = "<<TermII<<endl; cout<<"******* pi0 v2 value = "<<v2Signal<<'\t'<<v2Signal1<<'\t'<<Error<<endl; cout<<"******* pi0 v2 value = "<<v2Sig[nn-4]<<endl; cout<<"********pi0 v2 error = "<<v2SigError<<endl; cout<<"********pi0 v2 error = "<<v2SigErr[nn-4]<<endl; cout<<"***********************************"<<endl; char fName6[200]; sprintf(fName6, "v_{2} = %4.3f #pm %4.3f",v2Signal, v2SigError ); TLatex *v2Text = new TLatex(0.15, 0.45*fMaxHistValue[nn-4], fName6); v2Text->SetTextColor(4); v2Text->SetTextSize(0.053); v2Text->Draw(); } // check for nn>=4 and nn<=7 } // loop over 8 panels return; cout<<"***********************************"<<endl; for(int nn=0; nn<4; nn++) { cout<<Form("%5.1f < p_{T} < %5.1f (GeV/c)",pTbins[nn],pTbins[nn+1])<<'\t'<<"v2 Signal = "<<v2Sig[nn]<<'\t'<<"v2 signal error = "<<v2SigErr[nn]<<endl; } cout<<"***********************************"<<endl; }
void cccPlot(int ndim) { float fitval[4], fiterrl[4], fiterrh[4]; for(int cha=0; cha<4; ++cha) { fiterrl[cha]=0; fiterrh[cha]=0; } gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TStyle *mystyle = RooHZZStyle("ZZ"); mystyle->cd(); stringstream file4mu,file4e,file2e2mu,filecomb; file4mu << "higgsCombineSCAN" << ndim << "D4muFast.MultiDimFit.mH125.8.root"; file4e << "higgsCombineSCAN" << ndim << "D4eFast.MultiDimFit.mH125.8.root"; file2e2mu << "higgsCombineSCAN" << ndim << "D2e2muFast.MultiDimFit.mH125.8.root"; filecomb << "higgsCombineSCAN" << ndim << "DcombFast.MultiDimFit.mH125.8.root"; TFile *fit4mu = TFile::Open(file4mu.str().c_str()); TTree *tree4mu = (TTree*)fit4mu->Get("limit"); TFile *fit4e = TFile::Open(file4e.str().c_str()); TTree *tree4e = (TTree*)fit4e->Get("limit"); TFile *fit2e2mu = TFile::Open(file2e2mu.str().c_str()); TTree *tree2e2mu = (TTree*)fit2e2mu->Get("limit"); TFile *fitcomb = TFile::Open(filecomb.str().c_str()); TTree *treecomb = (TTree*)fitcomb->Get("limit"); vector<TTree*> trees; trees.push_back(tree4mu); trees.push_back(tree4e); trees.push_back(tree2e2mu); trees.push_back(treecomb); for(int cha=0; cha<(int)trees.size(); ++cha) { cout << "Analyzing scan for channel = " << cha << endl; float MH; float deltaNLL; trees[cha]->SetBranchAddress("MH", &MH); trees[cha]->SetBranchAddress("deltaNLL", &deltaNLL); bool firstcross=false; bool secondcross=false; float prevStepMH=-1; for(int i=0; i<(int)trees[cha]->GetEntries();++i) { trees[cha]->GetEntry(i); if(i==0) fitval[cha]=MH; else { if(2*deltaNLL<1 && firstcross==false) { fiterrl[cha]=MH; firstcross=true; } if(2*deltaNLL>1 && firstcross==true && secondcross==false) { fiterrh[cha]=prevStepMH; secondcross=true; } prevStepMH=MH; } } } for(int cha=0; cha<4; ++cha) { fiterrl[cha]=fitval[cha]-fiterrl[cha]; fiterrh[cha]=fiterrh[cha]-fitval[cha]; // patch if the scan arrested too early if(fiterrh[cha]==(-fitval[cha])) fiterrh[cha]=fiterrl[cha]; } TLatex l; l.SetTextFont(43); l.SetNDC(); l.SetTextSize(25); TCanvas *c1 = new TCanvas("c1","",750,750); c1->SetLeftMargin(0.4); c1->SetGridx(1); int nChann = 3; TH2F frame("frame",";best fit m_{X} (GeV);",1,122,132,nChann,0,nChann); TGraphAsymmErrors points(nChann); for (int cha=0; cha<3; ++cha) { TString channame(""); if (cha==0) channame+=" 4#mu"; if (cha==1) channame+=" 4e"; if (cha==2) channame+=" 2e2#mu"; points.SetPoint(cha, fitval[cha], cha+0.5); points.SetPointError(cha, fiterrl[cha], fiterrh[cha], 0, 0); frame.GetYaxis()->SetBinLabel(cha+1, channame); } points.SetLineColor(kRed); points.SetLineWidth(3); points.SetMarkerStyle(21); frame.GetXaxis()->SetNdivisions(5,kFALSE); frame.GetXaxis()->SetTitleSize(0.05); frame.GetXaxis()->SetLabelSize(0.04); frame.GetYaxis()->SetLabelSize(0.06); frame.Draw(); gStyle->SetOptStat(0); TBox globalFitBand(fitval[3]-fiterrl[3], 0, fitval[3]+fiterrh[3], nChann); globalFitBand.SetFillStyle(3013); globalFitBand.SetFillColor(65); globalFitBand.SetLineStyle(0); globalFitBand.DrawClone(); TLine globalFitLine(fitval[3], 0, fitval[3], nChann); globalFitLine.SetLineWidth(4); globalFitLine.SetLineColor(214); globalFitLine.DrawClone(); points.Draw("P SAME"); if(ndim==1) l.DrawLatex(0.45, 0.90, Form("H #rightarrow ZZ, 1D")); if(ndim==2) l.DrawLatex(0.45, 0.90, Form("H #rightarrow ZZ, 2D")); if(ndim==3) l.DrawLatex(0.45, 0.90, Form("H #rightarrow ZZ, 3D")); stringstream outnamepdf; outnamepdf << "bestfit_bychannel_" << ndim << "D.pdf"; c1->SaveAs(outnamepdf.str().c_str()); stringstream outnamepng; outnamepng << "bestfit_bychannel_" << ndim << "D.png"; c1->SaveAs(outnamepng.str().c_str()); }
void drawSpectra2D(const TString configFile, const TString inputFile, const TString outputFile, const TString outputFigureName) { std::cout<<"running drawSpectra2D()"<<std::endl; std::cout<<"configFile = "<< configFile.Data() <<std::endl; std::cout<<"inputFile = "<< inputFile.Data() <<std::endl; std::cout<<"outputFile = "<< outputFile.Data() <<std::endl; InputConfiguration configInput = InputConfigurationParser::Parse(configFile.Data()); CutConfiguration configCuts = CutConfigurationParser::Parse(configFile.Data()); if (!configInput.isValid) { std::cout << "Input configuration is invalid." << std::endl; std::cout << "exiting" << std::endl; return; } if (!configCuts.isValid) { std::cout << "Cut configuration is invalid." << std::endl; std::cout << "exiting" << std::endl; return; } /* * drawing behavior : * 1. If N = # formulas and N = # selections, then N histograms will be drawn, * 2. If 1 = # formulas and N = # selections, then N histograms will be drawn with the same formula. * 3. If N = # formulas and 1 = # selections, then N histograms will be drawn with the same selection. * 4. else, exit. */ // input for mode int mode = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_mode]; // input for TTree std::vector<std::string> treePaths = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_treePath]); std::vector<std::string> treeFriendsPath = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_treeFriendPath]); std::vector<std::string> treeFriendsPathIndividual = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_treeFriendPathIndividual]); std::vector<std::string> formulas = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_treeFormula]); std::string selectionBase = configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_treeSelectionBase]; std::vector<std::string> selections = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_treeSelection]); std::vector<std::string> selectionSplitter = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_treeSelectionSplitter]); std::vector<std::string> weights = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_TH1_weight]); // input for TH1 std::vector<std::string> titles = ConfigurationParser::ParseList(ConfigurationParser::ParseLatex(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_TH1_title])); std::vector<std::string> titlesX = ConfigurationParser::ParseList(ConfigurationParser::ParseLatex(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_TH1_titleX])); std::vector<std::string> titlesY = ConfigurationParser::ParseList(ConfigurationParser::ParseLatex(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_TH1_titleY])); // nBinsx, xLow, xUp, nBinsy, yLow, yUp for a TH2D histogram std::vector<std::vector<float>> TH2D_Bins_List = ConfigurationParser::ParseListTH2D_Bins(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_TH2D_Bins_List]); float titleOffsetX = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_titleOffsetX]; float titleOffsetY = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_titleOffsetY]; float markerSize = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_markerSize]; int drawNormalized = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_drawNormalized]; std::vector<std::string> drawOptions = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_drawOption]); std::vector<std::string> markerStyles = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_markerStyle]); std::vector<std::string> lineStyles = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_lineStyle]); std::vector<std::string> fillStyles = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_fillStyle]); std::vector<std::string> colors = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_color]); std::vector<std::string> fillColors = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_fillColor]); std::vector<std::string> lineColors = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_lineColor]); int lineWidth = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_lineWidth]; // input for TLegend std::vector<std::string> legendEntryLabels = ConfigurationParser::ParseList(ConfigurationParser::ParseLatex(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_legendEntryLabel])); std::string legendPosition = configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_legendPosition]; float legendOffsetX = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_legendOffsetX]; float legendOffsetY = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_legendOffsetY]; int legendBorderSize = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_legendBorderSize]; float legendWidth = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_legendWidth]; float legendHeight = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_legendHeight]; float legendTextSize = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_legendTextSize]; // input for text objects std::string tmpText = ConfigurationParser::ParseLatex(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_text]); std::vector<std::string> textLines = ConfigurationParser::ParseList(tmpText); int textFont = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_textFont]; float textSize = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_textSize]; std::string textPosition = configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_textPosition]; float textOffsetX = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_textOffsetX]; float textOffsetY = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_textOffsetY]; std::string tmpTextOverPad = ConfigurationParser::ParseLatex(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_textAbovePad]); std::vector<std::string> textsOverPad = ConfigurationParser::ParseList(tmpTextOverPad); std::vector<std::string> textsOverPadAlignments = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_textAbovePadAlign]); int textAbovePadFont = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_textAbovePadFont]; float textAbovePadSize = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_textAbovePadSize]; float textAbovePadOffsetX = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_textAbovePadOffsetX]; float textAbovePadOffsetY = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_textAbovePadOffsetY]; // input for TLine // y-axis positions of the horizontal lines to be drawn std::vector<float> TLines_horizontal = ConfigurationParser::ParseListFloat(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_TLine_horizontal]); std::vector<std::string> lineStyles_horizontal = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_LineStyle_horizontal]); // x-axis positions of the vertical lines to be drawn std::vector<float> TLines_vertical = ConfigurationParser::ParseListFloat(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_TLine_vertical]); std::vector<std::string> lineStyles_vertical = ConfigurationParser::ParseList(configInput.proc[INPUT::kPERFORMANCE].s[INPUT::k_LineStyle_vertical]); // input for TCanvas int windowWidth = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_windowWidth]; int windowHeight = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_windowHeight]; float leftMargin = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_leftMargin]; float rightMargin = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_rightMargin]; float bottomMargin = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_bottomMargin]; float topMargin = configInput.proc[INPUT::kPERFORMANCE].f[INPUT::k_topMargin]; int setLogx = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_setLogx]; int setLogy = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_setLogy]; int setLogz = configInput.proc[INPUT::kPERFORMANCE].i[INPUT::k_setLogz]; // set default values if (selections.size() == 0) selections.push_back("1"); if (weights.size() == 0) weights.push_back(INPUT_DEFAULT::TH1_weight.c_str()); // default weight = 1. if (titleOffsetX == 0) titleOffsetX = INPUT_DEFAULT::titleOffsetX; if (titleOffsetY == 0) titleOffsetY = INPUT_DEFAULT::titleOffsetY; if (drawNormalized >= INPUT_TH1::kN_TYPE_NORM) drawNormalized = INPUT_DEFAULT::drawNormalized; if (lineWidth == 0) lineWidth = INPUT_DEFAULT::lineWidth; if (markerSize == 0) markerSize = INPUT_DEFAULT::markerSize; if (textFont == 0) textFont = INPUT_DEFAULT::textFont; if (textSize == 0) textSize = INPUT_DEFAULT::textSize; if (windowWidth == 0) windowWidth = INPUT_DEFAULT::windowWidth; if (windowHeight == 0) windowHeight = INPUT_DEFAULT::windowHeight; if (leftMargin == 0) leftMargin = INPUT_DEFAULT::leftMargin; if (rightMargin == 0) rightMargin = INPUT_DEFAULT::rightMargin; if (bottomMargin == 0) bottomMargin = INPUT_DEFAULT::bottomMargin; if (topMargin == 0) topMargin = INPUT_DEFAULT::topMargin; int nTrees = treePaths.size(); int nFriends = treeFriendsPath.size(); int nFriendsIndividual = treeFriendsPathIndividual.size(); int nFormulas = formulas.size(); int nSelections = selections.size(); int nSelectionSplitter = selectionSplitter.size(); int nWeights = weights.size(); int nTitles = titles.size(); int nTitlesX = titlesX.size(); int nTitlesY = titlesY.size(); int nTH2D_Bins_List = TH2D_Bins_List[0].size(); int nDrawOptions = drawOptions.size(); int nMarkerStyles = markerStyles.size(); int nLineStyles = lineStyles.size(); int nFillStyles = fillStyles.size(); int nColors = colors.size(); int nFillColors = fillColors.size(); int nLineColors = lineColors.size(); int nLegendEntryLabels = legendEntryLabels.size(); int nTextLines = textLines.size(); int nTextsOverPad = textsOverPad.size(); int nTextsOverPadAlignments = textsOverPadAlignments.size(); int nTLines_horizontal = TLines_horizontal.size(); int nLineStyles_horizontal = lineStyles_horizontal.size(); int nTLines_vertical = TLines_vertical.size(); int nLineStyles_vertical = lineStyles_vertical.size(); // verbose about input configuration std::cout<<"Input Configuration :"<<std::endl; std::cout << "mode = " << mode << std::endl; if (mode == INPUT_MODE::k_comparison) { // in comparison mode "inputFile" should have the following format // inputFile = <inputFile1>,<inputFile2>,... // there should be no single space between <inputFile1> and <inputFile2>. // the idea is to feed the input samples as a single argument and split them in the macro. std::cout << "comparison mode : Spectra from two input samples are going to be compared." << std::endl; } std::cout << "nTrees = " << nTrees << std::endl; for (int i=0; i<nTrees; ++i) { std::cout << Form("treePaths[%d] = %s", i, treePaths.at(i).c_str()) << std::endl; } std::cout << "nFriends = " << nFriends << std::endl; for (int i=0; i<nFriends; ++i) { std::cout << Form("treeFriendsPath[%d] = %s", i, treeFriendsPath.at(i).c_str()) << std::endl; } std::cout << "nFriendsIndividual = " << nFriendsIndividual << std::endl; for (int i=0; i<nFriendsIndividual; ++i) { std::cout << Form("treeFriendsPathIndividual[%d] = %s", i, treeFriendsPathIndividual.at(i).c_str()) << std::endl; } std::cout << "nFormulas = " << nFormulas << std::endl; for (int i=0; i<nFormulas; ++i) { std::cout << Form("formulas[%d] = %s", i, formulas.at(i).c_str()) << std::endl; } std::cout << "selectionBase = " << selectionBase.c_str() << std::endl; std::cout << "nSelections = " << nSelections << std::endl; for (int i=0; i<nSelections; ++i) { std::cout << Form("selections[%d] = %s", i, selections.at(i).c_str()) << std::endl; } std::cout << "nSelectionSplitter = " << nSelectionSplitter << std::endl; for (int i=0; i<nSelectionSplitter; ++i) { std::cout << Form("selectionSplitter[%d] = %s", i, selectionSplitter.at(i).c_str()) << std::endl; } std::cout << "nWeights = " << nWeights << std::endl; for (int i=0; i<nWeights; ++i) { std::cout << Form("weights[%d] = %s", i, weights.at(i).c_str()) << std::endl; } std::cout << "nTitles = " << nTitles << std::endl; for (int i=0; i<nTitles; ++i) { std::cout << Form("titles[%d] = %s", i, titles.at(i).c_str()) << std::endl; } std::cout << "nTitlesX = " << nTitlesX << std::endl; for (int i=0; i<nTitlesX; ++i) { std::cout << Form("titlesX[%d] = %s", i, titlesX.at(i).c_str()) << std::endl; } std::cout << "nTitlesY = " << nTitlesY << std::endl; for (int i=0; i<nTitlesY; ++i) { std::cout << Form("titlesY[%d] = %s", i, titlesY.at(i).c_str()) << std::endl; } std::cout << "nTH2D_Bins_List = " << nTH2D_Bins_List << std::endl; for (int i=0; i<nTH2D_Bins_List; ++i) { std::cout << Form("TH2D_Bins_List[%d] = { ", i); std::cout << Form("%.0f, ", TH2D_Bins_List[0].at(i)); std::cout << Form("%f, ", TH2D_Bins_List[1].at(i)); std::cout << Form("%f }", TH2D_Bins_List[2].at(i)); std::cout << " { "; std::cout << Form("%.0f, ", TH2D_Bins_List[3].at(i)); std::cout << Form("%f, ", TH2D_Bins_List[4].at(i)); std::cout << Form("%f }", TH2D_Bins_List[5].at(i)) << std::endl;; } std::cout << "titleOffsetX = " << titleOffsetX << std::endl; std::cout << "titleOffsetY = " << titleOffsetY << std::endl; std::cout << "markerSize = " << markerSize << std::endl; std::cout << "drawNormalized = " << drawNormalized << std::endl; std::cout << "nDrawOptions = " << nDrawOptions << std::endl; for (int i = 0; i<nDrawOptions; ++i) { std::cout << Form("drawOptions[%d] = %s", i, drawOptions.at(i).c_str()) << std::endl; } std::cout << "nMarkerStyles = " << nMarkerStyles << std::endl; for (int i = 0; i<nMarkerStyles; ++i) { std::cout << Form("markerStyles[%d] = %s", i, markerStyles.at(i).c_str()) << std::endl; } std::cout << "nLineStyles = " << nLineStyles << std::endl; for (int i = 0; i<nLineStyles; ++i) { std::cout << Form("lineStyles[%d] = %s", i, lineStyles.at(i).c_str()) << std::endl; } std::cout << "nFillStyles = " << nFillStyles << std::endl; for (int i = 0; i<nFillStyles; ++i) { std::cout << Form("fillStyles[%d] = %s", i, fillStyles.at(i).c_str()) << std::endl; } std::cout << "nColors = " << nColors << std::endl; for (int i = 0; i<nColors; ++i) { std::cout << Form("colors[%d] = %s", i, colors.at(i).c_str()) << std::endl; } std::cout << "nFillColors = " << nFillColors << std::endl; for (int i = 0; i<nFillColors; ++i) { std::cout << Form("fillColors[%d] = %s", i, fillColors.at(i).c_str()) << std::endl; } std::cout << "nLineColors = " << nLineColors << std::endl; for (int i = 0; i<nLineColors; ++i) { std::cout << Form("lineColors[%d] = %s", i, lineColors.at(i).c_str()) << std::endl; } std::cout << "lineWidth = " << lineWidth << std::endl; std::cout << "nLegendEntryLabels = " << nLegendEntryLabels << std::endl; for (int i = 0; i<nLegendEntryLabels; ++i) { std::cout << Form("legendEntryLabels[%d] = %s", i, legendEntryLabels.at(i).c_str()) << std::endl; } if (nLegendEntryLabels > 0) { std::cout << "legendPosition = " << legendPosition.c_str() << std::endl; if (legendPosition.size() == 0) std::cout<< "No position is provided, legend will not be drawn." <<std::endl; std::cout << "legendOffsetX = " << legendOffsetX << std::endl; std::cout << "legendOffsetY = " << legendOffsetY << std::endl; std::cout << "legendBorderSize = " << legendBorderSize << std::endl; std::cout << "legendWidth = " << legendWidth << std::endl; std::cout << "legendHeight = " << legendHeight << std::endl; std::cout << "legendTextSize = " << legendTextSize << std::endl; } std::cout << "nTextLines = " << nTextLines << std::endl; for (int i = 0; i<nTextLines; ++i) { std::cout << Form("textLines[%d] = %s", i, textLines.at(i).c_str()) << std::endl; } if (nTextLines > 0) { std::cout << "textFont = " << textFont << std::endl; std::cout << "textSize = " << textSize << std::endl; std::cout << "textPosition = " << textPosition << std::endl; std::cout << "textOffsetX = " << textOffsetX << std::endl; std::cout << "textOffsetY = " << textOffsetY << std::endl; } std::cout << "nTextsOverPad = " << nTextsOverPad << std::endl; for (int i = 0; i<nTextsOverPad; ++i) { std::cout << Form("textsOverPad[%d] = %s", i, textsOverPad.at(i).c_str()) << std::endl; } if (nTextsOverPad > 0) { std::cout << "nTextsOverPadAlignments = " << nTextsOverPadAlignments << std::endl; for (int i = 0; i<nTextsOverPadAlignments; ++i) { std::cout << Form("textsOverPadAlignments[%d] = %s", i, textsOverPadAlignments.at(i).c_str()) << std::endl; } std::cout << "textAbovePadFont = " << textAbovePadFont << std::endl; std::cout << "textAbovePadSize = " << textAbovePadSize << std::endl; std::cout << "textAbovePadOffsetX = " << textAbovePadOffsetX << std::endl; std::cout << "textAbovePadOffsetY = " << textAbovePadOffsetY << std::endl; } std::cout << "nTLines_horizontal = " << nTLines_horizontal << std::endl; for (int i = 0; i<nTLines_horizontal; ++i) { std::cout << Form("TLines_horizontal[%d] = %f", i, TLines_horizontal.at(i)) << std::endl; } if (nTLines_horizontal > 0) { std::cout << "nLineStyles_horizontal = " << nLineStyles_horizontal << std::endl; for (int i = 0; i<nLineStyles_horizontal; ++i) { std::cout << Form("lineStyles_horizontal[%d] = %s", i, lineStyles_horizontal.at(i).c_str()) << std::endl; } } std::cout << "nTLines_vertical = " << nTLines_vertical << std::endl; for (int i = 0; i<nTLines_vertical; ++i) { std::cout << Form("TLines_vertical[%d] = %f", i, TLines_vertical.at(i)) << std::endl; } if (nTLines_vertical > 0) { std::cout << "nLineStyles_vertical = " << nLineStyles_vertical << std::endl; for (int i = 0; i<nLineStyles_vertical; ++i) { std::cout << Form("lineStyles_vertical[%d] = %s", i, lineStyles_vertical.at(i).c_str()) << std::endl; } } std::cout << "windowWidth = " << windowWidth << std::endl; std::cout << "windowHeight = " << windowHeight << std::endl; std::cout << "leftMargin = " << leftMargin << std::endl; std::cout << "rightMargin = " << rightMargin << std::endl; std::cout << "bottomMargin = " << bottomMargin << std::endl; std::cout << "topMargin = " << topMargin << std::endl; std::cout << "setLogx = " << setLogx << std::endl; std::cout << "setLogy = " << setLogy << std::endl; std::cout << "setLogz = " << setLogz << std::endl; // cut configuration // verbose about cut configuration std::cout<<"Cut Configuration :"<<std::endl; std::cout<<"Input handling :"<< std::endl; std::vector<std::string> inputFileArguments = InputConfigurationParser::ParseFileArgument(inputFile.Data()); int nInputFileArguments = inputFileArguments.size(); // if no mode is specified (which is what happens most of the time), then it is expected that nInputFileArguments = 1. std::cout<<"nInputFileArguments (number of input file arguments) = "<< nInputFileArguments << std::endl; for (int i = 0; i < nInputFileArguments; ++i) { std::cout << Form("inputFileArguments[%d] = %s", i, inputFileArguments.at(i).c_str()) << std::endl; } std::vector<std::vector<std::string>> inputFiles(nInputFileArguments); std::cout<<"#####"<< std::endl; for (int i = 0; i < nInputFileArguments; ++i) { if (nInputFileArguments > 1) { std::cout<<"###"<< std::endl; std::cout<<"inputFileArgument = " << inputFileArguments.at(i).c_str() << std::endl; } inputFiles[i] = InputConfigurationParser::ParseFiles(inputFileArguments.at(i)); std::cout<<"input ROOT files : num = " << inputFiles[i].size() << std::endl; for (std::vector<std::string>::iterator it = inputFiles[i].begin() ; it != inputFiles[i].end(); ++it) { std::cout<<(*it).c_str()<< std::endl; } } std::cout<<"##### END #####"<< std::endl; // check consistency of the input file arguments with the mode if (mode == INPUT_MODE::k_noMode && nInputFileArguments > 1) { std::cout<<"no specific mode is chosen. more than one input samples are provided."<< std::endl; std::cout<<"exiting"<< std::endl; return; } if (mode == INPUT_MODE::k_comparison && nInputFileArguments == 1) { std::cout<<"comparison mode is chosen. But only one input sample is provided."<< std::endl; std::cout<<"exiting"<< std::endl; return; } if (nTrees == 1 && nFriendsIndividual > 0) { std::cout<<"nTrees = "<< nTrees <<", nFriendsIndividual = " << nFriendsIndividual << std::endl; std::cout<<"There is only one tree to be plotted, it does not make sense to use individual friend trees."<< std::endl; std::cout<<"exiting"<< std::endl; return; } else if (nTrees > 1 && nFriendsIndividual > 0 && nTrees != nFriendsIndividual) { std::cout<<"nTrees = "<< nTrees <<", nFriendsIndividual = " << nFriendsIndividual << std::endl; std::cout<<"exiting"<< std::endl; return; } if (nSelectionSplitter == 1) { std::cout << "nSelectionSplitter = "<< nSelectionSplitter << std::endl; std::cout << "selectionSplitter has been set to have exactly one selection"<< std::endl; std::cout << "selectionSplitter is allowed to be either empty or to have more than one selections"<< std::endl; std::cout << "exiting"<< std::endl; return; } int nSplits = 1; if (nSelectionSplitter > 1) nSplits = nSelectionSplitter; int nSelectionsTot = nSelections * nSplits; int nFormulasTot = nFormulas * nSplits; TH1::SetDefaultSumw2(); int nHistos = nFormulasTot; if (nFormulas == 1 && nSelections > nFormulas) nHistos = nSelectionsTot; else if (nFormulas == 1 && nSelections == 1 && nTrees > nFormulas) nHistos = nTrees * nSplits; else if (nFormulas > 1 && nSelections > 1 && nFormulas != nSelections) { std::cout << "mismatch of number of formulas and number of selections"<< std::endl; std::cout << "nHistos = "<< nHistos << std::endl; std::cout << "nSelections = "<< nSelections << std::endl; std::cout << "exiting " << std::endl; return; } else if (nFormulas > 1 && nTrees > 1 && nFormulas != nTrees) { std::cout << "mismatch of number of formulas and number of trees"<< std::endl; std::cout << "nHistos = "<< nHistos << std::endl; std::cout << "nTrees = "<< nTrees << std::endl; std::cout << "exiting " << std::endl; return; } else if (nSelections > 1 && nTrees > 1 && nSelections != nTrees) { std::cout << "mismatch of number of selections and number of trees"<< std::endl; std::cout << "nHistos = "<< nHistos << std::endl; std::cout << "nSelections = "<< nSelections << std::endl; std::cout << "nTrees = "<< nTrees << std::endl; std::cout << "exiting " << std::endl; return; } TFile* output = TFile::Open(outputFile.Data(),"RECREATE"); output->cd(); int nHistosInput = nHistos/nSplits; // number of histograms without considering selectionSplitter std::cout << "nHistos = " << nHistos << std::endl; TH2D* h[nHistos]; for (int i=0; i<nHistos; ++i) { int nBinsx = (int)TH2D_Bins_List[0].at(0); float xLow = TH2D_Bins_List[1].at(0); float xUp = TH2D_Bins_List[2].at(0); int nBinsy = (int)TH2D_Bins_List[3].at(0); float yLow = TH2D_Bins_List[4].at(0); float yUp = TH2D_Bins_List[5].at(0); if (nTH2D_Bins_List == nHistosInput) { nBinsx = (int)TH2D_Bins_List[0].at(i%nTH2D_Bins_List); xLow = TH2D_Bins_List[1].at(i%nTH2D_Bins_List); xUp = TH2D_Bins_List[2].at(i%nTH2D_Bins_List); nBinsy = (int)TH2D_Bins_List[3].at(i%nTH2D_Bins_List); yLow = TH2D_Bins_List[4].at(i%nTH2D_Bins_List); yUp = TH2D_Bins_List[5].at(i%nTH2D_Bins_List); } std::string title = ""; if (nTitles == 1) { if (titles.at(0).compare(CONFIGPARSER::nullInput) != 0) title = titles.at(0).c_str(); } else if (nTitles == nHistosInput) { if (titles.at(i%nTitles).compare(CONFIGPARSER::nullInput) != 0) title = titles.at(i%nTitles).c_str(); } else if (nTitles == nHistos) { if (titles.at(i).compare(CONFIGPARSER::nullInput) != 0) title = titles.at(i).c_str(); } std::string titleX = ""; if (nTitlesX == 1) titleX = titlesX.at(0).c_str(); else if (nTitlesX == nHistosInput) titleX = titlesX.at(i%nTitlesX).c_str(); else if (nTitlesX == nHistos) titleX = titlesX.at(i).c_str(); std::string titleY = ""; if (nTitlesY == 1) titleY = titlesY.at(0).c_str(); else if (nTitlesY == nHistosInput) titleY = titlesY.at(i%nTitlesY).c_str(); else if (nTitlesY == nHistos) titleY = titlesY.at(i).c_str(); h[i] = new TH2D(Form("h2D_%d", i),Form("%s;%s;%s", title.c_str(), titleX.c_str(), titleY.c_str()), nBinsx, xLow, xUp, nBinsy, yLow, yUp); } // if no mode is specified (which is what happens most of the time), then it is expected that nInputFileArguments = 1. // so in that case : 1.) the "TTree*" objects below are effectively 1D, not 2D. 2.) the loops below have effective depth 1, not 2. TTree* trees[nTrees][nInputFileArguments]; TTree* treeFriends[nFriends][nInputFileArguments]; TTree* treeFriendsIndividual[nFriendsIndividual][nInputFileArguments]; TTree* treeHiForestInfo[nInputFileArguments]; Long64_t entries[nInputFileArguments]; Long64_t entriesSelected[nHistos]; std::fill_n(entriesSelected, nHistos, 0); int nFiles[nInputFileArguments]; TFile* fileTmp = 0; std::cout << "initial reading to get the number of entries (if there is only one input file) and HiForest info" << std::endl; for (int iInFileArg = 0; iInFileArg < nInputFileArguments; ++iInFileArg) { nFiles[iInFileArg] = inputFiles[iInFileArg].size(); if (nInputFileArguments > 1) { std::cout <<"iInFileArg = " << iInFileArg << " , "<< std::endl; } // read the first file only to get the HiForest info std::string inputPath = inputFiles[iInFileArg].at(0).c_str(); fileTmp = new TFile(inputPath.c_str(), "READ"); bool treeExists = true; if (nFiles[iInFileArg] == 1) { // read one tree only to get the number of entries trees[0][iInFileArg] = (TTree*)fileTmp->Get(treePaths.at(0).c_str()); if (!trees[0][iInFileArg]) { std::cout << "tree is not found in the path : "<< treePaths.at(0).c_str() <<". skipping file." << std::endl; treeExists = false; } if (treeExists) { entries[iInFileArg] = trees[0][iInFileArg]->GetEntries(); std::cout << "entries = " << entries[iInFileArg] << std::endl; } } if (treeExists) { treeHiForestInfo[0] = (TTree*)fileTmp->Get("HiForest/HiForestInfo"); if (!treeHiForestInfo[0]) { std::cout << "HiForest/HiForestInfo tree is not found." << std::endl; treeExists = false; } if (treeExists) { HiForestInfoController hfic(treeHiForestInfo[0]); if (iInFileArg == 0) std::cout<<"### HiForestInfo Tree ###"<< std::endl; else std::cout<<"### HiForestInfo Tree, input "<< iInFileArg+1 << " ###" << std::endl; hfic.printHiForestInfo(); std::cout<<"###"<< std::endl; } } fileTmp->Close(); } std::cout << "TTree::Draw()" <<std::endl; for (int iInFileArg = 0; iInFileArg < nInputFileArguments; ++iInFileArg) { if (nInputFileArguments > 1) { std::cout <<"iInFileArg = " << iInFileArg << std::endl; } entries[iInFileArg] = 0; for (int iFile = 0; iFile < nFiles[iInFileArg]; ++iFile) { std::string inputPath = inputFiles[iInFileArg].at(iFile).c_str(); std::cout <<"iFile = " << iFile << " , " ; std::cout <<"reading input file : " << inputPath.c_str() << std::endl; fileTmp = new TFile(inputPath.c_str(), "READ"); // check if the file is usable, if not skip the file. if (isGoodFile(fileTmp) != 0) { std::cout << "File is not good. skipping file." << std::endl; continue; } bool treeExists = true; for (int i=0; i<nTrees; ++i) { trees[i][iInFileArg] = (TTree*)fileTmp->Get(treePaths.at(i).c_str()); if (!trees[i][iInFileArg]) { std::cout << "tree is not found in the path : "<< treePaths.at(i).c_str() <<". skipping file." << std::endl; treeExists = false; } } for (int i=0; i<nFriends; ++i) { treeFriends[i][iInFileArg] = (TTree*)fileTmp->Get(treeFriendsPath.at(i).c_str()); if (!treeFriends[i][iInFileArg]) { std::cout << "tree is not found in the path : "<< treeFriendsPath.at(i).c_str() <<". skipping file." << std::endl; treeExists = false; } } if (!treeExists) continue; // add friends for (int i=0; i<nTrees; ++i) { for (int j=0; j<nFriends; ++j) { trees[i][iInFileArg]->AddFriend(treeFriends[j][iInFileArg], Form("t%d", j)); } } for (int i=0; i < nFriendsIndividual; ++i) { if (treeFriendsPathIndividual.at(i).compare(CONFIGPARSER::nullInput) != 0) { treeFriendsIndividual[i][iInFileArg] = (TTree*)fileTmp->Get(treeFriendsPathIndividual.at(i).c_str()); } } if (nFriendsIndividual > 0) { for (int i=0; i<nTrees; ++i) { if (treeFriendsPathIndividual.at(i).compare(CONFIGPARSER::nullInput) != 0) { trees[i][0]->AddFriend(treeFriendsIndividual[i][0], Form("tSelf%d", i)); } } } Long64_t entriesTmp = trees[0][iInFileArg]->GetEntries(); // assume all the trees have same number of entries entries[iInFileArg] += entriesTmp; if (nInputFileArguments == 1) { std::cout << "entries in File = " << entriesTmp << std::endl; } else { std::cout << Form("entries[%d] = ", iInFileArg) << entriesTmp << std::endl; } output->cd(); for (int i=0; i<nHistos; ++i) { int treeIndex = 0; if (nHistosInput == nTrees) treeIndex = i%nTrees; // std::cout << "treePath = " << treePaths.at(treeIndex).c_str() << ", "; int iInFileArg = 0; if (mode == INPUT_MODE::k_comparison) { iInFileArg = i%nInputFileArguments; std::cout << "iInFileArg = " << iInFileArg << ", "; } std::string formula = formulas.at(0).c_str(); std::string selection = selections.at(0).c_str(); std::string weight = weights.at(0).c_str(); if (nHistosInput == nFormulas) formula = formulas.at(i%nFormulas).c_str(); if (nHistosInput == nSelections) selection = selections.at(i%nSelections).c_str(); if (nHistosInput == nWeights) weight = weights.at(i%nWeights).c_str(); std::string selectionSplit = ""; if (nSelectionSplitter > 1) selectionSplit = selectionSplitter.at(i/ (nHistos/nSelectionSplitter)).c_str(); // std::cout << "drawing histogram i = " << i << ", "; TCut selectionFinal = selectionBase.c_str(); selectionFinal = selectionFinal && selection.c_str(); if (selectionSplit.size() > 0) selectionFinal = selectionFinal && selectionSplit.c_str(); Long64_t entriesSelectedTmp = trees[treeIndex][iInFileArg]->GetEntries(selectionFinal.GetTitle()); // std::cout << "entriesSelected in file = " << entriesSelectedTmp << std::endl; entriesSelected[i] += entriesSelectedTmp; TCut weight_AND_selection = Form("(%s)*(%s)", weight.c_str(), selectionFinal.GetTitle()); trees[treeIndex][iInFileArg]->Draw(Form("%s >>+ %s", formula.c_str(), h[i]->GetName()), weight_AND_selection.GetTitle(), "goff"); } fileTmp->Close(); } } std::cout << "TTree::Draw() ENDED" <<std::endl; for (int i = 0; i < nInputFileArguments; ++i) { if (nInputFileArguments == 1) { std::cout << "entries = " << entries[0] << std::endl; } else { std::cout << Form("entries[%d] = ", i) << entries[i] << std::endl; } } std::cout << "### selected entries" << std::endl; for (int i = 0; i < nHistos; ++i) { std::cout << "TH1D i = " << i << ", "; int treeIndex = 0; if (nHistosInput == nTrees) treeIndex = i%nTrees; std::cout << "treePath = " << treePaths.at(treeIndex).c_str() << ", "; std::cout << "entriesSelected = " << entriesSelected[i] << std::endl; } std::cout << "###" << std::endl; // print info about histograms for (int i=0; i<nHistos; ++i) { std::cout << "#####" << std::endl; std::cout << Form("h[%d]", i) << std::endl; std::string summary = summaryTH1(h[i]); std::cout << summary.c_str() << std::endl; } output->cd(); TH2D* h_normInt[nHistos]; TH2D* h_normEvents[nHistos]; for (int i=0; i<nHistos; ++i) { h[i]->Write(); h_normInt[i] = (TH2D*)h[i]->Clone(Form("%s_normInt", h[i]->GetName())); h_normInt[i]->Scale(1./h[i]->Integral()); h_normInt[i]->Write(); h_normEvents[i] = (TH2D*)h[i]->Clone(Form("%s_normEvents", h[i]->GetName())); h_normEvents[i]->Scale(1./entriesSelected[i]); h_normEvents[i]->Write(); } // histograms are written. After this point changes to the histograms will not be reflected in the output ROOT file. // set the style of the histograms for canvases to be written for (int i=0; i<nHistos; ++i) { h[i]->SetTitleOffset(titleOffsetX,"X"); h[i]->SetTitleOffset(titleOffsetY,"Y"); h_normInt[i]->SetTitleOffset(titleOffsetX,"X"); h_normInt[i]->SetTitleOffset(titleOffsetY,"Y"); h_normEvents[i]->SetTitleOffset(titleOffsetX,"X"); h_normEvents[i]->SetTitleOffset(titleOffsetY,"Y"); // default marker style and color h[i]->SetMarkerStyle(kFullCircle); h[i]->SetMarkerColor(kBlack); h_normInt[i]->SetMarkerStyle(kFullCircle); h_normInt[i]->SetMarkerColor(kBlack); h_normEvents[i]->SetMarkerStyle(kFullCircle); h_normEvents[i]->SetMarkerColor(kBlack); // no stats box in the final plots h[i]->SetStats(false); h_normInt[i]->SetStats(false); h_normEvents[i]->SetStats(false); } // write canvases TCanvas* c; for (int i=0; i<nHistos; ++i) { c = new TCanvas(Form("cnv_%d",i),"",windowWidth,windowHeight); c->SetTitle(h[i]->GetTitle()); setCanvasMargin(c, leftMargin, rightMargin, bottomMargin, topMargin); setCanvasFinal(c, setLogx, setLogy, setLogz); c->cd(); h[i]->SetTitleOffset(titleOffsetX,"X"); h[i]->SetTitleOffset(titleOffsetY,"Y"); h[i]->SetStats(false); h[i]->Draw("colz"); c->Write(); c->Close(); // do not use Delete() for TCanvas. // normalized to 1. c = new TCanvas(Form("cnv_%d_normInt",i),"",windowWidth,windowHeight); c->SetTitle(h_normInt[i]->GetTitle()); setCanvasMargin(c, leftMargin, rightMargin, bottomMargin, topMargin); setCanvasFinal(c, setLogx, setLogy, setLogz); c->cd(); h_normInt[i]->SetTitleOffset(titleOffsetX,"X"); h_normInt[i]->SetTitleOffset(titleOffsetY,"Y"); h_normInt[i]->SetStats(false); h_normInt[i]->Draw("colz"); c->Write(); c->Close(); // do not use Delete() for TCanvas. // normalized by number of events c = new TCanvas(Form("cnv_%d_normEvents",i),"",windowWidth,windowHeight); c->SetTitle(h_normEvents[i]->GetTitle()); setCanvasMargin(c, leftMargin, rightMargin, bottomMargin, topMargin); setCanvasFinal(c, setLogx, setLogy, setLogz); c->cd(); h_normEvents[i]->SetTitleOffset(titleOffsetX,"X"); h_normEvents[i]->SetTitleOffset(titleOffsetY,"Y"); h_normEvents[i]->SetStats(false); h_normEvents[i]->Draw("colz"); c->Write(); c->Close(); // do not use Delete() for TCanvas. } // canvases are written. // set style of the histograms for the canvases to be saved as picture for(int i=0; i<nHistos; ++i) { std::string drawOption = "colz"; if (nDrawOptions == 1) { if (drawOptions.at(0).compare(CONFIGPARSER::nullInput) != 0) drawOption = drawOptions.at(0).c_str(); } else if (nDrawOptions == nHistosInput) { if (drawOptions.at(i).compare(CONFIGPARSER::nullInput) != 0) drawOption = drawOptions.at(i%nDrawOptions).c_str(); } // https://root.cern.ch/doc/master/classTObject.html#abe2a97d15738d5de00cd228e0dc21e56 // TObject::SetDrawOption() is not suitable for the approach here. int markerStyle = GRAPHICS::markerStyle; if (nMarkerStyles == 1) markerStyle = GraphicsConfigurationParser::ParseMarkerStyle(markerStyles.at(0)); else if (nMarkerStyles == nHistosInput) markerStyle = GraphicsConfigurationParser::ParseMarkerStyle(markerStyles.at(i%nMarkerStyles)); h[i]->SetMarkerStyle(markerStyle); h_normInt[i]->SetMarkerStyle(markerStyle); h_normEvents[i]->SetMarkerStyle(markerStyle); int lineStyle = GRAPHICS::lineStyle; if (nLineStyles == 1) lineStyle = GraphicsConfigurationParser::ParseLineStyle(lineStyles.at(0)); else if (nLineStyles == nHistosInput) lineStyle = GraphicsConfigurationParser::ParseLineStyle(lineStyles.at(i%nLineStyles)); h[i]->SetLineStyle(lineStyle); h_normInt[i]->SetLineStyle(lineStyle); h_normEvents[i]->SetLineStyle(lineStyle); int fillStyle = GRAPHICS::fillStyle; if (nFillStyles == 1) fillStyle = GraphicsConfigurationParser::ParseLineStyle(fillStyles.at(0)); else if (nFillStyles == nHistosInput) fillStyle = GraphicsConfigurationParser::ParseLineStyle(fillStyles.at(i%nFillStyles)); h[i]->SetFillStyle(fillStyle); h_normInt[i]->SetFillStyle(fillStyle); h_normEvents[i]->SetFillStyle(fillStyle); int color = GRAPHICS::colors[i]; if (nColors == 1) color = GraphicsConfigurationParser::ParseColor(colors.at(0)); else if (nColors == nHistosInput) color = GraphicsConfigurationParser::ParseColor(colors.at(i%nColors)); h[i]->SetMarkerColor(color); h[i]->SetLineColor(color); h_normInt[i]->SetMarkerColor(color); h_normInt[i]->SetLineColor(color); h_normEvents[i]->SetMarkerColor(color); h_normEvents[i]->SetLineColor(color); int fillColor = -1; if (nFillColors == 1) fillColor = GraphicsConfigurationParser::ParseColor(fillColors.at(0)); else if (nFillColors == nHistosInput) fillColor = GraphicsConfigurationParser::ParseColor(fillColors.at(i%nFillColors)); if (fillColor != -1) { h[i]->SetFillColor(fillColor); h_normInt[i]->SetFillColor(fillColor); h_normEvents[i]->SetFillColor(fillColor); } int lineColor = -1; if (nLineColors == 1) lineColor = GraphicsConfigurationParser::ParseColor(lineColors.at(0)); else if (nLineColors == nHistosInput) lineColor = GraphicsConfigurationParser::ParseColor(lineColors.at(i%nLineColors)); if (nLineColors != -1) { h[i]->SetLineColor(lineColor); h_normInt[i]->SetLineColor(lineColor); h_normEvents[i]->SetLineColor(lineColor); } if(lineWidth != INPUT_DEFAULT::lineWidth) { if (drawOption.find("hist") != std::string::npos) { h[i]->SetLineWidth(lineWidth); h_normInt[i]->SetLineWidth(lineWidth); h_normEvents[i]->SetLineWidth(lineWidth); } } h[i]->SetMarkerSize(markerSize); h_normInt[i]->SetMarkerSize(markerSize); h_normEvents[i]->SetMarkerSize(markerSize); } TH1D* h_draw[nHistos]; for (int i=0; i<nHistos; ++i) { if (drawNormalized == INPUT_TH1::k_normInt) { h_draw[i] = (TH1D*)h_normInt[i]->Clone(Form("h_%d_draw", i)); } else if (drawNormalized == INPUT_TH1::k_normEvents) { h_draw[i] = (TH1D*)h_normEvents[i]->Clone(Form("h_%d_draw", i)); } else { // no normalization h_draw[i] = (TH1D*)h[i]->Clone(Form("h_%d_draw", i)); } } for (int i = 0; i<nHistos; ++i) { c = new TCanvas(Form("cnv_drawSpectra2D_%d", i),"",windowWidth,windowHeight); setCanvasMargin(c, leftMargin, rightMargin, bottomMargin, topMargin); setCanvasFinal(c, setLogx, setLogy, setLogz); c->cd(); TLegend* leg = new TLegend(); std::string drawOption = ""; if (nDrawOptions == 1) drawOption = drawOptions.at(0).c_str(); else if (nDrawOptions == nHistosInput) drawOption = drawOptions.at(i%nDrawOptions).c_str(); h_draw[i]->Draw(drawOption.c_str()); if (nLegendEntryLabels == nHistosInput) { std::string label = legendEntryLabels.at(i%nLegendEntryLabels).c_str(); std::string legendOption = "lpf"; if (drawOption.find("hist") != std::string::npos) legendOption = "lf"; if (label.compare(CONFIGPARSER::nullInput) != 0) leg->AddEntry(h_draw[i], label.c_str(), legendOption.c_str()); } if (legendTextSize != 0) leg->SetTextSize(legendTextSize); leg->SetBorderSize(legendBorderSize); double height = calcTLegendHeight(leg); double width = calcTLegendWidth(leg); if (legendHeight != 0) height = legendHeight; if (legendWidth != 0) width = legendWidth; if (legendPosition.size() > 0) { // draw the legend if really a position is provided. setLegendPosition(leg, legendPosition, c, height, width, legendOffsetX, legendOffsetY); leg->Draw(); } // add Text TLatex* latex = 0; if (nTextLines > 0) { latex = new TLatex(); latex->SetTextFont(textFont); latex->SetTextSize(textSize); setTextAlignment(latex, textPosition); std::vector<std::pair<float,float>> textCoordinates = calcTextCoordinates(textLines, textPosition, c, textOffsetX, textOffsetY); for (int i = 0; i<nTextLines; ++i) { float x = textCoordinates.at(i).first; float y = textCoordinates.at(i).second; latex->DrawLatexNDC(x, y, textLines.at(i).c_str()); } } // add Text above the pad TLatex* latexOverPad = 0; if (nTextsOverPad > 0) { latexOverPad = new TLatex(); latexOverPad->SetTextFont(textAbovePadFont); latexOverPad->SetTextSize(textAbovePadSize); for (int i = 0; i < nTextsOverPad; ++i) { int textOverPadAlignment = GRAPHICS::textAlign; if (nTextsOverPadAlignments == 1) textOverPadAlignment = GraphicsConfigurationParser::ParseTextAlign(textsOverPadAlignments.at(0)); else if (nTextsOverPadAlignments == nTextsOverPad) textOverPadAlignment = GraphicsConfigurationParser::ParseTextAlign(textsOverPadAlignments.at(i)); latexOverPad->SetTextAlign(textOverPadAlignment); setTextAbovePad(latexOverPad, c, textAbovePadOffsetX, textAbovePadOffsetY); latexOverPad->DrawLatexNDC(latexOverPad->GetX(), latexOverPad->GetY(), textsOverPad.at(i).c_str()); } } // add TLine TLine* line_horizontal[nTLines_horizontal]; for (int iLine = 0; iLine<nTLines_horizontal; ++iLine) { // draw horizontal line double xmin = h[i]->GetXaxis()->GetBinLowEdge(h[i]->GetXaxis()->GetFirst()); double xmax = h[i]->GetXaxis()->GetBinLowEdge(h[i]->GetXaxis()->GetLast()+1); int lineStyle_horizontal = GRAPHICS::lineStyle_horizontal; if (nLineStyles_horizontal == 1) lineStyle_horizontal = GraphicsConfigurationParser::ParseLineStyle(lineStyles_horizontal.at(0)); else if (nLineStyles_horizontal == nTLines_horizontal) lineStyle_horizontal = GraphicsConfigurationParser::ParseLineStyle(lineStyles_horizontal.at(iLine)); line_horizontal[iLine] = new TLine(xmin, TLines_horizontal.at(iLine), xmax, TLines_horizontal.at(iLine)); line_horizontal[iLine]->SetLineStyle(lineStyle_horizontal); // https://root.cern.ch/doc/master/TAttLine_8h.html#a7092c0c4616367016b70d54e5c680a69 line_horizontal[iLine]->Draw(); } // add TLine TLine* line_vertical[nTLines_vertical]; for (int iLine = 0; iLine<nTLines_vertical; ++iLine) { // draw vertical line double ymin = h[i]->GetYaxis()->GetBinLowEdge(h[i]->GetYaxis()->GetFirst()); double ymax = h[i]->GetYaxis()->GetBinLowEdge(h[i]->GetYaxis()->GetLast()+1); int lineStyle_vertical = GRAPHICS::lineStyle_vertical; if (nLineStyles_vertical == 1) lineStyle_vertical = GraphicsConfigurationParser::ParseLineStyle(lineStyles_vertical.at(0)); else if (nLineStyles_vertical == nTLines_vertical) lineStyle_vertical = GraphicsConfigurationParser::ParseLineStyle(lineStyles_vertical.at(iLine)); line_vertical[iLine] = new TLine(TLines_vertical.at(iLine), ymin, TLines_vertical.at(iLine), ymax); line_vertical[iLine]->SetLineStyle(lineStyle_vertical); // https://root.cern.ch/doc/master/TAttLine_8h.html#a7092c0c4616367016b70d54e5c680a69 line_vertical[iLine]->Draw(); } c->Write(); // save histograms as picture if a figure name is provided. // for now 2D canvases are not drawn on top, they are drawn separately. if (!outputFigureName.EqualTo("")) { std::string tmpOutputFigureName = outputFigureName.Data(); if (tmpOutputFigureName.find(".") != std::string::npos) { // file extension is specified if (nHistos > 1) { // modify outputFile name // if i=1, then "output.ext" becomes "output_2.ext" size_t pos = tmpOutputFigureName.find_last_of("."); tmpOutputFigureName.replace(pos,1, Form("_%d.", i+1)); } c->SaveAs(tmpOutputFigureName.c_str()); } else { // file extension is NOT specified if (nHistos > 1) { // modify outputFile name // if i=1, then "output" becomes "output_2" tmpOutputFigureName = Form("%s_%d", tmpOutputFigureName.c_str(), i+1); } c->SaveAs(Form("%s.C", tmpOutputFigureName.c_str())); c->SaveAs(Form("%s.png", tmpOutputFigureName.c_str())); c->SaveAs(Form("%s.pdf", tmpOutputFigureName.c_str())); } } leg->Delete(); c->Close(); } output->Close(); }
void Draw(const int &rebin=1) { Color_t _sampleColor[nSamples]; //_sampleColor[iHWW ] = kRed+1; //_sampleColor[iWW ] = kAzure-9; //_sampleColor[iZJets] = kGreen+2; //_sampleColor[iZTau] = kGreen+2; //_sampleColor[iTop ] = kYellow; //_sampleColor[iWZ ] = kAzure-2; //_sampleColor[iWJets] = kGray+1; //_sampleColor[iWJets] = kViolet-9; //_sampleColor[iWJets] = kCyan; _sampleColor[itH ] = kRed; _sampleColor[iWZ ] = kAzure-9; _sampleColor[iZZ ] = kAzure-5; _sampleColor[iWW ] = kAzure-1; _sampleColor[itt ] = kGray; _sampleColor[ittw ] = kOrange+7; _sampleColor[ittz ] = kOrange+1; _sampleColor[iwww ] = kSpring+9; _sampleColor[iwwz ] = kSpring+3; _sampleColor[iwzz ] = kSpring-7; _sampleColor[idyl ] = kViolet-1; _sampleColor[idy ] = kViolet-1; //setUpStyle(); if(!gPad) new TCanvas(); THStack* hstack = new THStack(); for (int i=0; i<nSamples; i++) { // in case the user doesn't set it if( !_hist[i] ) continue; _hist[i]->Rebin(rebin); _hist[i]->SetLineColor(_sampleColor[i]); // signal gets overlaid if (i == itH) continue; _hist[i]->SetFillColor(_sampleColor[i]); _hist[i]->SetFillStyle(1001); hstack->Add(_hist[i]); } if(_hist[itH]) _hist[itH]->SetLineWidth(3); if(_data) _data->Rebin(rebin); if(_data) _data->SetLineColor (kBlack); if(_data) _data->SetMarkerStyle(kFullCircle); if(_nostack) { for(int ihist=0;ihist<(int)_hist.size();ihist++) { _hist[ihist]->SetFillStyle(0); _hist[ihist]->SetLineWidth(2); } hstack->Draw("hist,nostack"); if(_hist[itH]) _hist[itH]->Draw("hist,same"); if(_data) _data->Draw("ep,same"); } else { hstack->Draw("hist"); if(_hist[itH]) _hist[itH]->Draw("hist,same"); if(_data) _data->Draw("ep,same"); } //hstack->SetTitle("CMS preliminary"); Float_t theMax = hstack->GetMaximum(); Float_t theMin = hstack->GetMinimum(); theMax = 1.0; //Float_t theMin = hstack->GetMinimum(); if (_hist[itH]) { if (_hist[itH]->GetMaximum() > theMax) theMax = _hist[itH]->GetMaximum(); if (_hist[itH]->GetMinimum() < theMin) theMin = _hist[itH]->GetMinimum(); } if (_data) { Float_t dataMax = GetMaximumIncludingErrors(_data); if (dataMax > theMax) theMax = dataMax; } if (gPad->GetLogy()) { hstack->SetMaximum(500 * theMax); hstack->SetMinimum(0.05); } else { hstack->SetMaximum(1.55 * theMax); } if(_breakdown) { THStackAxisFonts(hstack, "y", "entries"); hstack->GetHistogram()->LabelsOption("v"); } else { THStackAxisFonts(hstack, "x", TString::Format("%s [%s]",_xLabel.Data(),_units.Data())); if(_units.Sizeof() == 1) { THStackAxisFonts(hstack, "x", _xLabel.Data()); THStackAxisFonts(hstack, "y", "entries"); } else { THStackAxisFonts(hstack, "x", TString::Format("%s [%s]",_xLabel.Data(),_units.Data())); THStackAxisFonts(hstack, "y", TString::Format("entries / %.0f %s", _hist[iWZ]->GetBinWidth(0),_units.Data())); } } // total mess to get it nice, should be redone size_t j=0; TString higgsLabel = " tH x 100"; //if(_mass != 0) higgsLabel.Form(" m_{H}=%d",_mass); if(_data ) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _data, " data", "lp"); j++; } if(_hist[itH ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[itH ], higgsLabel, "l" ); j++; } if(_hist[iWZ ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iWZ ], " WZ", "f" ); j++; } if(_hist[iZZ ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iZZ ], " ZZ", "f" ); j++; } if(_hist[iWW ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iWW ], " WW", "f" ); j++; } if(_hist[itt ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[itt ], " tt", "f" ); j++; } if(_hist[ittw ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[ittw ], " ttW", "f" ); j++; } if(_hist[ittz ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[ittz ], " ttZ", "f" ); j++; } if(_hist[iwww ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iwww ], " WWW", "f" ); j++; } if(_hist[iwwz ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iwwz ], " WWZ", "f" ); j++; } if(_hist[iwzz ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[iwzz ], " WZZ", "f" ); j++; } if(_hist[idy ]) { DrawLegend(xPos[j], 0.84 - yOff[j]*_yoffset, _hist[idy ], " Drell-Yan","f" ); j++; } //TLatex* luminosity = new TLatex(0.9, 0.815, TString::Format("L = %.1f fb^{-1}",_lumi)); TLatex* luminosity = new TLatex(0.9, 0.95, TString::Format("CMS Preliminary \\sqrt{s} = 8 TeV, L = %.1f fb^{-1}",_lumi)); luminosity->SetNDC(); luminosity->SetTextAlign(32); luminosity->SetTextFont(42); luminosity->SetTextSize(_tsize); luminosity->Draw("same"); // if(_extraLabel) _extraLabel->Draw("same"); // return hstack->GetHistogram(); }
void comp(){ TLatex Tl; Tl.SetTextFont(43); Tl.SetTextSize(20); c1 = new TCanvas("c1","Helix vs. KF fits",600,400); TFile *f2 = TFile::Open("kfilt.root"); TH1F *h2 = new TH1F("hframe2","KF fit",500,-10.,5.); ntuple2->Draw("pTresol_kf>>hframe2"); h2->Draw(); h2->SetLineColorAlpha(kRed, 0.6); h2->GetXaxis()->SetTitle("p_{T} resol."); TFile *f1 = TFile::Open("helix.root"); TH1F *h1 = new TH1F("hframe1","Helix fit",500,-10.,5.); ntuple1->Draw("pTresol_helix>>hframe1","","same"); h1->Draw("same"); h1->SetLineColorAlpha(kBlue, 0.6); gPad->SetLogy(1); Tl.DrawLatex(0, 30, "red: p_{T} KF fit"); Tl.DrawLatex(0, 20, "blue: p_{T} Helix fit"); c2 = new TCanvas("c2","Helix vs. KF fits",600,400); TFile *f2 = TFile::Open("kfilt.root"); TH1F *h2 = new TH1F("hframe2","KF fit",500,-15.,15.); ntuple2->Draw("thetaDiff_kf>>hframe2"); h2->Draw(); h2->SetLineColorAlpha(kRed, 0.2); h2->GetXaxis()->SetTitle("#Delta #theta (mrad)"); TFile *f1 = TFile::Open("helix.root"); TH1F *h1 = new TH1F("hframe1","Helix fit",500,-15.,15.); ntuple1->Draw("thetaDiff_helix>>hframe1","","same"); h1->Draw("same"); h1->SetLineColorAlpha(kBlue, 0.2); gPad->SetLogy(1); Tl.DrawLatex(0, 30, "red: #theta KF fit"); Tl.DrawLatex(0, 20, "blue: #theta Helix fit"); c3 = new TCanvas("c3","Helix vs. KF fits",600,400); TFile *f2 = TFile::Open("kfilt.root"); TH1F *h2 = new TH1F("hframe2","KF fit",500,-150.,150.); ntuple2->Draw("phiDiff_kf>>hframe2"); h2->Draw(); h2->SetLineColorAlpha(kRed, 0.6); h2->GetXaxis()->SetTitle("#Delta #phi (mrad)"); TFile *f1 = TFile::Open("helix.root"); TH1F *h1 = new TH1F("hframe1","Helix fit",500,-150.,150.); ntuple1->Draw("phiDiff_helix>>hframe1","","same"); h1->Draw("same"); h1->SetLineColorAlpha(kBlue, 0.6); gPad->SetLogy(1); Tl.DrawLatex(0, 30, "red: #phi KF fit"); Tl.DrawLatex(0, 20, "blue: #phi Helix fit"); }
void CMSLumi(TCanvas *& canvas, const Int_t iPosX, const Double_t inlumi){ canvas->cd(); TString cmsText = "CMS"; Double_t cmsTextFont = 61; // default is helvetic-bold Bool_t writeExtraText = true; TString extraText = "Preliminary"; Double_t extraTextFont = 52; // default is helvetica-italics TString lumiText = Form("%1.1f fb^{-1} (13 TeV)", inlumi); // text sizes and text offsets with respect to the top frame // in unit of the top margin size Double_t lumiTextSize = 0.6; Double_t lumiTextOffset = 0.1; Double_t cmsTextSize = 0.75; Double_t cmsTextOffset = 0.05; // only used in outOfFrame version Double_t relPosX = 0.003;//0.045; Double_t relPosY = 0.035; Double_t relExtraDY = 1.2; // ratio of "CMS" and extra text size Double_t extraOverCmsTextSize = 0.76; Bool_t outOfFrame = false; if ( iPosX/10 == 0 ) { outOfFrame = true; } Int_t alignY_=3; Int_t alignX_=2; if (iPosX/10 == 0) {alignX_ = 1;} if (iPosX == 0) {alignY_ = 1;} if (iPosX/10 == 1) {alignX_ = 1;} if (iPosX/10 == 2) {alignX_ = 2;} if (iPosX/10 == 3) {alignX_ = 3;} Int_t align_ = 10*alignX_ + alignY_; Double_t H = canvas->GetWh(); Double_t W = canvas->GetWw(); Double_t l = canvas->GetLeftMargin(); Double_t t = canvas->GetTopMargin(); Double_t r = canvas->GetRightMargin(); Double_t b = canvas->GetBottomMargin(); Double_t e = 0.025; TLatex latex; latex.SetNDC(); latex.SetTextAngle(0); latex.SetTextColor(kBlack); Double_t extraTextSize = extraOverCmsTextSize*cmsTextSize; latex.SetTextFont(42); latex.SetTextAlign(31); latex.SetTextSize(lumiTextSize*t); latex.DrawLatex(1-r+0.08,1-t+lumiTextOffset*t+0.01,lumiText); if (outOfFrame) { latex.SetTextFont(cmsTextFont); latex.SetTextAlign(11); latex.SetTextSize(cmsTextSize*t); latex.DrawLatex(l,1-t+cmsTextOffset*t,cmsText); } Double_t posX_; if (iPosX%10 <= 1) { posX_ = l + relPosX*(1-l-r); } else if (iPosX%10 == 2) { posX_ = l + 0.5*(1-l-r); } else if (iPosX%10 == 3) { posX_ = 1-r - relPosX*(1-l-r); } Double_t posY_ = 1-t - relPosY*(1-t-b); if (!outOfFrame) { latex.SetTextFont(cmsTextFont); latex.SetTextSize(cmsTextSize*t); latex.SetTextAlign(align_); latex.DrawLatex(posX_, posY_, cmsText); if (writeExtraText) { latex.SetTextFont(extraTextFont); latex.SetTextAlign(align_); latex.SetTextSize(extraTextSize*t); latex.DrawLatex(posX_, posY_- relExtraDY*cmsTextSize*t, extraText); } } else if (outOfFrame && writeExtraText){ if (iPosX == 0) { posX_ = l + relPosX*(1-l-r)+0.05; posY_ = 1-t+lumiTextOffset*t; } latex.SetTextFont(extraTextFont); latex.SetTextSize(extraTextSize*t); latex.SetTextAlign(align_); latex.DrawLatex(posX_, posY_, extraText); } }// end Style::CMSLumi
void MakeClosurePlot(TH1D* hObs, TH1D* hPred, TString name, bool logy=true) { set_style(hObs,"data_obs"); set_style(hPred,"pred"); // Setup canvas and pads TCanvas * c1 = new TCanvas("c1", "c1", 700, 700); c1->SetFillStyle(4000); TPad * pad1 = new TPad("pad1", "top pad" , 0.0, 0.3, 1.0, 1.0); pad1->SetFillStyle(4000); pad1->SetBottomMargin(0.0); pad1->Draw(); TPad * pad2 = new TPad("pad2", "bottom pad", 0.0, 0.0, 1.0, 0.3); pad2->SetFillStyle(4000); pad2->SetTopMargin(0.0); pad2->SetBottomMargin(0.35); pad2->Draw(); pad1->cd(); pad1->SetLogy(logy); TH1D * staterr = (TH1D *) hPred->Clone("staterr"); // staterr->Sumw2(); //staterr->SetFillColor(kRed); staterr->SetFillColor(kGray+3); staterr->SetMarkerSize(0); staterr->SetFillStyle(3013); //cout << "Compute ratio hist..." << endl; TH1D * ratio = (TH1D *) hPred->Clone("ratio"); //ratio->Sumw2(); ratio->SetMarkerSize(0.8); ratio->SetMarkerColor(1); //ratio->SetMarkerSize(0.5); ratio->Divide(hObs, hPred, 1., 1., "B"); ratio->Print("all"); TH1D * ratiostaterr = (TH1D *) hObs->Clone("ratiostaterr"); // ratiostaterr->Sumw2(); ratiostaterr->SetStats(0); ratiostaterr->SetTitle(hPred->GetTitle()); ratiostaterr->GetYaxis()->SetTitle("Obs/Pred."); ratiostaterr->SetMaximum(2.2); ratiostaterr->SetMinimum(0); ratiostaterr->SetMarkerSize(0); //ratiostaterr->SetFillColor(kRed); ratiostaterr->SetFillColor(kGray+3); ratiostaterr->SetFillStyle(3013); ratiostaterr->GetXaxis()->SetLabelSize(0.2); ratiostaterr->GetXaxis()->SetLabelOffset(0.03); ratiostaterr->GetXaxis()->SetTitleSize(0.14); ratiostaterr->GetXaxis()->SetTitleOffset(1.10); ratiostaterr->GetYaxis()->SetLabelSize(0.10); ratiostaterr->GetYaxis()->SetTitleSize(0.12); ratiostaterr->GetYaxis()->SetTitleOffset(0.6); ratiostaterr->GetYaxis()->SetNdivisions(505); TLine* ratiounity = new TLine(hPred->GetBinLowEdge(1),1,hPred->GetBinLowEdge(hPred->GetNbinsX()+1),1); ratiounity->SetLineStyle(2); for (Int_t i = 0; i < hPred->GetNbinsX()+2; i++) { // if (hObs->GetBinContent(i)>0.) ratio->SetBinError(i, hObs->GetBinError(i)/hObs->GetBinContent(i)); // just the fractional uncertainty on the observation ratiostaterr->SetBinContent(i, 1.0); if (hPred->GetBinContent(i) > 1e-6) { //< not empty double binerror = hPred->GetBinError(i) / hPred->GetBinContent(i); ratiostaterr->SetBinError(i, binerror); } else { ratiostaterr->SetBinError(i, 999.); } } TH1D * ratiosysterr = (TH1D *) ratiostaterr->Clone("ratiosysterr"); // ratiosysterr->Sumw2(); ratiosysterr->SetMarkerSize(0); ratiosysterr->SetFillColor(kYellow-4); //ratiosysterr->SetFillStyle(3002); ratiosysterr->SetFillStyle(1001); for (Int_t i = 0; i < hPred->GetNbinsX()+2; i++) { if (hPred->GetBinContent(i) > 1e-6) { //< not empty double binerror2 = (pow(hPred->GetBinError(i), 2)); double binerror = sqrt(binerror2); ratiosysterr->SetBinError(i, binerror / hPred->GetBinContent(i)); } } double max = hObs->GetMaximum(); if (hPred->GetMaximum() > max) max = hPred->GetMaximum(); if (logy) { hPred->SetMaximum(max*10); hPred->SetMinimum(0.09); } else { hPred->SetMaximum(max*1.5); hPred->SetMinimum(0.); } hPred->GetYaxis()->SetTitle("Events / bin"); hPred->Draw("hist"); hObs->Draw("e1,same"); staterr->Draw("e2 same"); hPred->GetXaxis()->SetTitleSize(0.035); hPred->GetXaxis()->SetLabelSize(0.035); /* hObs->GetYaxis()->SetTitleSize(0.035); */ /* hObs->GetYaxis()->SetLabelSize(0.035); */ TLegend * leg2 = new TLegend(0.72, 0.68, 0.94, 0.92); set_style(leg2,0.035); leg2->AddEntry(hObs,"Obs.","elp"); leg2->AddEntry(hPred,"Pred.","f"); leg2->AddEntry(staterr, "Syst. uncert.", "f"); leg2->Draw(); TLatex * latex = new TLatex(); latex->SetNDC(); latex->SetTextAlign(12); latex->SetTextFont(62); latex->SetTextSize(0.042); latex->DrawLatex(0.19, 0.89, "CMS Simulation"); latex->SetTextSize(0.03); TString stamp = Form("#sqrt{s} = 13 TeV, L = %3.1f fb^{-1}", int_lumi); latex->DrawLatex(0.19, 0.84, stamp); pad2->cd(); pad2->SetGridy(0); ratiostaterr->GetXaxis()->SetRangeUser(0,6); ratiostaterr->Draw("e2"); //ratiosysterr->Draw("e2 same"); ratiostaterr->Draw("e2 same"); ratiounity->Draw(); ratio->Draw("e1 same"); TPaveText * pave = new TPaveText(0.18, 0.86, 0.4, 0.96, "brNDC"); pave->SetLineColor(0); pave->SetFillColor(kWhite); pave->SetShadowColor(0); pave->SetBorderSize(1); double nchisq = hObs->Chi2Test(hPred, "UWCHI2/NDF, P"); // MC uncert. (stat) double p_value = hObs->Chi2Test(hPred, "UW"); // MC uncert. (stat) // //double kolprob = hdata_obs->KolmogorovTest(hmc_pred); // MC uncert. (stat) TText * text = pave->AddText(Form("#chi_{#nu}^{2}/ndf = %.3f, p = %.3f", nchisq, p_value)); // //TText * text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f", nchisq, kolprob)); text->SetTextFont(62); text->SetTextSize(0.07); // text->SetTextSize(0.06); pave->Draw(); /* TLegend * ratioleg = new TLegend(0.72, 0.88, 0.94, 0.96); */ /* set_style(ratioleg); */ /* ratioleg->SetTextSize(0.07); */ /* ratioleg->AddEntry(ratiostaterr, "MC uncert. (stat)", "f"); */ /* ratioleg->Draw(); */ pad1->cd(); gPad->RedrawAxis(); gPad->Modified(); gPad->Update(); pad2->cd(); gPad->RedrawAxis(); gPad->Modified(); gPad->Update(); c1->cd(); c1->Print("Closure/plots/no_dp_cut/"+name+".pdf"); delete staterr; delete ratio; delete ratiostaterr; delete ratiosysterr; delete leg2; // delete ratioleg; delete pad1; delete pad2; delete c1; delete latex; }
void Drawmorephibinvn(TH1D * vn_morephibin, TGraphErrors * gr_vn_morephibin_sys, TGraphAsymmErrors * gr_vn_morephibin_sys_Bfeeddown, TString trigname = "MBtrig", TString vnname = "v2", TString Ytitle = "v_{2}", int cent_low = 0, int cent_high = 100, double ptlow = 1.0, double pthigh = 40.0, TString fitoption = "poly3bkg", bool DrawsysBfeeddown_Alice = false, bool DrawsysBfeeddown_data = false) { TCanvas * cfg_vn = new TCanvas(Form("cfg_comparison_%s_%s", trigname.Data(), vnname.Data())); gr_vn_morephibin_sys->GetY()[0] = 3.; gr_vn_morephibin_sys->GetY()[1] = 3.; gr_vn_morephibin_sys_Bfeeddown->GetY()[0] = 3.; gr_vn_morephibin_sys_Bfeeddown->GetY()[1] = 3.; if( cent_low == 0 && cent_high == 10 ) { vn_morephibin->SetBinContent( vn_morephibin->FindBin(1.5), 3 ); vn_morephibin->SetBinError( vn_morephibin->FindBin(1.5), 0 ); gr_vn_morephibin_sys->GetY()[2] = 3.; gr_vn_morephibin_sys->GetEY()[2] = 0.; gr_vn_morephibin_sys_Bfeeddown->GetY()[2] = 3.; gr_vn_morephibin_sys_Bfeeddown->GetEYlow()[2] = 0.; gr_vn_morephibin_sys_Bfeeddown->GetEYhigh()[2] = 0.; } gr_vn_morephibin_sys->SetFillStyle(0); gr_vn_morephibin_sys->SetLineColor(2.0); gr_vn_morephibin_sys->SetMarkerSize(0); vn_morephibin->SetLineWidth(0); vn_morephibin->SetMarkerSize(0.8); vn_morephibin->Draw(); for( int ibin = 0; ibin < gr_vn_morephibin_sys->GetN(); ibin++ ) gr_vn_morephibin_sys->GetEX()[ibin] = 0.5; gr_vn_morephibin_sys->SetMarkerColor(4.0); gr_vn_morephibin_sys->SetMarkerStyle(21); //gr_vn_morephibin_sys->SetLineWidth(1); gr_vn_morephibin_sys->SetLineWidth(0);//hard probes gr_vn_morephibin_sys->SetFillStyle(0); gr_vn_morephibin_sys->SetLineColor(4.0); gr_vn_morephibin_sys_Bfeeddown->SetMarkerColor(4.0); gr_vn_morephibin_sys_Bfeeddown->SetMarkerStyle(21); gr_vn_morephibin_sys_Bfeeddown->SetLineWidth(0); gr_vn_morephibin_sys_Bfeeddown->SetFillStyle(1001); gr_vn_morephibin_sys_Bfeeddown->SetFillColor(kBlue-9); gr_vn_morephibin_sys_Bfeeddown->SetLineColor(kBlue-9); if( DrawsysBfeeddown_Alice || DrawsysBfeeddown_data ) gr_vn_morephibin_sys_Bfeeddown->Draw("2same"); if( fitoption == "poly3bkg" ) gr_vn_morephibin_sys->Draw("E2same"); vn_morephibin->Draw("same"); TLatex Tl; Tl.SetNDC(); Tl.SetTextAlign(12); Tl.SetTextSize(0.05); Tl.SetTextFont(42); Tl.DrawLatex(0.125,0.965, "#font[61]{CMS} #scale[0.8]{Preliminary}"); Tl.DrawLatex(0.57,0.965, "#scale[0.8]{PbPb #sqrt{s_{NN}} = 5.02 TeV}"); TLatex* tex; tex = new TLatex(0.20,0.83,"|y| < 1.0"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.05); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.20,0.76,Form("Cent. %d-%d%%", cent_low, cent_high)); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.05); tex->SetLineWidth(2); tex->Draw(); TF1 * fun = new TF1("fun", "0.0", 0, 100); fun->SetLineColor(1.0); fun->SetLineStyle(3); fun->SetLineWidth(1); fun->Draw("same"); if( DrawsysBfeeddown_Alice || DrawsysBfeeddown_data ) { tex = new TLatex(0.3,0.25,"Filled box: syst. from non-prompt D^{0}"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.3,0.20,"Open box: other syst."); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); } cfg_vn->SaveAs(Form("Plots_vn/cfg_finalmorephibin_%s_%s_cent%dto%d_Bfeeddownsys_Alice%d_data%d_%s_effcorrected0.pdf", trigname.Data(), vnname.Data(), cent_low, cent_high, DrawsysBfeeddown_Alice, DrawsysBfeeddown_data, fitoption.Data())); }
void make1DLimit(TString combine_dir,TString type= "WH",bool blind=true){ //TString combine_dir = "test_runSusyHgg/signalInj_sms_ChiWH_0_175/"; //WH wh_limits.push_back(wh_125); wh_limits.push_back(wh_150); wh_limits.push_back(wh_175); wh_limits.push_back(wh_200); //HH hh_limits.push_back(hh_125); hh_limits.push_back(hh_150); hh_limits.push_back(hh_175); hh_limits.push_back(hh_200); TGraph obser( (200-125)/25 ); TGraph graph( (200-125)/25 ); TGraphAsymmErrors error( (200-125)/25 ); TGraphAsymmErrors error2S( (200-125)/25 ); TGraph obser_r( (200-125)/25 ); TGraph graph_r( (200-125)/25 ); TGraphAsymmErrors error_r( (200-125)/25 ); TGraphAsymmErrors error_r2S( (200-125)/25 ); TGraphErrors* theo = 0; if(type=="WH") theo = getTheoXSec("xsecs/CharginoNeutralino.txt"); else theo = getTheoXSec("xsecs/Higgsino_ElectroHiggs.txt"); //else theo = getTheoXSec("/home/amott/HggApp/SusyHgg/xsecs/Higgsino.txt"); for(int m=125;m<=200;m+=25) { int i=(m-125)/25; TFile limit_file(Form("%s/higgsCombineChi%s_0_%d.Asymptotic.mH120.root",combine_dir.Data(),type.Data(),m) ); TTree *limit_tree = (TTree*)limit_file.Get("limit"); TTreeFormula limit_form("get_limit","limit",limit_tree); float down_2s = -1; float down = -1; float exp = -1; float up = -1; float up_2s = -1; float obs = -1; if( type == "WH" ) { down_2s = wh_limits.at(i)[0]; down = wh_limits.at(i)[1]; exp = wh_limits.at(i)[2]; up = wh_limits.at(i)[3]; up_2s = wh_limits.at(i)[4]; obs = wh_limits.at(i)[5]; } else if ( type == "HH") { down_2s = hh_limits.at(i)[0]; down = hh_limits.at(i)[1]; exp = hh_limits.at(i)[2]; up = hh_limits.at(i)[3]; up_2s = hh_limits.at(i)[4]; obs = hh_limits.at(i)[5]; } else { std::cerr << "UNRECOGNIZED OPTION!!! QUITTING" << std::endl; } if(i==0) m+=5; //first point is actually at m=130 graph.SetPoint(i,float(m), exp); error.SetPoint(i,float(m), exp); error2S.SetPoint(i, float(m), exp); error.SetPointError(i, 0, 0, exp-down, up-exp); error2S.SetPointError(i, 0 , 0 , exp-down_2s, up_2s-exp); graph_r.SetPoint(i,float(m),exp/theo->Eval(m)); error_r.SetPoint(i,float(m),exp/theo->Eval(m)); error_r2S.SetPoint(i,float(m),exp/theo->Eval(m)); error_r.SetPointError(i,0,0,(exp-down)/theo->Eval(m),(up-exp)/theo->Eval(m)); error_r2S.SetPointError(i, 0, 0, (exp-down_2s)/theo->Eval(m), (up_2s-exp)/theo->Eval(m) ); obser.SetPoint(i,float(m),obs); obser_r.SetPoint(i,float(m),obs/theo->Eval(m)); if(i==0) m-=5; } TCanvas cv; cv.SetLogy(); cv.SetGrid(1,1); theo->SetMaximum(1e2); theo->SetMinimum(1e-2); theo->GetYaxis()->SetLabelSize(0.05); theo->GetYaxis()->SetTitleSize(0.06); theo->GetYaxis()->SetTitleOffset(0.8); theo->GetYaxis()->SetTitle("95% CL #sigma upper limit (pb)"); theo->GetXaxis()->SetTitle("m_{chargino} (GeV)"); if(type=="HH") theo->GetXaxis()->SetTitle("m_{neutralino} (GeV)"); theo->SetFillColor(kBlue); theo->SetLineStyle(kDotted); theo->SetLineWidth(2); error.SetMaximum(1e2); error.SetMinimum(1e-2); error.GetYaxis()->SetLabelSize(0.04); error.GetYaxis()->SetTitleSize(0.06); error.GetYaxis()->SetTitleOffset(0.8); error.GetXaxis()->SetLabelSize(0.04); error.GetXaxis()->SetTitleSize(0.05); error.GetXaxis()->SetTitleOffset(0.9); error.GetYaxis()->SetTitle("95% CL #sigma upper limit (pb)"); error.GetXaxis()->SetTitle("m_{chargino} (GeV)"); if(type=="HH") error.GetXaxis()->SetTitle("m_{neutralino} (GeV)"); error.SetFillColor(kGreen); error2S.SetFillColor(kYellow); error2S.SetTitle(""); error.SetTitle(""); error.Draw("A3"); error2S.Draw("3SAME"); error.Draw("3"); theo->SetTitle(""); theo->Draw("3C"); graph.SetLineStyle(kDashed); graph.SetLineWidth(2.0); graph.SetTitle(""); graph.Draw("C"); obser.SetLineStyle(1); obser.SetLineWidth(2.0); obser.SetTitle(""); if(!blind) obser.Draw("C"); TLegend leg(0.65,0.65,0.89,0.89); leg.SetFillColor(0); leg.SetBorderSize(0); leg.AddEntry(&graph,"expected","l"); leg.AddEntry(&error,"expected #pm1#sigma","F"); leg.AddEntry(&error2S,"expected #pm2#sigma","F"); leg.AddEntry(theo,"theoretical","f"); if(!blind) leg.AddEntry(&obser,"observed","l"); leg.Draw("SAME"); TLatex latex; latex.SetNDC(); latex.SetTextAngle(0); latex.SetTextColor(kBlack); float extraTextSize = extraOverCmsTextSize*cmsSize; latex.SetTextFont(lumifont); latex.SetTextAlign(31); latex.SetTextSize(cmsSize); latex.DrawLatex(lumix, lumiy,lumiText); latex.SetTextFont(cmsTextFont); latex.SetTextAlign(31); latex.SetTextSize(cmsSize); latex.DrawLatex(cmsx, cmsy, CMSText); latex.SetTextFont(extraTextFont); latex.SetTextAlign(31); latex.SetTextSize(extraTextSize); latex.DrawLatex(extrax, extray, extraText); TString infix=(blind ? "" : "_OBS"); cv.SaveAs(combine_dir+"/expected_exclusion_"+type+"_1D"+infix+"_v2.png"); cv.SaveAs(combine_dir+"/expected_exclusion_"+type+"_1D"+infix+"_v2.pdf"); cv.SaveAs(combine_dir+"/expected_exclusion_"+type+"_1D"+infix+"_v2.C"); error_r.SetMaximum(1e2); error_r.SetMinimum(1e-2); error_r.SetTitle(""); error_r.GetYaxis()->SetLabelSize(0.04); error_r.GetYaxis()->SetTitleSize(0.06); error_r.GetYaxis()->SetTitleOffset(0.8); error_r.GetXaxis()->SetLabelSize(0.04); error_r.GetXaxis()->SetTitleSize(0.05); error_r.GetXaxis()->SetTitleOffset(0.9); error_r.GetYaxis()->SetTitle("#sigma_{95%}/#sigma_{NLO}"); if(type=="HH") error_r.GetXaxis()->SetTitle("m_{neutralino} (GeV)"); else error_r.GetXaxis()->SetTitle("m_{chargino} (GeV)"); error_r.SetFillColor(kGreen); error_r2S.SetFillColor(kYellow); error_r2S.SetTitle(""); error_r.Draw("A3"); error_r2S.Draw("3SAME"); error_r.Draw("3SAME"); graph_r.SetLineStyle(kDashed); graph_r.SetLineWidth(2); graph_r.SetTitle(""); graph_r.Draw("C"); TLine l(125,1,205,1); l.SetLineWidth(3); l.SetLineColor(kBlue); //l.Draw("SAME"); obser_r.SetLineWidth(2); if(!blind) obser_r.Draw("C"); leg.Draw("SAME"); //lbl.SetY(0.20); //leg.SetY1NDC(0.28); //leg.SetY2NDC(0.43); //prelim.Draw(); //lbl.Draw(); latex.SetTextFont(lumifont); latex.SetTextAlign(31); latex.SetTextSize(cmsSize); latex.DrawLatex(lumix, lumiy,lumiText); latex.SetTextFont(cmsTextFont); latex.SetTextAlign(31); latex.SetTextSize(cmsSize); latex.DrawLatex(cmsx, cmsy, CMSText); latex.SetTextFont(extraTextFont); latex.SetTextAlign(31); latex.SetTextSize(extraTextSize); latex.DrawLatex(extrax, extray, extraText); cv.SaveAs(combine_dir+"/expected_exclusion_ratio_"+type+"_1D"+infix+"_v2.png"); cv.SaveAs(combine_dir+"/expected_exclusion_ratio_"+type+"_1D"+infix+"_v2.pdf"); cv.SaveAs(combine_dir+"/expected_exclusion_ratio_"+type+"_1D"+infix+"_v2.C"); }
void Get_vn_pt_staterror_signalfraction( TH1D * h_vn_pt_staterror_signalfraction, TH1D * h_vn_toyMC_oneptbin[], TString MBorDtrig, TString EPorSP, TString vnname, int cent_low, int cent_high, int iptstart, int iptend, TString fitoption) { for( int ipt = iptstart; ipt < iptend; ipt++ ) { TCanvas * cfg_fit_staterror_signalfraction = new TCanvas( Form("cfg_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), Form("cfg_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), 600, 600); float vn_mean = h_vn_pt_staterror_signalfraction->GetBinContent( ipt+1 ); float v3_staterror = h_vn_pt_staterror_signalfraction->GetBinError( ipt+1 ); float fitrangelow; float fitrangehigh; if( vnname == "v2" ) { fitrangelow = vn_mean - 0.4 * v3_staterror; fitrangehigh = vn_mean + 0.4 * v3_staterror; } else { fitrangelow = vn_mean - 0.2 * v3_staterror; fitrangehigh = vn_mean + 0.2 * v3_staterror; } cout << "ipt: " << ipt << " vn_mean: " << vn_mean << " v3_staterror: " << v3_staterror << endl; TF1 * fit = new TF1( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "gaus(0)", fitrangelow, fitrangehigh); fit->SetParameter( 0, 30.); fit->SetParameter( 1, vn_mean); fit->SetParameter( 2, 0.05 * v3_staterror); fit->SetLineColor(2); h_vn_toyMC_oneptbin[ipt]->Fit( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "q", "", fitrangelow, fitrangehigh); h_vn_toyMC_oneptbin[ipt]->Fit( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "L q", "", fitrangelow, fitrangehigh); h_vn_toyMC_oneptbin[ipt]->Fit( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "L q", "", fitrangelow, fitrangehigh); h_vn_toyMC_oneptbin[ipt]->Fit( Form("f_staterror_signalfraction_%s_%s_%d", MBorDtrig.Data(), vnname.Data(), ipt), "L m", "", fitrangelow, fitrangehigh); h_vn_toyMC_oneptbin[ipt]->GetXaxis()->SetRangeUser( fitrangelow, fitrangehigh); h_vn_pt_staterror_signalfraction->SetBinContent( ipt+1, fit->GetParameter(1)); h_vn_pt_staterror_signalfraction->SetBinError( ipt+1, fit->GetParameter(2)); TLatex Tl; Tl.SetNDC(); Tl.SetTextAlign(12); Tl.SetTextSize(0.05); Tl.SetTextFont(42); Tl.DrawLatex(0.125,0.965, "#font[61]{CMS} #scale[0.8]{Preliminary}"); Tl.DrawLatex(0.57,0.965, "#scale[0.8]{PbPb #sqrt{s_{NN}} = 5.02 TeV}"); TLatex* tex; tex = new TLatex(0.55,0.83,"|y| < 1.0"); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.55,0.78,Form("Cent. %d-%d%%", cent_low, cent_high)); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); float ptmin = ptbins[ipt]; float ptmax = ptbins[ipt+1]; tex = new TLatex(0.55,0.73,Form("%.1f < p_{T} < %.1f GeV/c",ptmin,ptmax)); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); cfg_fit_staterror_signalfraction->SaveAs(Form("Plots_vn/plots_fit_staterror_signalfraction/cfg_staterror_signalfraction_%s_%s_%d_%s_cent%dto%d_%s.pdf", MBorDtrig.Data(), vnname.Data(), ipt, EPorSP.Data(), cent_low, cent_high, fitoption.Data())); } }
int RAAweighting() { gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gStyle->SetOptFit(0000); gStyle->SetEndErrorSize(0); gStyle->SetTextSize(0.05); gStyle->SetTextFont(42); gStyle->SetPadRightMargin(0.043); gStyle->SetPadLeftMargin(0.18); gStyle->SetPadTopMargin(0.1); gStyle->SetPadBottomMargin(0.145); gStyle->SetTitleX(.0f); ifstream getdata("theoryRAA/Magdalena.dat"); if(!getdata.is_open()) { cout<<" ERROR: Opening the file fails"<<endl; return 1; } Int_t nbin=0; while(!getdata.eof()) { getdata>>fpt[nbin]>>fRAA[nbin]; cout<<fpt[nbin]<<" "<<fRAA[nbin]<<endl; nbin++; } TGraph* gRAA = new TGraph(nbin,fpt,fRAA); gRAA->SetMarkerSize(0.8); gRAA->SetMarkerStyle(20); gRAA->SetMarkerColor(kBlack); TCanvas* cRAA = new TCanvas("cRAA","",600,600); TH2F* hempty = new TH2F("hempty","",20,0.,55.,10.,0.3,0.8); hempty->GetXaxis()->SetTitle("B^{+} p_{T} (GeV/c)"); hempty->GetYaxis()->SetTitle("R_{AA}"); hempty->GetXaxis()->CenterTitle(); hempty->GetYaxis()->CenterTitle(); hempty->GetXaxis()->SetTitleOffset(1.3); hempty->GetYaxis()->SetTitleOffset(1.8); hempty->GetXaxis()->SetTitleSize(0.045); hempty->GetYaxis()->SetTitleSize(0.045); hempty->GetXaxis()->SetTitleFont(42); hempty->GetYaxis()->SetTitleFont(42); hempty->GetXaxis()->SetLabelFont(42); hempty->GetYaxis()->SetLabelFont(42); hempty->GetXaxis()->SetLabelSize(0.04); hempty->GetYaxis()->SetLabelSize(0.04); hempty->Draw(); gRAA->Draw("samep"); TF1* fRAA = new TF1("fRAA","exp([0]+[1]*x+[2]*x*x+[3]*x*x*x)+[4]"); fRAA->SetLineWidth(2); gRAA->Fit("fRAA","","",4.8,50.5); gRAA->Fit("fRAA","","",4.8,50.5); cout<<endl; cout<<" exp("<<fRAA->GetParameter(0)<<"+"<<fRAA->GetParameter(1)<<"*x+"<<fRAA->GetParameter(2)<<"*x*x+"<<fRAA->GetParameter(3)<<"*x*x*x)+"<<fRAA->GetParameter(4)<<endl; cout<<endl; TLatex* texCms = new TLatex(0.18,0.93, "#scale[1.25]{CMS} #bf{#it{Preliminary}}"); texCms->SetNDC(); texCms->SetTextAlign(12); texCms->SetTextSize(0.04); texCms->SetTextFont(42); texCms->Draw(); TLatex* texCol = new TLatex(0.96,0.93, Form("%s #sqrt{s_{NN}} = 5.02 TeV","PbPb")); texCol->SetNDC(); texCol->SetTextAlign(32); texCol->SetTextSize(0.04); texCol->SetTextFont(42); texCol->Draw(); TLatex* texTheory = new TLatex(0.55,0.80, "Theory"); texTheory->SetNDC(); texTheory->SetTextAlign(12); texTheory->SetTextSize(0.04); texTheory->SetTextFont(42); texTheory->Draw(); TLatex* texArxiv = new TLatex(0.55,0.75, "arXiv:1601.07852"); texArxiv->SetNDC(); texArxiv->SetTextAlign(12); texArxiv->SetTextSize(0.04); texArxiv->SetTextFont(42); texArxiv->Draw(); TString tper = "%"; TLatex* texCent = new TLatex(0.55,0.70, Form("Cent. 0-10%s",tper.Data())); texCent->SetNDC(); texCent->SetTextAlign(12); texCent->SetTextSize(0.04); texCent->SetTextFont(42); texCent->Draw(); cRAA->SaveAs("plots/RAAweighting.pdf"); return 0; }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- int MCClosure(){ TGraphErrors* intrinsic, *full; TGraphErrors* Ratio; TGraphErrors* RatioAbs; TCanvas* canvas[4]; TCanvas* canvas2[4]; TCanvas* canvas3[4]; TFile *file; TString fileName; const int eta_int = 4; double etaBorders[eta_int+1] = {0}; TString etaRegion; etaBorders[0] = 0.0; etaBorders[1] = 0.5; etaBorders[2] = 1.1; etaBorders[3] = 1.7; etaBorders[4] = 2.3; for(int j=0; j<4; j++){ if(j == 0) etaRegion.Form("|#eta| < %4.1f", etaBorders[j+1]); else etaRegion.Form("%4.1f < #eta < %4.1f",etaBorders[j], etaBorders[j+1]); fileName.Form("c%i",j); canvas[j] = new TCanvas(fileName,fileName,0,0,500,500); canvas[j] ->cd(); //char file1[100] = "_JetHemisphere_widthDivMean"; char file1[100] = ""; char file2[100] = ""; fileName.Form("root_files%s/Resolution_for_%i_eta_bin_PFCHS_mc.root",file1,j+1); //fileName.Form("root_files/Scale_for_%i_eta_bin_PFCHS_mc.root",j+1); file = TFile::Open(fileName); file->GetObject("Graph",full); full -> SetMarkerColor(3); full -> SetLineColor(3); full -> GetFunction("fResolution")->SetLineColor(3); full ->SetMaximum(0.12); full ->SetMinimum(0.04); full ->Draw("AP"); delete file; fileName.Form("root_files%s/Resolution_for_%i_eta_bin_intrinsic_PFCHS_mc.root",file1,j+1); //fileName.Form("root_files/Scale_for_%i_eta_bin_intrinsic_PFCHS_mc.root",j+1); file = TFile::Open(fileName); file->GetObject("Graph",intrinsic); intrinsic -> SetMarkerColor(2); intrinsic -> SetLineColor(2); intrinsic -> GetFunction("fResolution")->SetLineColor(2); intrinsic ->Draw("Psame"); TLegend *legend = new TLegend(0.6,0.7,0.9,0.9); legend -> SetFillColor(0); legend -> SetTextSize(0.033); legend -> AddEntry(intrinsic,"intrinsic","l"); legend -> AddEntry(full,"full resolution","l"); legend->Draw("same"); fileName.Form("Resolution_intrinsic_full_for_%i_eta_bin%s.pdf",j+1,file1); canvas[j]->SaveAs(fileName); delete file; const int numEntries = 9; double xIntrinsic[numEntries] = {0}; double yIntrinsic[numEntries] = {0}; double xIntrinsicError[numEntries] = {0}; double yIntrinsicError[numEntries] = {0}; double xFull[numEntries] = {0}; double yFull[numEntries] = {0}; double xFullError[numEntries] = {0}; double yFullError[numEntries] = {0}; double x[numEntries] = {0}; double y[numEntries] = {0}; double xError[numEntries] = {0}; double yError[numEntries] = {0}; for(int i=0; i<numEntries; i++){ intrinsic -> GetPoint(i+0,xIntrinsic[i],yIntrinsic[i]); full -> GetPoint(i+0,xFull[i],yFull[i]); cout<<"xFull["<<i<<"] = "<<xFull[i]<<endl; cout<<"xIntrinsic["<<i<<"] = "<<xIntrinsic[i]<<endl; xIntrinsicError[i] = intrinsic -> GetErrorX(i+0); yIntrinsicError[i] = intrinsic -> GetErrorY(i+0); xFullError[i] = full -> GetErrorX(i+0); yFullError[i] = full -> GetErrorY(i+0); y[i] = yFull[i]/yIntrinsic[i] -1 ; x[i] = 1./2.*(xFull[i]+xIntrinsic[i]); yError[i] = TMath::Sqrt(TMath::Power((1./yIntrinsic[i]),2)*TMath::Power(yFullError[i],2)+TMath::Power((yFull[i]/(TMath::Power(yIntrinsic[i],2))),2)*TMath::Power(yIntrinsicError[i],2)); //cout<<"y["<<i<<"] = "<<y[i]*100<<endl<<endl; //cout<<"yError["<<i<<"] = "<<yError[i]*100<<endl<<endl; xError[i] = 1./2.*TMath::Sqrt(TMath::Power(xFullError[i],2)+TMath::Power(xIntrinsicError[i],2)); } fileName.Form("c2%i",j); canvas2[j] = new TCanvas(fileName,fileName,0,0,500,500); canvas2[j] ->SetBottomMargin(0.15); canvas2[j] ->SetLeftMargin(0.17); canvas2[j] ->cd(); Ratio = new TGraphErrors(numEntries,x,y,xError,yError); char titleName[100] = {0}; sprintf(titleName,"MC Closure Test %s",file2); Ratio->SetTitle(titleName); Ratio->GetXaxis()->SetTitleSize(0.06); Ratio->GetYaxis()->SetTitleSize(0.04); Ratio-> GetXaxis()->SetTitle("p_{T}^{#gamma}"); Ratio -> GetXaxis()->SetLimits(0,600); Ratio-> GetYaxis()->SetTitle("#frac{predic. intrinsic}{intrinsic} -1"); Ratio->GetYaxis()->SetTitleOffset(1.5); Ratio->SetMarkerStyle(20); Ratio->SetMarkerSize(1.1); Ratio ->SetMaximum(0.3); Ratio ->SetMinimum(-0.3); Ratio->Draw("AP"); TF1* line = new TF1("line","0.",0,600); line->SetLineColor(2); line->Draw("same"); TLatex* info = new TLatex(); char legname[100] = {0}; info->SetTextFont(132); info-> SetNDC(); info->SetTextSize(0.040); info->DrawLatex(0.60,0.80,etaRegion); fileName.Form("MCClosure_for_%i_eta_bin%s.pdf",j+1,file1); canvas2[j]->SaveAs(fileName); canvas3[j] = new TCanvas(fileName,fileName,0,0,500,500); canvas3[j] ->cd(); for(int i=0; i<numEntries; i++) y[i] = std::abs(y[i]); RatioAbs = new TGraphErrors(numEntries,x,y,xError,yError); TF1* fit = new TF1("fit","pol0",0,600); //TF1* fit = new TF1("fit","expo(0)",0,600); sprintf(titleName,"MCClosure - %s absolute Values",file2); RatioAbs -> SetTitle(titleName); RatioAbs -> GetXaxis()->SetTitle("p_{T}^{#gamma}"); RatioAbs -> GetXaxis()->SetLimits(0,600); RatioAbs -> GetYaxis()->SetTitle("JER/intrinsic -1"); RatioAbs -> GetYaxis()->SetTitleOffset(1.5); RatioAbs -> SetMarkerStyle(20); RatioAbs -> SetMarkerSize(1.1); RatioAbs -> SetMaximum(0.25); RatioAbs -> SetMinimum(-0.05); RatioAbs -> Fit("fit","Q"); RatioAbs -> Draw("AP"); line ->Draw("same"); fit -> SetLineColor(3); fit -> Draw("esame"); delete info; info = new TLatex(); info->SetTextFont(132); info-> SetNDC(); info->SetTextSize(0.040); sprintf(legname,"%i. eta Bin",j+1); info->DrawLatex(0.60,0.80,legname); sprintf(legname,"fit = %4.3f #pm %4.3f",fit->GetParameter(0),fit->GetParError(0)); info -> DrawLatex(0.60,0.70,legname); info -> Draw("same"); sprintf(legname,"Chi^2 = %4.3f",fit->GetChisquare()); info -> DrawLatex(0.60,0.63,legname); info -> Draw("same"); sprintf(legname,"ndof = %i",fit->GetNDF()); info -> DrawLatex(0.60,0.56,legname); info -> Draw("same"); fileName.Form("MCClosure_for_%i_eta_bin%s_absoluteValues.pdf",j+1,file1); canvas2[j]->SaveAs(fileName); } return 0; }
void SUSY_bRPV_m0_vs_m12_all_withBand_cls( TString fname0="", TString fname1="", TString fname2="", TString gridname="", const char* prefix="test", const float& lumi = 20.3, bool showsig = true, int discexcl = 1, int showtevatron = 0, int showcms = 0, int showOneSigmaExpBand = 0, bool showSR = false, bool useShape = false, int channel = -1, TString hname0 = "sigp1clsf", TString hname1 = "sigp1expclsf", TString hname3 = "sigclsu1s", TString hname5 = "sigclsd1s", TString hname6 = "sigp1ref", TString fnameMass= "contourmacros/mSugraGridtanbeta10_gluinoSquarkMasses.root") { // set style and remove existing canvas' CombinationGlob::Initialize(); cout << "--- Plotting m0 versus m12 " << endl; // --- prepare // open reference files, and retrieve histogram cout << "--- Reading root base file: " << fname0 << endl; TFile* f0 = TFile::Open( fname0, "READ" ); if (!f0) { cout << "*** Error: could not retrieve histogram: " << hname0 << " in file: " << f0->GetName() << " ==> abort macro execution" << endl; return; } TFile *f1; TFile *f2; if(fname1 != "") f1 = TFile::Open( fname1, "READ" ); if(!f1) cout << "Warning: could not open " << fname1 << endl; if(fname2 != "") f2 = TFile::Open( fname2, "READ" ); if(!f2) cout << "Warning: could not open " << fname2 << endl; TH2F* histecls = (TH2F*)f0->Get( "sigp1expclsf" ); TH2F* histocls = (TH2F*)f0->Get( "sigp1clsf" ); if (histecls!=0) histecls->SetDirectory(0); if (histocls!=0) histocls->SetDirectory(0); TH2F* histe_esigxsp1s; if (fname1 != "" && f1) { histe_esigxsp1s = (TH2F*)f1->Get( hname0 ); cout << "Read up histogram " << histe_esigxsp1s << endl; } TH2F* histe_esigxsm1s; if (fname2 != "" && f2) { histe_esigxsm1s = (TH2F*)f2->Get( hname0 ); cout << "Read down histogram " << histe_esigxsm1s << endl; } if (histe_esigxsp1s!=0) histe_esigxsp1s->SetDirectory(0); if (histe_esigxsm1s!=0) histe_esigxsm1s->SetDirectory(0); TH2F* contour_esigxsp1s = ( histe_esigxsp1s!=0 ? FixAndSetBorders( *histe_esigxsp1s, "contour_esigxsp1s", "contour_esigxsp1s", 0 ) : 0); TH2F* contour_esigxsm1s = ( histe_esigxsm1s!=0 ? FixAndSetBorders( *histe_esigxsm1s, "contour_esigxsm1s", "contour_esigxsm1s", 0 ) : 0); // TFile* f3 = TFile::Open( fname3, "READ" ); TH2F* histe(0); TH2F* histe_u1s(0); TH2F* histe_d1s(0); // TFile* f4 = TFile::Open( fname4, "READ" ); bool extExpectation = 0; TH2F* hist0 = (TH2F*)f0->Get( hname0 ); TH2F* hist1 = (TH2F*)f0->Get( hname1 ); TH2F* hist3 = (TH2F*)f0->Get( hname3 ); TH2F* hist5 = (TH2F*)f0->Get( hname5 ); TH2F* hist6 = (TH2F*)f0->Get( hname6 ); if (hist0!=0) hist0->SetDirectory(0); if (hist1!=0) hist1->SetDirectory(0); if (hist3!=0) hist3->SetDirectory(0); if (hist5!=0) hist5->SetDirectory(0); if (hist6!=0) hist6->SetDirectory(0); f0->Close(); TH2F* histe_esigxsp1s; if (fname1!="" && f1) histe_esigxsp1s = (TH2F*)f1->Get( hname0 ); TH2F* histe_esigxsm1s; if (fname2!="" && f2) histe_esigxsm1s = (TH2F*)f2->Get( hname0 ); if (fname1!="" &&histe_esigxsp1s!=0) histe_esigxsp1s->SetDirectory(0); if (fname2!="" && histe_esigxsm1s!=0) histe_esigxsm1s->SetDirectory(0); TH2F* contour_esigxsp1s = ( histe_esigxsp1s!=0 ? FixAndSetBorders( *histe_esigxsp1s, "contour_esigxsp1s", "contour_esigxsp1s", 0 ) : 0); TH2F* contour_esigxsm1s = ( histe_esigxsm1s!=0 ? FixAndSetBorders( *histe_esigxsm1s, "contour_esigxsm1s", "contour_esigxsm1s", 0 ) : 0); TH2F* contour = ( hist1!=0 ? FixAndSetBorders( *hist1, "contour", "contour", 0 ) : 0); TH2F* contour_obs = ( hist0!=0 ? FixAndSetBorders( *hist0, "contour_obs", "contour_obs") : 0 ); TH2F* contour_ep1s = ( hist3!=0 ? FixAndSetBorders( *hist3, "contour", "contour", 0 ) : 0 ); TH2F* contour_em1s = ( hist5!=0 ? FixAndSetBorders( *hist5, "contour", "contour", 0 ) : 0 ); // For Band if (showOneSigmaExpBand){ TGraph* gr_contour_ep1s = ContourGraph( contour_ep1s )->Clone(); TGraph* gr_contour_em1s= ContourGraph( contour_em1s )->Clone(); } TH2F* contour_exp(0); if (histe!=0) { contour_exp = FixAndSetBorders( *histe, "contour_exp", "contour_exp", 0 ); } TH2F* contour_au1s(0); if (histe_u1s!=0) { contour_au1s = FixAndSetBorders( *histe_u1s, "contour", "contour", 0 ); } TH2F* contour_ad1s(0); if (histe_d1s!=0) { contour_ad1s = FixAndSetBorders( *histe_d1s, "contour", "contour", 0 ); } TH2F* contour_expcls(0); if (histecls!=0) { contour_expcls = FixAndSetBorders( *histecls, "contour_expcls", "contour_expcls", 0 ); } TH2F* contour_obscls(0); if (histocls!=0) { contour_obscls = FixAndSetBorders( *histocls, "contour_obscls", "contour_obscls", 0 ); } if (contour_obs==0) { cout << "contour is zero" << endl; return; } // set text style gStyle->SetPaintTextFormat(".2g"); if (hist1!=0) hist1->SetMarkerStyle(21); if (hist1!=0) hist1->SetMarkerSize(1.5); Float_t nsigmax(0) if (hist1!=0) nsigmax = hist1->GetMaximum(); // --- draw // create canvas TCanvas* c = new TCanvas( "c", "A scan of "+gridname, 0, 0, CombinationGlob::StandardCanvas[0], CombinationGlob::StandardCanvas[1] ); //c->SetGrayscale(); // create and draw the frame double plotrange=2250.; TH2F *frame = new TH2F("frame", "m_{gluino} vs. m_{lsp} - ATLAS work in progress", 100, 350.,plotrange, 100, 200., 900. ); // set common frame style CombinationGlob::SetFrameStyle2D( frame, 1.0 ); // the size (scale) is 1.0 frame->SetXTitle( "m_{0} [GeV]" ); frame->SetYTitle( "m_{1/2} [GeV]" ); frame->GetYaxis()->SetTitleOffset(1.35); //frame->SetTextFont( 42 ); frame->GetXaxis()->SetTitleFont( 42 ); frame->GetYaxis()->SetTitleFont( 42 ); frame->GetXaxis()->SetLabelFont( 42 ); frame->GetYaxis()->SetLabelFont( 42 ); frame->GetXaxis()->SetTitleSize( 0.04 ); frame->GetYaxis()->SetTitleSize( 0.04 ); frame->GetXaxis()->SetLabelSize( 0.04 ); frame->GetYaxis()->SetLabelSize( 0.04 ); frame->Draw(); const int nsig(3); //TH2F *chist[3]; // draw contours //!instead of printing sigma in 68% 95% 98% levels now printing +1 sigma deviations //for (Int_t nsigma=1; nsigma<=nsig; nsigma++) // DrawContourSameColor( contour, nsigma, "blue", kFALSE, (nsigma==1?inverse:0) ) ; TString basecolor="yellow"; Int_t nsigma=2; TLegend *leg = new TLegend(0.6,0.7,0.92,0.9); leg->SetTextSize( CombinationGlob::DescriptionTextSize ); leg->SetTextSize( 0.03 ); leg->SetTextFont( 42 ); leg->SetFillColor( 0 ); leg->SetFillStyle(1001); if (false && channel==1) { // electron cout << "removing islands in electron channel ..." << endl; // contour line is drawn for values at 1.64485 TAxis* ax = contour_obs->GetXaxis(); TAxis* ay = contour_obs->GetYaxis(); /* contour_em1s for (int xbin = 1; xbin <= contour_obs->GetNbinsX(); xbin++) { for (int ybin = 1; ybin <= contour_obs->GetNbinsY(); ybin++) { // island 2 if ( ax->GetBinCenter( xbin) > 420. && ax->GetBinCenter( xbin) < 480. && ay->GetBinCenter( ybin) > 140. && ay->GetBinCenter( ybin) < 160. ) { cout << "Found spot here: " << xbin << " (" << ax->GetBinCenter( xbin) << "), " << ybin << " (" << ay->GetBinCenter( ybin) << "), " << " value: " << contour->GetBinContent(xbin,ybin) << endl; cout << " HACK : Setting above point by hand to 1.50 (!)" << endl; contour->SetBinContent(xbin, ybin, 1.50); } } } */ } if (false && channel==2) { // combined cout << "removing islands in combined channel ..." << endl; } ///////////////////////////////////////////////////////// //// add 2011 results Int_t c_myYellow = TColor::GetColor("#ffe938"); Int_t c_myRed = TColor::GetColor("#aa000"); // turn off yellow band if (showOneSigmaExpBand) TGraph* grshadeExp= DrawExpectedBand( gr_contour_ep1s, gr_contour_em1s, CombinationGlob::c_DarkYellow , 1001 , 0)->Clone(); if (discexcl==1) { DrawContourLine95( leg, contour_obs, "Observed limit (#pm1 #sigma^{SUSY}_{theory})", c_myRed, 1, 4 ); // 95% CL_{S} if (contour_esigxsp1s) DrawContourLine95( leg, contour_esigxsp1s, "", c_myRed, 3, 2 ); // Observed limit #pm 1 #sigma^{SUSY}_{theory} if (contour_esigxsm1s) DrawContourLine95( leg, contour_esigxsm1s, "", c_myRed, 3, 2 ); // Observed limit #pm 1 #sigma^{SUSY}_{theory} if (!extExpectation) { // Compare the expected limits! if (contour_expcls!=0) { //DrawContourLine95( leg, contour_expcls, fname0, CombinationGlob::c_DarkGray, 6 ); DrawContourLine95( leg, contour_expcls, fname0, CombinationGlob::c_DarkBlueT3, 6 ); } if (showOneSigmaExpBand) { if (contour_ep1s!=0) { DrawContourLine95( leg, contour_ep1s, "", c_myYellow, 1 ); } if (contour_em1s!=0) { DrawContourLine95( leg, contour_em1s, "", c_myYellow, 1 ); } DummyLegendExpected(leg, "Expected limit (#pm1 #sigma_{exp})", c_myYellow, 1001, CombinationGlob::c_DarkBlueT3, 6, 2); } else { //if (contour!=0) DrawContourLine68( leg, contour, "exp. limit 68% CL", CombinationGlob::c_DarkBlueT3, 2 ); //if (contour!=0) DrawContourLine99( leg, contour, "exp. limit 99% CL", CombinationGlob::c_DarkBlueT3, 3 ); } } else { // expectation from asimov if (contour_exp!=0) DrawContourLine95( leg, contour_exp, "Median expected limit", CombinationGlob::c_DarkBlueT3, 6); if (showOneSigmaExpBand) { if (contour_au1s!=0) DrawContourLine95( leg, contour_au1s, "Expected limit #pm1#sigma", CombinationGlob::c_DarkBlueT3, 3 ); if (contour_ad1s!=0) DrawContourLine95( leg, contour_ad1s, "", CombinationGlob::c_DarkBlueT3, 3 ); } } } // plot tevatron limits TGraph* lep2slep(0); TGraph* lep2char(0); TGraph* d0o(0); TGraph* d0graph(0); TGraph* cdfgraph(0); TGraph* atlas(0); TGraph* atlasexp(0); if (showtevatron==1 && discexcl==1) { lep2char = ol1(); d0graph = d0tanb3muneg(); cdfgraph = cdftanb5(); //atlas = ATLAS10_1lepton(); //atlasexp = ATLAS10_1leptonexp(); } //:w(void) stautanb3(); TGraph* cmscurve(0); if (showcms==1) { //cmscurve = cmsoff(); cmscurve = cms(); } // legend Float_t textSizeOffset = +0.000; Double_t xmax = frame->GetXaxis()->GetXmax(); Double_t xmin = frame->GetXaxis()->GetXmin(); Double_t ymax = frame->GetYaxis()->GetXmax(); Double_t ymin = frame->GetYaxis()->GetXmin(); Double_t dx = xmax - xmin; Double_t dy = ymax - ymin; //TString t1a = "99%, 95%, 68% CL fit contour (excluded)" ; // TString t1a = "-1#sigma, central, +1#sigma fit contour (excluded)" ; TString t1b = "tan#beta = 3, A_{0}= 0, #mu < 0" ; Float_t nbkg(0); if( hist5!=0) nbkg = hist5->GetMaximum(); TString t1c = Form("MC: n_{bkg}= %.1f", nbkg) ; // TLatex* text1a = new TLatex( 70, 260, t1a ); TLatex* text1b = new TLatex( 150, ymax + dy*0.025, t1b ); TLatex* text1c = new TLatex( 70, 280, t1c ); // text1a->SetTextColor( 1 ); //CombinationGlob::c_VDarkGreen ); text1b->SetTextColor( 1 ); //CombinationGlob::c_VDarkGreen ); text1c->SetTextColor( 1 ); text1b->SetTextFont( 42 ); //CombinationGlob::c_VDarkGreen ); // text1a->SetTextAlign( 11 ); text1b->SetTextAlign( 11 ); text1c->SetTextAlign( 11 ); // text1a->SetTextSize( CombinationGlob::DescriptionTextSize + textSizeOffset ); text1b->SetTextSize( CombinationGlob::DescriptionTextSize ); text1c->SetTextSize( CombinationGlob::DescriptionTextSize ); TString plottitle="bRPV-MSUGRA: tan #beta = 30, A_{0}= -2m_{0}, #mu>0"; if(showSR){ std::cout << "--- printing best SRs" << std::endl; Show_SR(fname0, c, xmin, xmax, ymin, ymax, useShape, leg); } TLatex *Leg0 = new TLatex( xmin, ymax + dy*0.025,plottitle ); Leg0->SetTextAlign( 11 ); Leg0->SetTextFont( 42 ); Leg0->SetTextSize( CombinationGlob::DescriptionTextSize); Leg0->SetTextColor( 1 ); Leg0->AppendPad(); TLatex *Leg1 = new TLatex(); Leg1->SetNDC(); Leg1->SetTextAlign( 11 ); Leg1->SetTextFont( 42 ); Leg1->SetTextSize( CombinationGlob::DescriptionTextSize ); Leg1->SetTextColor( 1 ); Leg1->DrawLatex(0.15,0.78, Form("#int L dt = %1.1f fb^{-1}, #sqrt{s}=8 TeV",lumi)); // 0.32,0.87 if(useShape){ Leg1->DrawLatex(0.15,0.72, "0 leptons, 2-6 jets, 5-bin"); // 0.32,0.87 } else { Leg1->DrawLatex(0.15,0.72, "0 leptons, 2-6 jets"); // 0.32,0.87 } Leg1->AppendPad(); TLatex *Leg2 = new TLatex(); Leg2->SetNDC(); Leg2->SetTextAlign( 11 ); Leg2->SetTextSize( CombinationGlob::DescriptionTextSize ); Leg2->SetTextColor( 1 ); Leg2->SetTextFont(70); if (prefix!=0) { Leg2->DrawLatex(0.7,0.85,prefix); // 0.15,0.81 Leg2->AppendPad(); } TLatex *atlasLabel = new TLatex(); atlasLabel->SetNDC(); atlasLabel->SetTextFont( 42 ); atlasLabel->SetTextColor( 1 ); atlasLabel->SetTextSize( 0.05 ); atlasLabel->DrawLatex(0.15,0.87, "#bf{#it{ATLAS}} Internal"); // 0.15,0.87 atlasLabel->AppendPad(); //// draw number of signal events if (nsigmax>0 && showsig) { hist1->Draw("textsame"); } //else { // // draw grid for clarity // c->SetGrid(); //} //reddraw cahnnel label // c->SetGrid(); if (prefix!=0) { Leg2->AppendPad(); } // redraw axes frame->Draw( "sameaxis" ); // leg->Draw("same"); // update the canvas double xline=1000.; double yline=1000.; if (fname0.Contains("SS")) { xline=800.; yline=800.; } TLine *line=new TLine(200.,200.,xline,yline); line->SetLineStyle(3); //line->Draw(); c->Update(); gPad->RedrawAxis("same"); c->Update(); gPad->Update(); //////////////////////////////////////////////////////////////////////////////////////////// //gROOT->GetListOfSpecials()->Print(); TObjArray *contours = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours"); if (contours!=0) { //contours->Print("v"); TList *lcontour1 = (TList*)contours->At(0); //lcontour1->Print(); if (lcontour1!=0) { TGraph *gc1 = (TGraph*)lcontour1->First(); if (gc1!=0) { //gc1->Print(); //if (gc1->GetN() < 10) return; //gc1->SetMarkerStyle(21); //gc1->Draw("alp"); } } } //////////////////////////////////////////////////////////////////////////////////////////// // create plots // store histograms to output file TObjArray* arr = fname0.Tokenize("/"); TObjString* objstring = (TObjString*)arr->At( arr->GetEntries()-1 ); TString outfile = TString(Form("%1.2finvfb_",lumi)) + TString(Form("wband%d_",showOneSigmaExpBand)) + TString(Form("showcms%d_",showcms)) + objstring->GetString().ReplaceAll(".root",""); delete arr; if(!showSR) outfile += TString("_noLabel"); TString prefixsave = TString(prefix).ReplaceAll(" ","_") + Form("%1.2finvfb_",lumi) + Form("wband%d_",showOneSigmaExpBand); CombinationGlob::imgconv( c, Form("plots/atlascls_m0m12_%s",outfile.Data()) ); }
void ExtractSignalYield(string ModelName, string decayMode, float natural_width, bool dependsOnKtilde=0) { string dir = "/usr/users/dschaefer/root/results/"; string outputfile = ModelName+"_"+decayMode+"_signalYield.root"; //float natural_width =0.05; std::stringstream s; if(int(natural_width*100+0.5) == 10 or int(100*natural_width+0.5)==20 or int(natural_width*100+0.5)==30) { s << std::fixed << std::setprecision(1) << natural_width; } else { s << std::fixed << std::setprecision(2) << natural_width; } string swidth = s.str(); float ktilde; string sktilde; if(dependsOnKtilde) { ktilde = natural_width; sktilde = swidth; } TGraph* limit = getObservedLimit(ModelName,decayMode,natural_width,dependsOnKtilde); TGraph* limitUP = getLimitUp(ModelName,decayMode,natural_width,1,dependsOnKtilde); TGraph* limitDOWN = getLimitDown(ModelName,decayMode,natural_width,1,dependsOnKtilde); TGraph* limitUP2 = getLimitUp(ModelName,decayMode,natural_width,2,dependsOnKtilde); TGraph* limitDOWN2 = getLimitDown(ModelName,decayMode,natural_width,2,dependsOnKtilde); int number; float* masses; if(decayMode.find("lvjj")!=string::npos) { masses = new float[38]; number =38; float array[38] = {800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000,3100,3200,3300,3400,3500,3600,3700,3800,3900,4000,4100,4200,4300,4400,4500}; masses = array; } else { number = 29; masses = new float[29]; float array[29] = {1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000,3100,3200,3300,3400,3500,3600,3700,3800,3900,4000}; masses = array; } TGraph* gryellow = new TGraph(2*number); TGraph* grgreen = new TGraph(2*number); for(int m=0;m<number;m++) { gryellow->SetPoint(m,masses[m],limitUP->Eval(masses[m])); gryellow->SetPoint(number+m,masses[number-m-1],limitDOWN->Eval(masses[number-m-1])); grgreen->SetPoint(m,masses[m],limitUP2->Eval(masses[m])); grgreen->SetPoint(number+m,masses[number-m-1],limitDOWN2->Eval(masses[number-m-1])); } gryellow->SetFillColor(kYellow); grgreen->SetFillColor(kGreen); TCanvas* test = new TCanvas("test","test",400,400); test->SetLogy(); limitUP->SetFillColor(kGreen+2); limitUP->SetLineColor(kGreen+2); limitUP->SetLineWidth(-1504); //limitUP->Draw("ACP"); limitDOWN->SetFillColor(kBlue); limitDOWN->SetLineColor(kGreen+2); limitDOWN->SetLineWidth(-1504); //limitDOWN->Draw("CPsame"); gryellow->Draw("AFsame"); grgreen->Draw("Fsame"); limit->SetLineColor(kBlue); limit->SetLineWidth(3); limit->Draw("Lsame"); test->Update(); float lumi = 2.10*1000; //pb^-1 if(decayMode.find("jjjj")!=string::npos){lumi = 2.6*1000;}//pb^-1 //float *xs = getTheoryCrossSection(ModelName,0.1); //x values for which a theory prediction for production cross section exists float m_xs[10] = {800,900,1000,1500,1800,2000,2500,3000,3500,4500}; float BR_G_to_WW[10]; float BR_G_to_ZZ[10]; float *acceptance; float *N_expected; //float xs = 0.01; float *xs = new float[10]; if(dependsOnKtilde) { xs = getTheoryCrossSection(ModelName,ktilde); } else { for(int i=0;i<10;i++) { if(natural_width!=0) { ktilde = getKtilde(ModelName,m_xs[i],natural_width); //std::cout << m_xs[i] << " k = " << ktilde <<std::endl; xs[i] = getTheoryCrossSection(ModelName,m_xs[i],ktilde); } else { ktilde = getKtilde(ModelName,m_xs[i],0.02); //std::cout << m_xs[i] << " k = " << ktilde <<std::endl; xs[i] = getTheoryCrossSection(ModelName,m_xs[i],ktilde); } } } TGraph* production_xs = new TGraph(10,m_xs,xs); // TCanvas* c_xs = new TCanvas("c_xs","c_xs",400,400); // c_xs->SetLogy(); // production_xs->SetMarkerColor(1); // production_xs->GetXaxis()->SetTitle("m_G [GeV]"); // production_xs->GetYaxis()->SetTitle("theory production cross section"); // production_xs->Draw("AL"); if(!dependsOnKtilde) { acceptance = getAcceptance(ModelName,decayMode,m_xs,10); } else { acceptance = getAcceptance(decayMode,ktilde); } N_expected = getNumberOfExpectedEvents(xs,m_xs,acceptance,ModelName,decayMode); std::cout << "production cross section : "<< std::endl; for(int i=0;i<10;i++) { std::cout << m_xs[i] << " " << xs[i]<< std::endl; } std::cout << " acceptance : "<<std::endl; for(int i=0;i<10;i++) { std::cout << m_xs[i] << " "<<acceptance[i]<<std::endl; } float br[10]; std::cout << "Branching Ratios : "<<std::endl; for(int i=0;i<10;i++) { float BR_W_to_lv = 0.327; float BR_W_to_jj = 0.674; float BR_Z_to_jj = 0.6991; br[i] = getBranchingRatioToWW(ModelName,m_xs[i])*std::pow(BR_W_to_jj,2)*2 + getBranchingRatioToZZ(ModelName,m_xs[i])*std::pow(BR_Z_to_jj,2)*2; if(decayMode.find("lvjj")!=std::string::npos) { br[i] = getBranchingRatioToWW(ModelName,m_xs[i])*2*BR_W_to_lv*BR_W_to_jj; } std::cout << m_xs[i] << " "<< br[i] << std::endl; } std::cout << lumi <<std::endl; std::cout << " N expected : "<<std::endl; for(int i=0;i<10;i++) { std::cout << m_xs[i] << " "<<N_expected[i] << " " <<xs[i]*lumi*br[i]*acceptance[i] << std::endl; } TGraph* N = new TGraph(10,m_xs,N_expected); //N->SetName("expected signal yield"); grgreen->GetXaxis()->SetTitle("m_{VV} [GeV]"); grgreen->GetYaxis()->SetTitle("number signal events"); grgreen->GetYaxis()->SetTitleOffset(1.3); grgreen->SetTitle(""); TCanvas* c_N = new TCanvas("c_N","c_N",600,400); gPad->SetRightMargin(0.1); gPad->SetLeftMargin(0.1); limit->SetLineColor(kBlue); limit->SetLineWidth(3); c_N->SetLogy(); N->SetLineColor(kRed); N->SetLineWidth(2); //N->Draw("A"); grgreen->SetMaximum(1000); grgreen->Draw("AF"); gryellow->Draw("Fsame"); limit->Draw("Csame"); N->Draw("Lsame"); TLegend* leg = new TLegend(0.59,0.65,0.95,0.89); leg->SetFillColor(kWhite); leg->SetFillStyle(0); leg->SetTextSize(0.04); leg->SetBorderSize(0); string title = "Preliminary"; string cms = "#font[62]{CMS} #font[52]{"+string(title)+"} "; string lumitext = "2.6 fb^{-1}, #sqrt{s} = 13 TeV"; string cmstext = "CMS ,2.6 fb^{-1}, #sqrt{s} = 13 TeV"; if(decayMode.find("had")==string::npos){lumitext = "2.1 fb^{-1}, #sqrt{s} = 13 TeV";} string theory = "G #rightarrow WW, #Gamma = "+swidth; if(dependsOnKtilde) { theory = "G #rightarrow WW, #tilde{k} = "+sktilde; } if(ModelName.find("RSGrav")!=string::npos) { theory = "RS #rightarrow WW, #Gamma = "+swidth; if(dependsOnKtilde) { theory = "RS #rightarrow WW, #tilde{k} = "+sktilde; } } leg->AddEntry(grgreen,"Expected (95%)","f"); leg->AddEntry(gryellow,"Expected (68%)","f"); leg->AddEntry(limit,"observed","L"); leg->AddEntry(N,theory.c_str(),"L"); leg->Draw("same"); TLatex CMS; int y = 1050; int x = 500; int x2 = 3400; if(decayMode.find("jjjj")!= string::npos){y=1050;x=1000;x2=3000;} CMS.SetTextFont(43); CMS.SetTextSize(18); CMS.DrawLatex(x,y,cms.c_str()); CMS.DrawLatex(x2,y,lumitext.c_str()); c_N->Update(); if(dependsOnKtilde) { c_N->SaveAs(("/usr/users/dschaefer/root/results/misc/"+ModelName+"_limit_"+decayMode+"_ktilde"+swidth+".pdf").c_str()); } else { c_N->SaveAs(("/usr/users/dschaefer/root/results/misc/"+ModelName+"_limit_"+decayMode+"_"+swidth+".pdf").c_str()); } //=========================================================================================== //======== my own produced samples with ktilde = 0.095 ====================================== //=========================================================================================== float* acc2 = getAcceptance(decayMode,0.095); float* xs_new = getTheoryCrossSection(ModelName,0.095); for(int i=0;i<10;i++) { std::cout << " acceptance int : " << acceptance[i] <<std::endl; std::cout << " acceptance 2 : " << acc2[i] << std::endl; } // TGraph* testa // TCanvas* test2 = new TCanvas("test2","test2",400,400); // obsl->Draw("AL"); // Neve->Draw("LSAME"); float* N_expected2 = getNumberOfExpectedEvents(xs_new,m_xs,acc2,ModelName,decayMode); TGraph* obsl = getObservedLimit(ModelName,decayMode,0.095,1); TGraph* Neve = new TGraph(10,m_xs,N_expected2); TGraph* pl = getExcludedPoints(ModelName,decayMode,obsl,Neve,0.095); pl->SetLineWidth(3); pl->SetLineColor(kWhite); //pl->SetFillStyle(3013); //pl->SetFillColor(kWhite); string channel = "had"; if(decayMode.find("lvjj")!=std::string::npos) { channel = "em"; } TFile* file = new TFile(("/home/dschaefer/CMSSW_7_1_5/src/HiggsAnalysis/CombinedLimit/graphs_"+channel+".root").c_str(),"READ"); string histoname = "ExclusionLimitOnEventNumber_BulkG_WW_em_HP"; if(channel.find("had")!=std::string::npos) { histoname = "ExclusionLimitOnEventNumber_BulkWW_had_HP"; } TH2F* obsLim = dynamic_cast<TH2F*>(file->Get(histoname.c_str())); TCanvas* MyC = new TCanvas("MyC","MyC",800,600); MyC->SetRightMargin(0.19); // MyC->SetLeftMargin(0.12); // MyC->SetTopMargin(0.08); // MyC->SetBottomMargin(0.15); MyC->SetLogz(); obsLim->Draw("COLZ"); //pl->Draw("f"); pl->Draw("Same"); std::map<float,float> mass_acc; for(int i=0;i<10;i++) { mass_acc.insert(std::pair<float, float>(m_xs[i],acc2[i])); } TGraph* allpoints = findAllExcludedPoints(ModelName,decayMode, mass_acc,0.095); MyC->cd(); allpoints->Draw("Psame"); float massmax = 4500; float massmin = 800; int n = (massmax-massmin)/100; float* k = new float[n*2]; int t=0; for(int i=0;i<=n;i++) { k[i] = getKtilde("RSGrav",massmin+i*100,0.3); std::cout << "mass max: "<< massmin+i*100 << " ktilde " << k[i]<<std::endl; } for(int i=n;i<2*n;i++) { k[i] = getKtilde("RSGrav",massmin+(i-n)*100,0.02); std::cout << " mass min : "<< massmin+(i-n)*100 << " ktilde " << k[i] << std::endl; } printWidthForKtilde("RSGrav",0.12,3600,800); printWidthForKtilde("RSGrav",0.2 ,2400,800); printWidthForKtilde("RSGrav",0.3 ,1800,800); printWidthForKtilde("RSGrav",0.4 ,1500,800); printWidthForKtilde("RSGrav",0.5 ,1100 ,800); printWidthForKtilde("RSGrav",0.05,4500,2000); printWidthForKtilde("RSGrav",0.03,4600,3200); }
void Show_SR(TString oredList, TCanvas *can, float xlow, float xhigh, float ylow, float yhigh, bool useShape, TLegend *leg) { Int_t c_myRed = TColor::GetColor("#aa000"); can->cd(); TLatex lat; //lat.SetTextAlign( 11 ); lat.SetTextSize( 0.0265 ); lat.SetTextColor( 12 ); lat.SetTextFont( 42 ); cout << "Draw signal region labels." << endl; gROOT->ProcessLine(".L summary_harvest_tree_description.h+"); gSystem->Load("libSusyFitter.so"); TString txtfile=oredList; txtfile.ReplaceAll(".root",""); TTree* tree = harvesttree( txtfile!=0 ? txtfile : 0 ); if (tree==0) { cout << "Cannot open list file. Exit." << endl; return; } Float_t fID; Float_t m0; Float_t m12; TBranch *b_m0; TBranch *b_m12; TBranch *b_fID; tree->SetBranchAddress("m0", &m0, &b_m0); tree->SetBranchAddress("m12", &m12, &b_m12); tree->SetBranchAddress("fID", &fID, &b_fID); bool drawMarker; for( Int_t i = 0; i < tree->GetEntries(); i++ ){ drawMarker = false; tree->GetEntry( i ); cout << m0 << " " << m12 << " " << fID << endl; TMarker marker; //marker.SetMarkerColor(4); marker.SetMarkerSize(2.5); marker.SetMarkerStyle(29); int _m0 = (int) m0; int _m12 = (int) m12; if(oredList.Contains("GG")){ if( (_m0 == 700 && _m12 == 550) || (_m0 == 1162 && _m12 == 337) || (_m0 == 1250 && _m12 == 50) ) drawMarker = true; } else if(oredList.Contains("SS")){ if( (_m0 == 850 && _m12 == 100) || (_m0 == 450 && _m12 == 400)) drawMarker = true; } else if(oredList.Contains("SG")){ if( (_m0 == 1425 && _m12 == 525) || (_m0 == 1612 && _m12 == 37)) drawMarker = true; } if (drawMarker) marker.DrawMarker(m0, m12); TString mySR = GetSRName(fID, useShape); lat.DrawLatex(m0,m12,mySR.Data()); } leg->Draw("same"); // add up/down lines TLine *line1; TLine *line2; if (oredList.Contains("GG")) { line1 = new TLine( 972, 1412, 1062, 1412); line2 = new TLine( 972, 1355, 1062, 1355); cout << "GG line1" << endl; } else if (oredList.Contains("SS")) { line1 = new TLine( 793, 1128, 860, 1128); line2 = new TLine( 793, 1081, 860, 1081); cout << "SS line1" << endl; } else if (oredList.Contains("SG")) { line1 = new TLine( 1150, 1645, 1260, 1645); line2 = new TLine( 1150, 1565, 1260, 1565); cout << "SG line1" << endl; } /* line1->SetLineWidth(2); line1->SetLineColor(c_myRed); line1->SetLineStyle(3); line1->Draw("SAME") ; line2->SetLineWidth(2); line2->SetLineColor(c_myRed); line2->SetLineStyle(3); line2->Draw("SAME") ; */ }
void show_segment(int s) { TLatex lab; lab.SetTextColor(kBlue+3); lab.SetTextFont(42); lab.SetNDC(1); lab.SetTextSize(0.05); CE->cd(1); gPad->SetTheta(90); gPad->SetPhi(-0.0001); ell[s]->Draw(); hyp[s]->Draw("same"); EFP[0][s]->Draw(); EFP[1][s]->Draw(); el_cent[s]->Draw(); HFP[0][s]->Draw(); HFP[1][s]->Draw(); xcenter->Draw(); ycenter->Draw(); lab.DrawLatex(0.13, 0.915, Form("Ellipse, Hyperbola functions for Segment %d ", s+1 )); lab.SetTextColor(kRed); lab.SetTextSize(0.028); lab.DrawLatex(0.82, 0.65, "#bullet Ellipse Foci"); lab.DrawLatex(0.82, 0.58, "#diamond Ellipse Center"); lab.SetTextColor(kGreen-3); lab.DrawLatex(0.82, 0.50, "#bullet Hyperbola Foci"); // ZOOMED IN lab.SetTextSize(0.05); lab.SetTextColor(kBlue+3); lab.SetTextSize(0.05); CE->cd(2); gPad->SetTheta(90); gPad->SetPhi(0.0001); elz[s]->Draw(); hyz[s]->Draw("same"); EFP[0][s]->Draw(); EFP[1][s]->Draw(); HFP[0][s]->Draw(); HFP[1][s]->Draw(); x12[s]->Draw(); double minyf = 500; if(minyf>el_foci[3][s]) minyf = el_foci[3][s]; if(minyf>hp_foci[3][s]) minyf = hp_foci[3][s]; ycenter2->SetPoint(0, 0, minyf-31, 0); ycenter2->Draw(); ellipse_vert1->SetPoint(0, x12y12[0][s], x12y12[1][s], 0); ellipse_vert1->SetPoint(1, x12y12[0][s], 521, 0); ellipse_vert1->Draw(); el_start[s]->Draw(); ellipse_vert2->SetPoint(0, 0, el_y_sol[s], 0); ellipse_vert2->SetPoint(1, 0, 521, 0); ellipse_vert2->Draw(); lab.DrawLatex(0.36, 0.915, Form("Mirror Segment %d ", s+1 )); lab.SetTextColor(kRed); lab.SetTextSize(0.028); lab.DrawLatex(0.82, 0.65, "#bullet Ellipse Foci"); lab.SetTextColor(kBlack); lab.DrawLatex(0.82, 0.58, "#nabla Ellipse Limits"); lab.SetTextColor(kGreen-3); lab.DrawLatex(0.82, 0.50, "#bullet Hyperbola Foci"); lab.SetTextColor(kBlack); lab.DrawLatex(0.82, 0.42, "#times Hyperbola Limits"); hp_start[s]->Draw(); x21[s]->Draw(); CE->Print(Form("segment_%d.gif", s+1)); }
void overlay_plots(const string& fFile0, const string& fFile1, const string& fPlot, const double fXmin, const double fXmax, const string& fXAxisLabel, const string& fName, const int logY) { TH1F *h[2]; TFile file0(fFile0.c_str()); h[0] = (TH1F*)file0.Get(fPlot.c_str()); TFile file1(fFile1.c_str()); h[1] = (TH1F*)file1.Get(fPlot.c_str()); // double ymax = (h[0]->GetMaximum()>h[1]->GetMaximum()) ? h[0]->GetMaximum() : h[1]->GetMaximum(); h[0]->GetXaxis()->SetTitle(fXAxisLabel.c_str()); h[0]->GetXaxis()->SetRangeUser(fXmin,fXmax); // h[0]->GetYaxis()->SetRangeUser(0.5,1.25*ymax); h[0]->SetTitleOffset(1.2,"X"); h[0]->GetXaxis()->SetTitleSize(0.04); h[0]->GetYaxis()->SetTitleSize(0.04); double scale = h[1]->GetEntries()/h[0]->GetEntries(); h[0]->Scale(scale); TCanvas *c = new TCanvas("c","",800,800); c->cd(); h[0]->SetLineWidth(3); // h[0]->SetLineStyle(4); h[0]->SetLineColor(kRed); h[0]->SetFillColor(kRed); // h[0]->SetMarkerSize(.6); // h[0]->SetMarkerStyle(26); // h[0]->SetMarkerColor(kRed); h[0]->Draw("hist"); h[1]->SetLineWidth(3); // h[1]->SetLineStyle(3); h[1]->SetLineColor(kBlack); // h[1]->SetMarkerSize(.8); h[1]->SetMarkerStyle(20); h[1]->SetMarkerColor(kBlack); h[1]->Draw("sames"); //update the current pad, needed to modify statboxes gPad->Update(); // get the statboxes and set color TPaveStats *st1 = (TPaveStats*)h[0]->GetListOfFunctions()->FindObject("stats"); st1->SetTextColor(kRed); st1->SetLineColor(kRed); st1->SetOptStat(1111111); TPaveStats *st2 = (TPaveStats*)h[1]->GetListOfFunctions()->FindObject("stats"); st2->SetTextColor(kBlack); st2->SetLineColor(kBlack); st2->SetOptStat(1111111); // set the position of the statboxes double x1 = st1->GetX1NDC(); double y1 = st1->GetY1NDC(); double x2 = st1->GetX2NDC(); double y2 = st1->GetY2NDC(); //double xx = x2-x1; double yy = y2-y1; st2->SetX1NDC(x1); st2->SetY1NDC(y1-yy); st2->SetX2NDC(x2); st2->SetY2NDC(y1); gPad->Modified(); TLegend *legend = new TLegend(.4,.91,.75,.99); legend->SetBorderSize(1); legend->SetFillColor(0); // legend->SetFillStyle(0); legend->AddEntry(h[0],"MC","l"); legend->AddEntry(h[1],"Data","l"); legend->Draw(); TLatex l; l.SetTextAlign(12); l.SetTextSize(0.04); l.SetTextFont(62); l.SetNDC(); l.DrawLatex(0.40,0.15,"CMS 2009 Preliminary"); if(logY==1) c->SetLogy(); string fileName = fName; c->SaveAs(fileName.c_str()); delete legend; delete c; }
void plotPPDPhiAll(){ bool isPF = false; TString data_tag; TString mc_tag; TString jetfinder, jetfinder_tag; if(!isPF){ data_tag = "hdata_ak5calo_DijetDPhi"; mc_tag = "hmc_ak5calo_DijetDPhi_histonly"; jetfinder_tag = "calo"; }else{ data_tag = "hdata_ak5pf_DijetDPhi"; mc_tag = "hmc_ak5pf_DijetDPhi_histonly"; jetfinder_tag ="pf"; } TFile *fDATA = new TFile(Form("./%s.root",data_tag.Data())); TFile *fMC = new TFile(Form("./%s.root",mc_tag.Data())); TH1F *hDijetBal_data = (TH1F*) fDATA->Get("hDataDijetDPhi"); TH1F *hDijetBal_mc = (TH1F*) fMC->Get("hQCDDijetDPhi"); // normalization should be matched with what's in ANA hDijetBal_data->Scale(1./hDijetBal_data->Integral()); //hDijetBal_data->Rebin(2); hDijetBal_mc->Scale(1./hDijetBal_mc->Integral()); //hDijetBal_mc->Rebin(2); cout<<"Bin Width = "<<hDijetBal_data->GetBinWidth(1)<<endl; // canvas setting --- TCanvas *c1 = new TCanvas("c1","",490,550); c1->SetLogy(); // dum styling ---- TH1F *hDum = new TH1F("hDum","",10,0,3.142); hDum->SetLineColor(kBlue); //hDum->SetFillColor(kAzure-8); //hDum->SetFillStyle(3005); hDum->SetStats(0); hDum->SetXTitle("#Delta#phi (rad)"); hDum->SetYTitle("Event Fraction"); hDum->GetXaxis()->SetLabelSize(30); hDum->GetXaxis()->SetLabelFont(43); hDum->GetXaxis()->SetTitleSize(30); hDum->GetXaxis()->SetTitleFont(43); hDum->GetXaxis()->SetTitleOffset(1.2); hDum->GetXaxis()->CenterTitle(); hDum->GetXaxis()->SetNdivisions(905,true); hDum->GetYaxis()->SetLabelSize(30); hDum->GetYaxis()->SetLabelFont(43); hDum->GetYaxis()->SetTitleSize(30); hDum->GetYaxis()->SetTitleFont(43); hDum->GetYaxis()->SetTitleOffset(1.6); hDum->GetYaxis()->CenterTitle(); hDum->SetAxisRange(3E-3,0.5,"Y"); // data, mc styling hDijetBal_mc->SetLineColor(kBlue); hDijetBal_mc->SetFillColor(kAzure-8); hDijetBal_mc->SetFillStyle(3352); hDum->Draw("hist"); hDijetBal_mc->SetMarkerSize(2.0); hDijetBal_mc->Draw("histsame"); hDijetBal_data->SetMarkerSize(2.0); hDijetBal_data->Draw("pzsame"); // Legend TLegend *t3=new TLegend(0.21,0.56,0.8,0.81); //t3->SetHeader("ant-k_{T} (R=0.5) CaloJets"); t3->AddEntry(hDijetBal_data,"p + p #sqrt{s}=7.0 TeV","pl"); t3->AddEntry(hDijetBal_mc,"PYTHIA","lf"); t3->SetFillColor(0); t3->SetBorderSize(0); t3->SetFillStyle(0); t3->SetTextFont(63); t3->SetTextSize(20); t3->Draw(); // other labeling TLatex *cms = new TLatex(0.24,0.33,"CMS"); cms->SetTextFont(63); cms->SetTextSize(20); cms->Draw(); TLatex *lumi = new TLatex(1.54,0.33,"#intL dt = 35.1 pb^{-1}"); lumi->SetTextFont(63); lumi->SetTextSize(18); lumi->Draw(); TLatex *jetf; if(!isPF) jetf = new TLatex(0.24,0.23,"anti-k_{T} (R=0.5) CaloJets"); else jetf = new TLatex(0.24,0.23,"anti-k_{T} (R=0.5) PFJets"); jetf->SetTextFont(63); jetf->SetTextSize(20); jetf->Draw(); c1->Print(Form("./fig/dphi_%s_%s_v1.gif",data_tag.Data(),jetfinder_tag.Data())); c1->Print(Form("./fig/dphi_%s_%s_v1.pdf",data_tag.Data(),jetfinder_tag.Data())); c1->Print(Form("./fig/dphi_%s_%s_v1.eps",data_tag.Data(),jetfinder_tag.Data())); }
void NuclearModificationFactorCent(TString inputPP="ROOTfiles/CrossSectionPP.root", TString inputPbPb="ROOTfiles/CrossSectionPbPb.root", TString inputEffPP = "ROOTfiles/MCstudiesPP_INC.root", TString inputEffPbPb = "ROOTfiles/MCstudiesPbPb_CENT.root", TString label="PbPb", TString outputfile="RAAfile.root", int doDataCor = 0, double PPlumi=1., double nMBEvt=1., Float_t centMin=0., Float_t centMax=100.) { float pti = _ptBins[0]; float pte = _ptBins[_nBins]; gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gStyle->SetEndErrorSize(0); gStyle->SetMarkerStyle(20); gStyle->SetPadRightMargin(0.03);//###0.020 gStyle->SetPadLeftMargin(0.12); gStyle->SetPadTopMargin(0.075); gStyle->SetPadBottomMargin(0.12); TFile *fpp=new TFile(inputPP.Data()); TFile *fPbPb=new TFile(inputPbPb.Data()); TFile *fEffpp=new TFile(inputEffPP.Data()); TFile *fEffPbPb=new TFile(inputEffPbPb.Data()); TH1D*hSigmaPP1Bin=(TH1D*)fpp->Get("hPt"); TH1D*hSigmaPbPb=(TH1D*)fPbPb->Get("hPt"); TH1D*hEffPP1Bin=(TH1D*)fEffpp->Get("hEff"); TH1D*hEffPbPb=(TH1D*)fEffPbPb->Get("hEff"); TH1D*hSigmaPPStat = new TH1D("hSigmaPPStat","",_nBins,_ptBins); TH1D*hEffPP = new TH1D("hEffPP","",_nBins,_ptBins); for(int i=0;i<_nBins;i++){ hSigmaPPStat->SetBinContent(i+1,hSigmaPP1Bin->GetBinContent(1)); hSigmaPPStat->SetBinError(i+1,hSigmaPP1Bin->GetBinError(1)); hEffPP->SetBinContent(i+1,hEffPP1Bin->GetBinContent(1)); hEffPP->SetBinError(i+1,hEffPP1Bin->GetBinError(1)); } if(doDataCor != 1) hSigmaPPStat->Divide(hEffPP); hSigmaPPStat->Scale(1./(2*PPlumi*BRchain)); TH1D*hSigmaPbPbStat=(TH1D*)fPbPb->Get("hPt"); for(int i=0;i<_nBins;i++){ } hSigmaPbPbStat->SetName("hSigmaPbPbStat"); if(doDataCor != 1) hSigmaPbPbStat->Divide(hEffPbPb); hSigmaPbPbStat->Divide(hSigmaPPStat); for(int i=0;i<_nBins;i++){ double pbpbScale = 2*BRchain*(nMBEvt*(_ptBins[i+1]-_ptBins[i])/2/100*TAA[i]/1e9); hSigmaPbPbStat->SetBinContent(i+1, hSigmaPbPbStat->GetBinContent(i+1)/pbpbScale); hSigmaPbPbStat->SetBinError(i+1, hSigmaPbPbStat->GetBinError(i+1)/pbpbScale); //std::cout<<"RAA: "<<hSigmaPbPbStat->GetBinContent(i+1)<<std::endl; } /* double mod_ptBins[_nBins+1]; for(int i=0;i<_nBins+1;i++){ mod_ptBins[i] = _ptBins[i]/2.; } TH1D*hNuclearModification = new TH1D("hNuclearModification","",_nBins,mod_ptBins); for(int i=0;i<_nBins;i++){ hNuclearModification->SetBinContent(i+1, hSigmaPbPbStat->GetBinContent(i+1)); hNuclearModification->SetBinError(i+1, hSigmaPbPbStat->GetBinError(i+1)); } double apt[_nBins]; //bin half width double aptl[_nBins]; //number of every rebined bin double bin_num[_nBins]; for (int ibin=0; ibin<_nBins; ibin++){ apt[ibin]=(mod_ptBins[ibin+1]+mod_ptBins[ibin])/2.; aptl[ibin] = (mod_ptBins[ibin+1]-mod_ptBins[ibin])/2; bin_num[ibin]=aptl[ibin]/binsize*2; } pti = pti/2.; pte = pte/2.; Double_t xr[_nBins], yr[_nBins], xrlow[_nBins], yrlow[_nBins],xrhigh[_nBins],yrhigh[_nBins]; for(int i=0;i<_nBins;i++) { yr[i] = hNuclearModification->GetBinContent(i+1); double systematic=0.01*systematicsForRAACent(hNuclearModification->GetBinCenter(i+1),centMin,centMax,0.,0.); //double systematic=0.; yrlow[i] = hNuclearModification->GetBinContent(i+1)*systematic; yrhigh[i] =hNuclearModification->GetBinContent(i+1)*systematic; } */ double mod_ptBins[_nBins]; for(int i=0;i<_nBins;i++){ mod_ptBins[i] = npart[_nBins-1-i]; } double apt[_nBins]; //bin half width double aptl[_nBins]; //number of every rebined bin double bin_num[_nBins]; for (int ibin=0; ibin<_nBins; ibin++){ apt[ibin] = mod_ptBins[ibin]; aptl[ibin] = 10; } pti = 0; pte = apt[_nBins-1]+50; Double_t xr[_nBins], yr[_nBins], xrlow[_nBins], yrlow[_nBins],xrhigh[_nBins],yrhigh[_nBins]; Double_t yrStatlow[_nBins], yrStathigh[_nBins]; for(int i=0;i<_nBins;i++) { yr[i] = hSigmaPbPbStat->GetBinContent(_nBins-i); double systematic=0.01*systematicsForRAACent(hSigmaPbPbStat->GetBinCenter(_nBins-i)/2.,centMin,centMax,0.,0.); //double systematic=0.; yrStatlow[i] = hSigmaPbPbStat->GetBinError(_nBins-i); yrStathigh[i] = hSigmaPbPbStat->GetBinError(_nBins-i); yrlow[i] = hSigmaPbPbStat->GetBinContent(_nBins-i)*systematic; yrhigh[i] = hSigmaPbPbStat->GetBinContent(_nBins-i)*systematic; } TGraphAsymmErrors* hNuclearModification = new TGraphAsymmErrors(_nBins,apt,yr,aptl,aptl,yrStatlow,yrStathigh); hNuclearModification->SetName("hNuclearModification"); TGraphAsymmErrors* gNuclearModification = new TGraphAsymmErrors(_nBins,apt,yr,aptl,aptl,yrlow,yrhigh); gNuclearModification->SetName("gNuclearModification"); TCanvas*canvasRAA=new TCanvas("canvasRAA","canvasRAA",600,600); canvasRAA->cd(); //canvasRAA->SetLogx(); TH2F* hemptyEff=new TH2F("hemptyEff","",50,pti,pte,10.,0,1.55); hemptyEff->GetXaxis()->CenterTitle(); hemptyEff->GetYaxis()->CenterTitle(); hemptyEff->GetYaxis()->SetTitle("B^{+} R_{AA}"); hemptyEff->GetXaxis()->SetTitle("N_{part}"); hemptyEff->GetXaxis()->SetTitleOffset(1.0); hemptyEff->GetYaxis()->SetTitleOffset(1.1); hemptyEff->GetXaxis()->SetTitleSize(0.05); hemptyEff->GetYaxis()->SetTitleSize(0.05); hemptyEff->GetXaxis()->SetTitleFont(42); hemptyEff->GetYaxis()->SetTitleFont(42); hemptyEff->GetXaxis()->SetLabelFont(42); hemptyEff->GetYaxis()->SetLabelFont(42); hemptyEff->GetXaxis()->SetLabelSize(0.04); hemptyEff->GetYaxis()->SetLabelSize(0.04); hemptyEff->SetMaximum(2); hemptyEff->SetMinimum(0.); hemptyEff->Draw(); TLine *line = new TLine(pti,1,pte,1); line->SetLineStyle(2); line->SetLineWidth(2); line->Draw(); //gNuclearModification->SetFillColor(5);//1 gNuclearModification->SetFillColor(kOrange);//1 gNuclearModification->SetFillStyle(3001);//0 gNuclearModification->SetLineWidth(1);//3 gNuclearModification->SetMarkerSize(1); gNuclearModification->SetMarkerStyle(21); //gNuclearModification->SetLineColor(1);//kGreen+4 //gNuclearModification->SetMarkerColor(1);//kGreen+4 gNuclearModification->SetLineColor(kOrange);//kGreen+4 //gNuclearModification->SetMarkerColor(kOrange);//kGreen+4 gNuclearModification->SetMarkerColor(kRed);//kGreen+4 gNuclearModification->Draw("5same"); hNuclearModification->SetLineWidth(3); hNuclearModification->SetLineColor(kRed); hNuclearModification->SetMarkerColor(kRed); hNuclearModification->SetMarkerStyle(21); //hNuclearModification->Draw("same"); hNuclearModification->Draw("same p"); Float_t systnorm = normalizationUncertaintyForRAA()*1.e-2; TBox* bSystnorm = new TBox(pti,1-systnorm,pti+10,1+systnorm); if(drawDRAA) bSystnorm = new TBox(pti,1-systnorm,pti+10,1+systnorm); bSystnorm->SetLineColor(16); bSystnorm->SetFillColor(16); bSystnorm->Draw(); TLatex * tlatexeff2=new TLatex(0.41,0.58,Form("p_{T} %.0f-%.0f (GeV/c)",ptBinsInc[0], ptBinsInc[1])); tlatexeff2->SetNDC(); tlatexeff2->SetTextColor(1); tlatexeff2->SetTextFont(42); tlatexeff2->SetTextSize(0.050); tlatexeff2->Draw(); TLatex * texY = new TLatex(0.41,0.53,"|y| < 2.4");//0.2612903,0.8425793 texY->SetNDC(); texY->SetTextColor(1); texY->SetTextFont(42); texY->SetTextSize(0.045); texY->SetLineWidth(2); //texY->Draw(); TLatex* texlumi = new TLatex(0.13,0.936,"27.7 pb^{-1} (5.02 TeV pp) + 350.68 #mub^{-1} (5.02 TeV PbPb)"); texlumi->SetNDC(); //texlumi->SetTextAlign(31); texlumi->SetTextFont(42); texlumi->SetTextSize(0.038); texlumi->SetLineWidth(2); texlumi->Draw(); TLatex* texcms = new TLatex(0.15,0.90,"CMS"); texcms->SetNDC(); texcms->SetTextAlign(13); texcms->SetTextFont(62);//61 texcms->SetTextSize(0.06); texcms->SetLineWidth(2); texcms->Draw(); TLatex* texpre = new TLatex(0.15,0.84,"Preliminary"); texpre->SetNDC(); texpre->SetTextAlign(13); texpre->SetTextFont(52); texpre->SetTextSize(0.05); texpre->SetLineWidth(2); texpre->Draw(); //TLegend *legendSigma=new TLegend(0.40,0.5168644,0.8084677,0.6605932,""); TLegend *legendSigma=new TLegend(0.5436242,0.7474695,0.942953,0.8457592,""); if(drawDRAA)legendSigma=new TLegend(0.5436242,0.6774695,0.942953,0.8757592,""); legendSigma->SetBorderSize(0); legendSigma->SetLineColor(0); legendSigma->SetFillColor(0); legendSigma->SetFillStyle(1001); legendSigma->SetTextFont(42); legendSigma->SetTextSize(0.045); // TLegendEntry *ent_SigmaPP=legendSigma->AddEntry(hNuclearModification,"R_{AA} stat. unc.","pf"); // ent_SigmaPP->SetTextFont(42); // ent_SigmaPP->SetLineColor(1); // ent_SigmaPP->SetMarkerColor(1); // ent_SigmaPP->SetTextSize(0.045); // // TLegendEntry *ent_Sigmapp=legendSigma->AddEntry(gNuclearModification,"R_{AA} syst.","f"); // ent_Sigmapp->SetTextFont(42); // ent_Sigmapp->SetLineColor(5); // ent_Sigmapp->SetMarkerColor(1); // ent_Sigmapp->SetTextSize(0.045); TLegendEntry *ent_B = legendSigma->AddEntry(gNuclearModification,"R_{AA} B^{+} |y| < 2.4","pf"); ent_B->SetTextFont(42); ent_B->SetLineColor(4); ent_B->SetMarkerColor(4); ent_B->SetTextSize(0.043);//0.03 TLatex* texSystnorm = new TLatex(0.23,0.70,"T_{AA} and lumi."); if(drawDRAA) texSystnorm = new TLatex(0.17,0.70,"T_{AA} and lumi."); texSystnorm->SetNDC(); texSystnorm->SetTextColor(1); texSystnorm->SetTextFont(42); texSystnorm->SetTextSize(0.04); texSystnorm->SetLineWidth(2); texSystnorm->Draw(); texSystnorm = new TLatex(0.23,0.65,"uncertainty"); if(drawDRAA) texSystnorm = new TLatex(0.17,0.65,"uncertainty"); texSystnorm->SetNDC(); texSystnorm->SetTextColor(1); texSystnorm->SetTextFont(42); texSystnorm->SetTextSize(0.04); texSystnorm->SetLineWidth(2); texSystnorm->Draw(); if(drawDRAA){ TGraphAsymmErrors* gDNuclearModification = new TGraphAsymmErrors(); Draw_DRAA(canvasRAA, gDNuclearModification); gDNuclearModification->SetFillColor(kYellow-9); TLegendEntry *ent_Dhighpt = legendSigma->AddEntry(gDNuclearModification,"R_{AA} D^{0} |y| < 1.0","pf"); ent_Dhighpt->SetTextFont(42); ent_Dhighpt->SetLineColor(4); ent_Dhighpt->SetMarkerColor(4); ent_Dhighpt->SetTextSize(0.043);//0.03 } legendSigma->Draw(); canvasRAA->Update(); canvasRAA->RedrawAxis(); TString _postfix = ""; if(doDataCor==1) _postfix = "_EFFCOR"; if(!drawDRAA){ canvasRAA->SaveAs(Form("plotRAA/canvasRAA%s_%.0f_%.0f_Cent%s.pdf",label.Data(),centMin,centMax,_postfix.Data())); canvasRAA->SaveAs(Form("plotRAA/canvasRAA%s_%.0f_%.0f_Cent%s.png",label.Data(),centMin,centMax,_postfix.Data())); } if(drawDRAA){ canvasRAA->SaveAs(Form("plotRAA/canvasRAA_DRAA_%s_%.0f_%.0f_Cent%s.pdf",label.Data(),centMin,centMax,_postfix.Data())); canvasRAA->SaveAs(Form("plotRAA/canvasRAA_DRAA_%s_%.0f_%.0f_Cent%s.png",label.Data(),centMin,centMax,_postfix.Data())); } TFile *fRAA=new TFile(outputfile.Data(),"recreate"); fRAA->cd(); gNuclearModification->Write(); hNuclearModification->Write(); }
void plotPPBalance_Ratio(){ bool isPF = true; TString data_tag; TString mc_tag; TString jetfinder, jetfinder_tag; if(!isPF){ data_tag = "hdata_ak5calo_DijetBalance"; mc_tag = "hmc_ak5calo_DijetBalance_histonly"; jetfinder_tag = "calo"; }else{ data_tag = "hdata_ak5pf_DijetBalance"; mc_tag = "hmc_ak5pf_DijetBalance_histonly"; jetfinder_tag ="pf"; } TFile *fDATA = new TFile(Form("./%s.root",data_tag.Data())); TFile *fMC = new TFile(Form("./%s.root",mc_tag.Data())); TH1F *hDijetBal_data = (TH1F*) fDATA->Get("hDataDijetBalance"); TH1F *hDijetBal_mc = (TH1F*) fMC->Get("hQCDDijetBalance"); // normalization should be matched with what's in ANA hDijetBal_data->Scale(1./hDijetBal_data->Integral()); hDijetBal_data->Rebin(2); hDijetBal_mc->Scale(1./hDijetBal_mc->Integral()); hDijetBal_mc->Rebin(2); cout<<"Bin Width = "<<hDijetBal_data->GetBinWidth(1)<<endl; // canvas setting --- TCanvas *c1 = new TCanvas("c1","",550,600); // dum styling ---- TH1F *hDum = new TH1F("hDum","",10,0,1.0); hDum->SetLineColor(kBlue); hDum->SetFillColor(kAzure-8); hDum->SetFillStyle(3005); hDum->SetStats(0); hDum->SetXTitle("A_{J} = (p_{T}^{j1}-p_{T}^{j2})/(p_{T}^{j1}+p_{T}^{j2})"); hDum->SetYTitle("Data/PYTHIA"); hDum->GetXaxis()->SetLabelSize(30); hDum->GetXaxis()->SetLabelFont(43); hDum->GetXaxis()->SetTitleSize(30); hDum->GetXaxis()->SetTitleFont(43); hDum->GetXaxis()->SetTitleOffset(1.3); hDum->GetXaxis()->CenterTitle(); hDum->GetXaxis()->SetNdivisions(905,true); hDum->GetYaxis()->SetLabelSize(30); hDum->GetYaxis()->SetLabelFont(43); hDum->GetYaxis()->SetTitleSize(30); hDum->GetYaxis()->SetTitleFont(43); hDum->GetYaxis()->SetTitleOffset(1.7); hDum->GetYaxis()->CenterTitle(); hDum->SetAxisRange(0,5,"Y"); // data, mc styling hDijetBal_mc->SetLineColor(kBlue); hDijetBal_mc->SetFillColor(kAzure-8); hDijetBal_mc->SetFillStyle(3005); hDum->Draw("hist"); hDijetBal_data->SetMarkerSize(2.0); hDijetBal_data->SetMarkerSize(2.0); hDijetBal_data->Sumw2(); hDijetBal_mc->Sumw2(); hDijetBal_data->Divide(hDijetBal_mc); hDijetBal_data->Draw("pzsame"); // Legend TLegend *t3=new TLegend(0.20,0.54,0.58,0.79); //t3->SetHeader("ant-k_{T} (R=0.5) CaloJets"); t3->AddEntry(hDijetBal_data,"p + p #sqrt{s}=7.0 TeV","pl"); //t3->AddEntry(hDijetBal_mc,"PYTHIA","lf"); t3->SetFillColor(0); t3->SetBorderSize(0); t3->SetFillStyle(0); t3->SetTextFont(63); t3->SetTextSize(20); t3->Draw(); // other labeling TLatex *cms = new TLatex(0.06,4.5,"CMS"); cms->SetTextFont(63); cms->SetTextSize(20); cms->Draw(); TLatex *lumi = new TLatex(0.3,4.5,"#intL dt = 35.1 pb^{-1}"); lumi->SetTextFont(63); lumi->SetTextSize(18); lumi->Draw(); TLatex *jetf; if(!isPF) jetf = new TLatex(0.06,4.0,"anti-k_{T} (R=0.5) CaloJets"); else jetf = new TLatex(0.06,4.0,"anti-k_{T} (R=0.5) PFJets"); jetf->SetTextFont(63); jetf->SetTextSize(20); jetf->Draw(); c1->Print(Form("./fig/ratio_%s_%s_v1.gif",data_tag.Data(),jetfinder_tag.Data())); c1->Print(Form("./fig/ratio_%s_%s_v1.pdf",data_tag.Data(),jetfinder_tag.Data())); c1->Print(Form("./fig/ratio_%s_%s_v1.eps",data_tag.Data(),jetfinder_tag.Data())); }
void Unfolded ( bool drawRatio = 1, int differential = 0, int nsel = 0, int ReBin = 1, TString XTitle = "p_{T,max}^{l} (GeV)", TString units = "", TString plotName = "data/XSLeadingPt_AN.root", TString outputName = "WW_LeadingPt_final", bool isLogY = false, double lumi = 19.5 ) { gInterpreter->ExecuteMacro("GoodStyle.C"); std::cout << "reading " << plotName << std::endl ; TFile* file = new TFile(plotName, "read"); //---- prepare the object that is making the plots //---- ---- ---- ---- ---- ---- ---- ---- ---- ---- std::cout << "setting up the plot object " << std::endl ; TH1F* xsValue = (TH1F*) xsValue->Clone(); TH1F* xsValue_Powheg = (TH1F*) xsValue_Powheg->Clone(); TH1F* xsValue_Madgraph = (TH1F*) xsValue_Madgraph->Clone(); TH1F* xsValue_MCnlo = (TH1F*) xsValue_MCnlo->Clone(); TH1F* systHisto = (TH1F*) systHisto->Clone(); TCanvas* canvas ; TPad *pad1, *pad2, *pad3, *pad4; if (drawRatio) { canvas = new TCanvas("wwxs", "wwxs", 600, 850); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); canvas->SetHighLightColor(2); canvas->Range(0,0,1,1); canvas->SetFillColor(0); canvas->SetBorderMode(0); canvas->SetBorderSize(2); canvas->SetTickx(1); canvas->SetTicky(1); canvas->SetLeftMargin(0.16); canvas->SetRightMargin(0.02); canvas->SetTopMargin(0.05); canvas->SetBottomMargin(0.13); canvas->SetFrameFillStyle(0); canvas->SetFrameBorderMode(0); pad1 = new TPad("pad1", "pad1",0.01,0.55,0.99,0.99); pad1->Draw(); pad1->cd(); pad1->Range(-147.2973,-5.811723,960.8108,2.535539); pad1->SetFillColor(0); pad1->SetBorderMode(0); pad1->SetBorderSize(2); pad1->SetLogy(); pad1->SetTickx(1); pad1->SetTicky(1); pad1->SetLeftMargin(0.16); pad1->SetBottomMargin(0); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); } else { canvas = new TCanvas("wwxs", "wwxs", 550, 550); } if (drawRatio) pad1->cd(); std::cout << " now plot " << std::endl; //Plot Data xsValue->SetLineWidth(1); xsValue->SetMarkerSize(1.0); int NBins = xsValue->GetNbinsX(); for(int i=1; i <NBins; i++) { float err_stat = xsValue->GetBinError(i); float err_syst = systHisto->GetBinError(i); float err_total = sqrt(err_stat*err_stat + err_syst*err_syst); xsValue->SetBinError(i, err_total); } //-- Plot Powheg TH1F *hpowError = (TH1F*) xsValue_Powheg->Clone(); xsValue_Powheg->SetMarkerColor(kGreen+2); xsValue_Powheg->SetLineWidth(1); xsValue_Powheg->SetLineColor(kGreen+2); xsValue_Powheg->SetMarkerStyle(22); xsValue_Powheg->SetMarkerSize(1.2); hpowError->SetLineWidth(0); hpowError->SetMarkerSize ( 0); hpowError->SetFillColor (kGreen-7); //-- Plot Madgraph TH1F *hmadError = (TH1F*) xsValue_Madgraph->Clone(); xsValue_Madgraph->SetMarkerColor(kMagenta); xsValue_Madgraph->SetLineWidth(1); xsValue_Madgraph->SetLineStyle(1); xsValue_Madgraph->SetMarkerStyle(21); xsValue_Madgraph->SetMarkerSize(1.0); hmadError->SetLineWidth(0); hmadError->SetMarkerSize ( 0); hmadError->SetFillColor (kMagenta-10); //-- Plot MCNLO TH1F *hmcError = (TH1F*) xsValue_MCnlo->Clone(); xsValue_MCnlo->SetMarkerColor(kRed); xsValue_MCnlo->SetLineColor(kRed); xsValue_MCnlo->SetLineWidth(1); xsValue_MCnlo->SetLineStyle(1); xsValue_MCnlo->SetMarkerStyle(24); xsValue_MCnlo->SetMarkerSize(1.0); hmcError->SetLineWidth(0); hmcError->SetMarkerSize ( 0); hmcError->SetFillColor (kOrange); //-- Plot Data xsValue->SetMarkerStyle(kFullCircle); if (differential == 0) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} d#sigma(WW#rightarrow#mu#nue#nu + < 1 jet)/dp_{T,max}^{l}"); if (differential == 1) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} d#sigma(WW#rightarrow#mu#nue#nu + < 1 jet)/dp_{T}(ll)}"); if (differential == 2) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} d#sigma(WW#rightarrow#mu#nue#nu + < 1 jet)/dm_{#font[12]{ll}}"); if (differential == 3) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} d#sigma(WW#rightarrow#mu#nue#nu + < 1 jet)/d#Delta#phi_{ll}"); // if (differential == 0) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} #frac{d#sigma}{dp_{T,max}^{l}}"); // if (differential == 1) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} #frac{d#sigma}{dp_{T}(ll)}"); // if (differential == 2) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} #frac{d#sigma}{dm_{#font[12]{ll}}}"); // if (differential == 3) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} #frac{d#sigma}{d#Delta#phi_{ll}}"); AxisFonts (xsValue->GetXaxis(), XTitle); xsValue->Draw("p"); hmadError->Draw("e2,same"); xsValue_Madgraph->Draw("pe1,same"); hmcError->Draw("e2,same"); xsValue_MCnlo->Draw("pe1,same"); hpowError->Draw("e2,same"); xsValue_Powheg->Draw("pe1,same"); //systHisto->Draw("e2, same"); xsValue->Draw("pe1,same"); // Legend //---------------------------------------------------------------------------- DrawLegend (0.65, 0.85, xsValue, "Data", "P"); DrawLegend (0.65, 0.80, hpowError, "", "F"); DrawLegend (0.65, 0.80, xsValue_Madgraph, "Madgraph", "PL"); DrawLegend (0.65, 0.75, hmadError, "", "F"); DrawLegend (0.65, 0.75, xsValue_MCnlo, "MCNLO", "LP"); DrawLegend (0.65, 0.70, hmcError, "", "F"); DrawLegend (0.65, 0.70, xsValue_Powheg, "Powheg", "PL"); canvas->GetFrame()->DrawClone(); // Draw text //---------------------------------------------------------------------------- TLatex * tex = new TLatex(0.17,0.96,"CMS #sqrt{s} = 8 TeV 19.4 fb^{-1}"); tex->SetNDC(); tex->SetTextAlign(12); tex->SetTextFont(42); tex->SetTextSize(0.07); tex->SetLineWidth(2); tex->Draw(); // TLatex * CMSLabel = new TLatex (0.18, 0.96, "#bf{CMS}"); // CMSLabel->SetNDC (); // CMSLabel->SetTextAlign (10); // CMSLabel->SetTextFont (42); // CMSLabel->SetTextSize (_tsize); // CMSLabel->Draw ("same") ; // // // TLatex * _lumiLabel = new TLatex (0.95, 0.96, "19.4fb#lower[0.3]{^{-1}} (8 TeV)"); // _lumiLabel->SetNDC (); // _lumiLabel->SetTextAlign (30); // _lumiLabel->SetTextFont (42); // _lumiLabel->SetTextSize (_tsize); // _lumiLabel->Draw ("same") ; // Draw also ratio //---------------------------------------------------------------------------- if (drawRatio) { //---- prepare the distributions TH1F* ratio_pow = xsValue_Powheg->Clone("ratio"); TH1F* ratio_mad = xsValue_Madgraph->Clone("ratio"); TH1F* ratio_mcnlo = xsValue_MCnlo->Clone("ratio"); TH1F* hratio_pow = xsValue_Powheg->Clone("ratio"); TH1F* hratio_mad = xsValue_Madgraph->Clone("ratio"); TH1F* hratio_mcnlo = xsValue_MCnlo->Clone("ratio"); TH1F* ratioErr = xsValue->Clone("ratio"); for (UInt_t ibin=1; ibin<=ratio->GetNbinsX(); ibin++) { Double_t powValue = xsValue_Powheg->GetBinContent(ibin); Double_t powError = xsValue_Powheg->GetBinError (ibin); Double_t madValue = xsValue_Madgraph->GetBinContent(ibin); Double_t madError = xsValue_Madgraph->GetBinError (ibin); Double_t mcnloValue = xsValue_MCnlo->GetBinContent(ibin); Double_t mcnloError = xsValue_MCnlo->GetBinError (ibin); Double_t dataValue = xsValue->GetBinContent(ibin); Double_t statError = xsValue->GetBinError (ibin); Double_t systError = systHisto->GetBinError(ibin); Double_t dataError = systError; Double_t ratioValue_pow = (powValue > 0) ? powValue/dataValue : 0.0; Double_t ratioError_pow = (powValue > 0) ? powError / dataValue : 0.0; Double_t ratioValue_mad = (madValue > 0) ? madValue/dataValue : 0.0; Double_t ratioError_mad = (madValue > 0) ? madError/dataValue : 0.0; Double_t ratioValue_mcnlo = (mcnloValue > 0) ? mcnloValue/dataValue : 0.0; Double_t ratioError_mcnlo = (mcnloValue > 0) ? mcnloError/dataValue : 0.0; Double_t uncertaintyError = (dataValue > 0) ? dataError/dataValue : 0.0; //dataError/dataValue ratio_pow->SetBinContent(ibin, ratioValue_pow); hratio_pow->SetBinContent(ibin, ratioValue_pow); hratio_pow->SetBinError (ibin, ratioError_pow); ratio_mad->SetBinContent(ibin, ratioValue_mad); hratio_mad->SetBinContent(ibin, ratioValue_mad); hratio_mad->SetBinError (ibin, ratioError_mad); ratio_mcnlo->SetBinContent(ibin, ratioValue_mcnlo); hratio_mcnlo->SetBinContent(ibin, ratioValue_mcnlo); hratio_mcnlo->SetBinError (ibin, ratioError_mcnlo); ratioErr->SetBinContent(ibin, 1.0); ratioErr->SetBinError (ibin, uncertaintyError); } ratioErr->SetTitle(""); ratioErr->SetFillColor (kGray+2); ratioErr->SetFillStyle ( 3004); // ratioErr->SetFillStyle ( 3345); ratioErr->SetLineColor (kGray+2); ratioErr->SetMarkerColor(kGray+2); ratioErr->SetMarkerSize ( 0); //---- now draw canvas->cd(); pad2 = new TPad("pad2", "pad2",0.01,0.39,0.99,0.55); pad2->Draw(); pad2->cd(); pad2->Range(-147.2973,0.2,960.8108,1.8); pad2->SetFillColor(0); pad2->SetBorderMode(0); pad2->SetBorderSize(2); pad2->SetTickx(1); pad2->SetTicky(1); pad2->SetLeftMargin(0.16); pad2->SetTopMargin(0); pad2->SetBottomMargin(0); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); ratioErr ->Draw("e2"); ratio_mad ->SetLineColor(kMagenta); ratio_mad ->SetMarkerSize(1.0); ratio_mad ->SetLineWidth(1); ratio_mad ->SetMarkerStyle(21); hratio_mad ->SetLineWidth(0); hratio_mad ->SetMarkerSize ( 0); hratio_mad ->SetFillColor (kMagenta-10); hratio_mad ->SetFillStyle (1001); hratio_mad ->Draw("e2,same"); ratio_mad ->Draw("e1p,same"); AxisFontsRatio (ratioErr->GetYaxis(), "y", "Theory/data"); AxisFontsRatio (ratioErr->GetXaxis(), "x", XTitle); ratioErr->Draw("sameaxis"); ratioErr->GetYaxis()->SetRangeUser(0.4, 1.6); pad2->Modified(); TLatex* tex_mad = new TLatex(0.2,0.1,"Madgraph+Pythia, normalized to #sigma_{NNLO}"); tex_mad->SetNDC(); tex_mad->SetTextAlign(12); tex_mad->SetTextFont(42); tex_mad->SetTextSize(0.1); tex_mad->SetLineWidth(2); tex_mad->Draw(); canvas->cd(); pad3 = new TPad("pad3", "pad3",0.01,0.23,0.99,0.39); pad3->Draw(); pad3->cd(); pad3->Range(-147.2973,0.2,960.8108,1.8); pad3->SetFillColor(0); pad3->SetBorderMode(0); pad3->SetBorderSize(2); pad3->SetTickx(1); pad3->SetTicky(1); pad3->SetLeftMargin(0.16); pad3->SetTopMargin(0); pad3->SetBottomMargin(0); pad3->SetFrameFillStyle(0); pad3->SetFrameBorderMode(0); pad3->SetFrameFillStyle(0); pad3->SetFrameBorderMode(0); ratioErr ->Draw("e2"); ratio_mcnlo ->SetLineColor(kRed); ratio_mcnlo ->SetMarkerSize(1.0); ratio_mcnlo ->SetLineWidth(1); ratio_mcnlo ->SetMarkerStyle(24); hratio_mcnlo ->SetLineWidth(0); hratio_mcnlo ->SetMarkerSize ( 0); hratio_mcnlo ->SetFillColor (kOrange); hratio_mcnlo ->SetFillStyle (1001); hratio_mcnlo ->Draw("e2,same"); ratio_mcnlo ->Draw("ep,same"); // AxisFontsRatio (ratioErr->GetYaxis(), "y", "Theory/data"); // AxisFontsRatio (ratioErr->GetXaxis(), "x", XTitle); ratioErr->Draw("sameaxis"); ratioErr->GetYaxis()->SetRangeUser(0.4, 1.6); pad3->Modified(); TLatex* tex_mcnlo = new TLatex(0.2,0.1,"MC@NLO+Herwig, normalized to #sigma_{NNLO}"); tex_mcnlo->SetNDC(); tex_mcnlo->SetTextAlign(12); tex_mcnlo->SetTextFont(42); tex_mcnlo->SetTextSize(0.1); tex_mcnlo->SetLineWidth(2); tex_mcnlo->Draw(); canvas->cd(); pad4 = new TPad("pad4", "pad4",0.01,0.01,0.99,0.23); pad4->Draw(); pad4->cd(); pad4->Range(-147.2973,-0.4857143,960.8108,1.8); pad4->SetFillColor(0); pad4->SetBorderMode(0); pad4->SetBorderSize(2); pad4->SetTickx(1); pad4->SetTicky(1); pad4->SetLeftMargin(0.16); pad4->SetTopMargin(0); pad4->SetBottomMargin(0.3); pad4->SetFrameFillStyle(0); pad4->SetFrameBorderMode(0); pad4->SetFrameFillStyle(0); pad4->SetFrameBorderMode(0); ratioErr ->Draw("e2"); ratio_pow ->SetLineColor(kGreen+2); ratio_pow ->SetMarkerSize(1.2); ratio_pow ->SetLineWidth(1); ratio_pow ->SetMarkerStyle(22); hratio_pow ->SetLineWidth(0); hratio_pow ->SetMarkerSize ( 0); hratio_pow ->SetFillColor (kGreen-7); hratio_pow ->SetFillStyle (1001); hratio_pow ->Draw("e2,same"); ratio_pow ->Draw("e1p,same"); // AxisFontsRatio (ratioErr->GetYaxis(), "y", "Theory/data", 1); // AxisFontsRatio (ratioErr->GetXaxis(), "x", XTitle); ratioErr->Draw("sameaxis"); ratioErr->GetYaxis()->SetRangeUser(0.4, 1.6); pad4->Modified(); TLatex* tex_pow = new TLatex(0.2,0.39,"Powheg+Pythia, normalized to #sigma_{NNLO}"); tex_pow->SetNDC(); tex_pow->SetTextAlign(12); tex_pow->SetTextFont(42); tex_pow->SetTextSize(0.1); tex_pow->SetLineWidth(2); tex_pow->Draw(); canvas->cd(); } }
void Plot_MASS_1824_4555_0200() { gStyle->SetEndErrorSize(0); //=========Macro generated from canvas: cMassFig_PbPb/cMassFig //========= (Wed Jun 28 13:59:22 2017) by ROOT version6.06/00 TCanvas *cMassFig_PbPb = new TCanvas("cMassFig_PbPb", "cMassFig",0,22,800,800); cMassFig_PbPb->Range(0,0,1,1); cMassFig_PbPb->SetFillColor(0); cMassFig_PbPb->SetBorderMode(0); cMassFig_PbPb->SetBorderSize(2); cMassFig_PbPb->SetTickx(1); cMassFig_PbPb->SetTicky(1); cMassFig_PbPb->SetLeftMargin(0.16); cMassFig_PbPb->SetRightMargin(0.04); cMassFig_PbPb->SetTopMargin(0.08); cMassFig_PbPb->SetBottomMargin(0.12); cMassFig_PbPb->SetFrameFillStyle(0); cMassFig_PbPb->SetFrameBorderMode(0); // ------------>Primitives in pad: pad1_PbPb // TPad *pad1_PbPb = new TPad("pad1_PbPb", "",0,0.23,1,1); // pad1_PbPb->Draw(); // pad1_PbPb->cd(); // pad1_PbPb->Range(2.42,2.332543,3.545,3.534904); // pad1_PbPb->SetFillColor(0); // pad1_PbPb->SetBorderMode(0); // pad1_PbPb->SetBorderSize(2); // pad1_PbPb->SetLogy(); // pad1_PbPb->SetTickx(1); // pad1_PbPb->SetTicky(1); // pad1_PbPb->SetLeftMargin(0.16); // pad1_PbPb->SetRightMargin(0.04); // pad1_PbPb->SetTopMargin(0.08); // pad1_PbPb->SetBottomMargin(0.015); // pad1_PbPb->SetFrameFillStyle(0); // pad1_PbPb->SetFrameBorderMode(0); // pad1_PbPb->SetFrameFillStyle(0); // pad1_PbPb->SetFrameBorderMode(0); TH1D *frame_25fab720__5 = new TH1D("frame_25fab720__5","",36,2.6,3.5); frame_25fab720__5->SetBinContent(1,1091.736); frame_25fab720__5->SetMinimum(224.1707); frame_25fab720__5->SetMaximum(2746.091); frame_25fab720__5->SetEntries(1); frame_25fab720__5->SetDirectory(0); frame_25fab720__5->SetStats(0); frame_25fab720__5->SetLineStyle(0); frame_25fab720__5->SetMarkerStyle(20); frame_25fab720__5->GetXaxis()->SetTitle("m_{#mu^{+}#mu^{-}} (GeV/c^{2})"); frame_25fab720__5->GetXaxis()->CenterTitle(true); frame_25fab720__5->GetXaxis()->SetTitleOffset(1.25); frame_25fab720__5->GetXaxis()->SetLabelFont(42); frame_25fab720__5->GetXaxis()->SetLabelOffset(0.015); frame_25fab720__5->GetXaxis()->SetLabelSize(0.048); frame_25fab720__5->GetXaxis()->SetTitleSize(0.044); frame_25fab720__5->GetXaxis()->SetTitleFont(42); frame_25fab720__5->GetYaxis()->SetTitle("Events / ( 0.025 GeV/c^{2} )"); frame_25fab720__5->GetYaxis()->CenterTitle(true); frame_25fab720__5->GetYaxis()->SetRangeUser(0,1500); frame_25fab720__5->GetYaxis()->SetLabelOffset(0.007); frame_25fab720__5->GetYaxis()->SetTitleOffset(1.9); frame_25fab720__5->GetYaxis()->SetLabelSize(0.048); frame_25fab720__5->GetYaxis()->SetTitleSize(0.044); frame_25fab720__5->GetYaxis()->SetTitleFont(42); frame_25fab720__5->GetZaxis()->SetLabelFont(42); frame_25fab720__5->GetZaxis()->SetLabelOffset(0.007); frame_25fab720__5->GetZaxis()->SetLabelSize(0.05); frame_25fab720__5->GetZaxis()->SetTitleSize(0.06); frame_25fab720__5->GetZaxis()->SetTitleFont(42); frame_25fab720__5->Draw("FUNC"); Double_t dOS_fx3004[36] = { 2.6125, 2.6375, 2.6625, 2.6875, 2.7125, 2.7375, 2.7625, 2.7875, 2.8125, 2.8375, 2.8625, 2.8875, 2.9125, 2.9375, 2.9625, 2.9875, 3.0125, 3.0375, 3.0625, 3.0875, 3.1125, 3.1375, 3.1625, 3.1875, 3.2125, 3.2375, 3.2625, 3.2875, 3.3125, 3.3375, 3.3625, 3.3875, 3.4125, 3.4375, 3.4625, 3.4875}; Double_t dOS_fy3004[36] = { 407, 379, 378, 398, 356, 365, 371, 343, 390, 377, 378, 426, 390, 422, 414, 463, 528, 795, 969, 1008, 933, 736, 600, 453, 383, 376, 330, 371, 326, 342, 324, 344, 297, 345, 306, 288}; Double_t dOS_felx3004[36] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t dOS_fely3004[36] = { 20.17424, 19.46792, 19.44222, 19.94994, 18.86796, 19.10497, 19.26136, 18.52026, 19.74842, 19.41649, 19.44222, 20.63977, 19.74842, 20.54264, 20.34699, 21.51743, 22.97825, 28.19574, 31.12876, 31.74902, 30.54505, 27.12932, 24.4949, 21.2838, 19.57039, 19.39072, 18.1659, 19.26136, 18.05547, 18.49324, 18, 18.54724, 17.23369, 18.57418, 17.49286, 16.97056}; Double_t dOS_fehx3004[36] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t dOS_fehy3004[36] = { 20.17424, 19.46792, 19.44222, 19.94994, 18.86796, 19.10497, 19.26136, 18.52026, 19.74842, 19.41649, 19.44222, 20.63977, 19.74842, 20.54264, 20.34699, 21.51743, 22.97825, 28.19574, 31.12876, 31.74902, 30.54505, 27.12932, 24.4949, 21.2838, 19.57039, 19.39072, 18.1659, 19.26136, 18.05547, 18.49324, 18, 18.54724, 17.23369, 18.57418, 17.49286, 16.97056}; TGraphAsymmErrors *grae = new TGraphAsymmErrors(36,dOS_fx3004,dOS_fy3004,dOS_felx3004,dOS_fehx3004,dOS_fely3004,dOS_fehy3004); grae->SetName("dOS"); grae->SetTitle("Histogram of dOS_DATA_PbPb_plot__invMass"); grae->SetFillColor(1); grae->SetMarkerStyle(8); grae->SetMarkerSize(1.2); TH1F *Graph_dOS3004 = new TH1F("Graph_dOS3004","Histogram of dOS_DATA_PbPb_plot__invMass",100,2.525,3.575); Graph_dOS3004->SetMinimum(194.1575); Graph_dOS3004->SetMaximum(1116.621); Graph_dOS3004->SetDirectory(0); Graph_dOS3004->SetStats(0); Graph_dOS3004->SetLineStyle(0); Graph_dOS3004->SetMarkerStyle(20); Graph_dOS3004->GetXaxis()->SetLabelFont(42); Graph_dOS3004->GetXaxis()->SetLabelOffset(0.007); Graph_dOS3004->GetXaxis()->SetLabelSize(0.05); Graph_dOS3004->GetXaxis()->SetTitleSize(0.06); Graph_dOS3004->GetXaxis()->SetTitleOffset(0.9); Graph_dOS3004->GetXaxis()->SetTitleFont(42); Graph_dOS3004->GetYaxis()->SetLabelFont(42); Graph_dOS3004->GetYaxis()->SetLabelOffset(0.007); Graph_dOS3004->GetYaxis()->SetLabelSize(0.05); Graph_dOS3004->GetYaxis()->SetTitleSize(0.06); Graph_dOS3004->GetYaxis()->SetTitleOffset(1.25); Graph_dOS3004->GetYaxis()->SetTitleFont(42); Graph_dOS3004->GetZaxis()->SetLabelFont(42); Graph_dOS3004->GetZaxis()->SetLabelOffset(0.007); Graph_dOS3004->GetZaxis()->SetLabelSize(0.05); Graph_dOS3004->GetZaxis()->SetTitleSize(0.06); Graph_dOS3004->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_dOS3004); grae->Draw("p"); Double_t BKG_fx6[40] = { 2.6, 2.6, 2.625, 2.65, 2.675, 2.7, 2.725, 2.75, 2.775, 2.8, 2.825, 2.85, 2.875, 2.9, 2.925, 2.95, 2.975, 3, 3.025, 3.05, 3.075, 3.1, 3.125, 3.15, 3.175, 3.2, 3.225, 3.25, 3.275, 3.3, 3.325, 3.35, 3.375, 3.4, 3.425, 3.45, 3.475, 3.5, 3.5, 3.5}; Double_t BKG_fy6[40] = { 0, 387.6149, 385.6614, 383.708, 381.7545, 379.8011, 377.8476, 375.8942, 373.9407, 371.9873, 370.0338, 368.0804, 366.1269, 364.1735, 362.22, 360.2666, 358.3131, 356.3597, 354.4062, 352.4528, 350.4993, 348.5459, 346.5924, 344.639, 342.6855, 340.7321, 338.7786, 336.8252, 334.8717, 332.9183, 330.9648, 329.0114, 327.0579, 325.1045, 323.151, 321.1976, 319.2441, 317.2907, 317.2907, 0}; TGraph *graph = new TGraph(40,BKG_fx6,BKG_fy6); graph->SetName("BKG"); graph->SetTitle("Projection of pdfCTAUMASS_Tot_PbPb"); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#99ccff"); graph->SetFillColor(ci); ci = TColor::GetColor("#0000ff"); graph->SetLineColor(ci); // graph->SetLineStyle(2); graph->SetLineWidth(0); // 3 graph->SetMarkerStyle(20); TH1F *Graph_BKG6 = new TH1F("Graph_BKG6","Projection of pdfCTAUMASS_Tot_PbPb",100,2.51,3.59); Graph_BKG6->SetMinimum(0.4263764); Graph_BKG6->SetMaximum(426.3764); Graph_BKG6->SetDirectory(0); Graph_BKG6->SetStats(0); Graph_BKG6->SetLineStyle(0); Graph_BKG6->SetMarkerStyle(20); Graph_BKG6->GetXaxis()->SetLabelFont(42); Graph_BKG6->GetXaxis()->SetLabelOffset(0.007); Graph_BKG6->GetXaxis()->SetLabelSize(0.05); Graph_BKG6->GetXaxis()->SetTitleSize(0.06); Graph_BKG6->GetXaxis()->SetTitleOffset(0.9); Graph_BKG6->GetXaxis()->SetTitleFont(42); Graph_BKG6->GetYaxis()->SetLabelFont(42); Graph_BKG6->GetYaxis()->SetLabelOffset(0.007); Graph_BKG6->GetYaxis()->SetLabelSize(0.05); Graph_BKG6->GetYaxis()->SetTitleSize(0.06); Graph_BKG6->GetYaxis()->SetTitleOffset(1.25); Graph_BKG6->GetYaxis()->SetTitleFont(42); Graph_BKG6->GetZaxis()->SetLabelFont(42); Graph_BKG6->GetZaxis()->SetLabelOffset(0.007); Graph_BKG6->GetZaxis()->SetLabelSize(0.05); Graph_BKG6->GetZaxis()->SetTitleSize(0.06); Graph_BKG6->GetZaxis()->SetTitleFont(42); graph->SetHistogram(Graph_BKG6); graph->Draw("f"); Double_t JPSIPR_fx7[230] = { 2.575, 2.575, 2.6, 2.625, 2.65, 2.675, 2.7, 2.725, 2.75, 2.775, 2.8, 2.825, 2.85, 2.8625, 2.875, 2.8875, 2.9, 2.90625, 2.9125, 2.91875, 2.925, 2.93125, 2.9375, 2.940625, 2.94375, 2.946875, 2.95, 2.953125, 2.95625, 2.959375, 2.9625, 2.964063, 2.965625, 2.967188, 2.96875, 2.970312, 2.971875, 2.973438, 2.975, 2.976562, 2.978125, 2.979688, 2.98125, 2.982813, 2.984375, 2.985937, 2.9875, 2.989062, 2.990625, 2.992188, 2.99375, 2.995312, 2.996875, 2.998438, 3, 3.001562, 3.003125, 3.004688, 3.00625, 3.007812, 3.009375, 3.010938, 3.0125, 3.014063, 3.015625, 3.017187, 3.01875, 3.020312, 3.021875, 3.023438, 3.025, 3.026562, 3.028125, 3.029688, 3.03125, 3.034375, 3.0375, 3.04375, 3.046875, 3.05, 3.051562, 3.053125, 3.054688, 3.05625, 3.057812, 3.059375, 3.060938, 3.0625, 3.064062, 3.065625, 3.067188, 3.06875, 3.070312, 3.071094, 3.071875, 3.072656, 3.073438, 3.074219, 3.075, 3.075781, 3.076563, 3.077344, 3.078125, 3.078906, 3.079688, 3.080469, 3.08125, 3.082031, 3.082813, 3.083594, 3.084375, 3.085156, 3.085938, 3.086719, 3.0875, 3.088281, 3.089063, 3.089844, 3.090625, 3.091406, 3.092188, 3.092969, 3.09375, 3.094531, 3.095312, 3.096094, 3.096875, 3.097656, 3.098438, 3.099219, 3.1, 3.100781, 3.101562, 3.102344, 3.103125, 3.103906, 3.104688, 3.10625, 3.107813, 3.109375, 3.110937, 3.1125, 3.114062, 3.115625, 3.117188, 3.11875, 3.120312, 3.121875, 3.123438, 3.125, 3.128125, 3.13125, 3.1375, 3.140625, 3.14375, 3.145312, 3.146875, 3.148438, 3.15, 3.151562, 3.153125, 3.154688, 3.15625, 3.157812, 3.159375, 3.160937, 3.1625, 3.164062, 3.165625, 3.167187, 3.16875, 3.170312, 3.171875, 3.173437, 3.175, 3.176562, 3.178125, 3.179688, 3.18125, 3.182812, 3.184375, 3.185938, 3.1875, 3.189062, 3.190625, 3.192188, 3.19375, 3.195312, 3.196875, 3.198438, 3.2, 3.201563, 3.203125, 3.204688, 3.20625, 3.207813, 3.209375, 3.210938, 3.2125, 3.215625, 3.21875, 3.221875, 3.225, 3.228125, 3.23125, 3.234375, 3.2375, 3.240625, 3.24375, 3.246875, 3.25, 3.253125, 3.25625, 3.2625, 3.26875, 3.275, 3.28125, 3.2875, 3.3, 3.325, 3.35, 3.375, 3.4, 3.425, 3.45, 3.475, 3.5, 3.5, 3.525, 3.525}; Double_t JPSIPR_fy7[230] = { 0, 391.674, 391.674, 389.8809, 388.1159, 386.3862, 384.7014, 383.0748, 381.5254, 380.0812, 378.7849, 377.7045, 376.9557, 376.7656, 376.75, 376.9694, 377.5149, 377.9517, 378.5296, 379.2814, 380.2507, 381.4961, 383.099, 384.0688, 385.1749, 386.4401, 387.8929, 389.5683, 391.5107, 393.7766, 396.4389, 397.9477, 399.594, 401.395, 403.3708, 405.5451, 407.9459, 410.6067, 413.552, 416.6761, 419.9526, 423.3851, 426.9771, 430.732, 434.6528, 438.7424, 443.0036, 447.4387, 452.05, 456.8395, 461.8088, 466.9594, 472.2924, 477.8089, 483.5095, 489.3949, 495.4654, 501.7214, 508.1633, 514.7918, 521.6076, 528.6125, 535.8087, 543.2002, 550.7929, 558.5959, 566.6226, 574.8925, 583.3689, 592.0122, 600.8151, 609.7695, 618.8663, 628.0955, 637.4461, 656.4623, 675.8061, 714.953, 734.4514, 753.669, 763.1134, 772.415, 781.5482, 790.4868, 799.2045, 807.6744, 815.8697, 823.7637, 831.3298, 838.5421, 845.3749, 851.8037, 857.8045, 860.6372, 863.3546, 865.954, 868.4329, 870.7888, 873.0193, 875.1222, 877.0955, 878.9371, 880.6451, 882.2178, 883.6535, 884.9508, 886.1081, 887.1244, 887.9985, 888.7295, 889.3165, 889.7589, 890.0562, 890.208, 890.2141, 890.0744, 889.789, 889.3581, 888.7822, 888.0617, 887.1973, 886.1898, 885.0402, 883.7496, 882.3193, 880.7506, 879.045, 877.2042, 875.23, 873.1242, 870.889, 868.5263, 866.0384, 863.4278, 860.6967, 857.8479, 854.8839, 848.6212, 841.9315, 834.8386, 827.3672, 819.5428, 811.3916, 802.9401, 794.215, 785.2431, 776.0512, 766.6658, 757.1129, 747.4182, 727.7026, 707.7097, 667.5828, 647.753, 628.2529, 618.6611, 609.1911, 599.854, 590.6595, 581.6169, 572.7342, 564.0186, 555.4764, 547.1134, 538.9343, 530.9433, 523.1438, 515.5387, 508.1302, 500.92, 493.9093, 487.0987, 480.4886, 474.0786, 467.8683, 461.8566, 456.0423, 450.4237, 444.9989, 439.7656, 434.7215, 429.8638, 425.1896, 420.6958, 416.379, 412.2357, 408.2623, 404.455, 400.8099, 397.3229, 393.99, 390.8069, 387.7694, 384.8731, 382.1136, 379.4866, 376.9877, 374.6124, 372.3562, 368.184, 364.4362, 361.0788, 358.0787, 355.4041, 353.0246, 350.9116, 349.0378, 347.3779, 345.9085, 344.6079, 343.4561, 342.4352, 341.5286, 340.0009, 338.7727, 337.7652, 336.9174, 336.1836, 334.931, 332.8051, 330.8169, 328.8499, 326.8855, 324.9213, 322.9572, 320.993, 319.0289, 319.0289, 319.0289, 0}; graph = new TGraph(230,JPSIPR_fx7,JPSIPR_fy7); graph->SetName("JPSIPR"); graph->SetTitle("Projection of pdfCTAUMASS_Tot_PbPb"); graph->SetFillColor(1); graph->SetLineColor(2); ci = TColor::GetColor("#000099"); graph->SetLineColor(2); graph->SetLineStyle(9); graph->SetLineWidth(3); graph->SetMarkerStyle(20); TH1F *Graph_JPSIPR7 = new TH1F("Graph_JPSIPR7","Projection of pdfCTAUMASS_Tot_PbPb",230,2.48,3.62); Graph_JPSIPR7->SetMinimum(0.9792355); Graph_JPSIPR7->SetMaximum(979.2355); Graph_JPSIPR7->SetDirectory(0); Graph_JPSIPR7->SetStats(0); Graph_JPSIPR7->SetLineStyle(0); Graph_JPSIPR7->SetMarkerStyle(20); Graph_JPSIPR7->GetXaxis()->SetLabelFont(42); Graph_JPSIPR7->GetXaxis()->SetLabelOffset(0.007); Graph_JPSIPR7->GetXaxis()->SetLabelSize(0.05); Graph_JPSIPR7->GetXaxis()->SetTitleSize(0.06); Graph_JPSIPR7->GetXaxis()->SetTitleOffset(0.9); Graph_JPSIPR7->GetXaxis()->SetTitleFont(42); Graph_JPSIPR7->GetYaxis()->SetLabelFont(42); Graph_JPSIPR7->GetYaxis()->SetLabelOffset(0.007); Graph_JPSIPR7->GetYaxis()->SetLabelSize(0.05); Graph_JPSIPR7->GetYaxis()->SetTitleSize(0.06); Graph_JPSIPR7->GetYaxis()->SetTitleOffset(1.25); Graph_JPSIPR7->GetYaxis()->SetTitleFont(42); Graph_JPSIPR7->GetZaxis()->SetLabelFont(42); Graph_JPSIPR7->GetZaxis()->SetLabelOffset(0.007); Graph_JPSIPR7->GetZaxis()->SetLabelSize(0.05); Graph_JPSIPR7->GetZaxis()->SetTitleSize(0.06); Graph_JPSIPR7->GetZaxis()->SetTitleFont(42); graph->SetHistogram(Graph_JPSIPR7); graph->Draw("l"); Double_t JPSINOPR_fx8[218] = { 2.575, 2.575, 2.6, 2.625, 2.65, 2.675, 2.7, 2.725, 2.75, 2.775, 2.8, 2.825, 2.85, 2.8625, 2.875, 2.8875, 2.9, 2.90625, 2.9125, 2.91875, 2.925, 2.93125, 2.9375, 2.940625, 2.94375, 2.946875, 2.95, 2.953125, 2.95625, 2.959375, 2.9625, 2.964063, 2.965625, 2.967188, 2.96875, 2.970312, 2.971875, 2.973438, 2.975, 2.976562, 2.978125, 2.979688, 2.98125, 2.982813, 2.984375, 2.985937, 2.9875, 2.989062, 2.990625, 2.992188, 2.99375, 2.995312, 2.996875, 2.998438, 3, 3.001562, 3.003125, 3.004688, 3.00625, 3.007812, 3.009375, 3.010938, 3.0125, 3.014063, 3.015625, 3.017187, 3.01875, 3.020312, 3.021875, 3.023438, 3.025, 3.026562, 3.028125, 3.03125, 3.034375, 3.0375, 3.04375, 3.046875, 3.05, 3.051562, 3.053125, 3.054688, 3.05625, 3.057812, 3.059375, 3.060938, 3.0625, 3.064062, 3.065625, 3.067188, 3.06875, 3.070312, 3.071875, 3.073438, 3.075, 3.075781, 3.076563, 3.077344, 3.078125, 3.078906, 3.079688, 3.080469, 3.08125, 3.082031, 3.082813, 3.083594, 3.084375, 3.085156, 3.085938, 3.086719, 3.0875, 3.088281, 3.089063, 3.089844, 3.090625, 3.091406, 3.092188, 3.092969, 3.09375, 3.094531, 3.095312, 3.096094, 3.096875, 3.097656, 3.098438, 3.099219, 3.1, 3.101562, 3.103125, 3.104688, 3.10625, 3.107813, 3.109375, 3.110937, 3.1125, 3.114062, 3.115625, 3.117188, 3.11875, 3.120312, 3.121875, 3.123438, 3.125, 3.128125, 3.13125, 3.1375, 3.140625, 3.14375, 3.146875, 3.148438, 3.15, 3.151562, 3.153125, 3.154688, 3.15625, 3.157812, 3.159375, 3.160937, 3.1625, 3.164062, 3.165625, 3.167187, 3.16875, 3.170312, 3.171875, 3.173437, 3.175, 3.176562, 3.178125, 3.179688, 3.18125, 3.182812, 3.184375, 3.185938, 3.1875, 3.189062, 3.190625, 3.192188, 3.19375, 3.195312, 3.196875, 3.198438, 3.2, 3.201563, 3.203125, 3.204688, 3.20625, 3.209375, 3.2125, 3.215625, 3.21875, 3.221875, 3.225, 3.228125, 3.23125, 3.234375, 3.2375, 3.240625, 3.24375, 3.246875, 3.25, 3.25625, 3.2625, 3.26875, 3.275, 3.2875, 3.3, 3.325, 3.35, 3.375, 3.4, 3.425, 3.45, 3.475, 3.5, 3.5, 3.525, 3.525}; Double_t JPSINOPR_fy8[218] = { 0, 390.2546, 390.2546, 388.336, 386.425, 384.5234, 382.6337, 380.7596, 378.9061, 377.0806, 375.2945, 373.5661, 371.9261, 371.1552, 370.4309, 369.7692, 369.1945, 368.951, 368.745, 368.5854, 368.4839, 368.4559, 368.5233, 368.6019, 368.7169, 368.8743, 369.0817, 369.3485, 369.6864, 370.1107, 370.6407, 370.9531, 371.3021, 371.6924, 372.1293, 372.6192, 373.1694, 373.789, 374.4845, 375.2277, 376.0115, 376.8369, 377.7048, 378.6162, 379.5719, 380.5725, 381.6189, 382.7117, 383.8515, 385.0388, 386.2741, 387.5577, 388.89, 390.2712, 391.7015, 393.1811, 394.71, 396.2885, 397.9165, 399.5942, 401.322, 403.1001, 404.9293, 406.8105, 408.7455, 410.7365, 412.7871, 414.9027, 417.0733, 419.2884, 421.546, 423.8441, 426.1801, 430.9552, 435.8467, 440.8256, 450.9058, 455.9259, 460.8711, 463.2998, 465.6905, 468.0363, 470.3302, 472.5651, 474.7339, 476.8296, 478.8448, 480.7727, 482.6061, 484.3384, 485.9629, 487.4733, 488.8634, 490.1278, 491.2609, 491.7768, 492.258, 492.7041, 493.1147, 493.4891, 493.827, 494.1279, 494.3916, 494.6176, 494.8057, 494.9556, 495.0672, 495.1402, 495.1744, 495.1699, 495.1265, 495.0443, 494.9231, 494.7632, 494.5646, 494.3274, 494.0519, 493.7382, 493.3866, 492.9974, 492.5709, 492.1075, 491.6077, 491.0717, 490.5002, 489.8936, 489.2524, 487.8688, 486.3542, 484.7139, 482.9537, 481.0795, 479.0979, 477.0153, 474.8385, 472.5746, 470.2306, 467.8136, 465.3309, 462.7894, 460.1963, 457.5586, 454.8831, 449.445, 443.9329, 432.8712, 427.4026, 422.022, 416.7583, 414.1781, 411.636, 409.1343, 406.6753, 404.2609, 401.8927, 399.5723, 397.301, 395.0798, 392.9097, 390.7914, 388.7256, 386.7127, 384.7529, 382.8465, 380.9936, 379.1941, 377.4478, 375.7545, 374.1138, 372.5254, 370.9886, 369.5029, 368.0676, 366.6821, 365.3455, 364.057, 362.8157, 361.6207, 360.4709, 359.3655, 358.3034, 357.2834, 356.3045, 355.3656, 354.4655, 353.603, 352.7771, 351.23, 349.8147, 348.522, 347.3424, 346.267, 345.2868, 344.3935, 343.5788, 342.8353, 342.1555, 341.5328, 340.9609, 340.4339, 339.9467, 339.0726, 338.3051, 337.6174, 336.9887, 335.8467, 334.7925, 332.7852, 330.8146, 328.8497, 326.8855, 324.9213, 322.9572, 320.993, 319.0289, 319.0289, 319.0289, 0}; graph = new TGraph(218,JPSINOPR_fx8,JPSINOPR_fy8); graph->SetName("JPSINOPR"); graph->SetTitle("Projection of pdfCTAUMASS_Tot_PbPb"); graph->SetFillColor(1); ci = TColor::GetColor("#339933"); graph->SetLineColor(ci); graph->SetLineStyle(4); graph->SetLineWidth(5); graph->SetMarkerStyle(20); TH1F *Graph_JPSINOPR8 = new TH1F("Graph_JPSINOPR8","Projection of pdfCTAUMASS_Tot_PbPb",218,2.48,3.62); Graph_JPSINOPR8->SetMinimum(0.5446919); Graph_JPSINOPR8->SetMaximum(544.6919); Graph_JPSINOPR8->SetDirectory(0); Graph_JPSINOPR8->SetStats(0); Graph_JPSINOPR8->SetLineStyle(0); Graph_JPSINOPR8->SetMarkerStyle(20); Graph_JPSINOPR8->GetXaxis()->SetLabelFont(42); Graph_JPSINOPR8->GetXaxis()->SetLabelOffset(0.007); Graph_JPSINOPR8->GetXaxis()->SetLabelSize(0.05); Graph_JPSINOPR8->GetXaxis()->SetTitleSize(0.06); Graph_JPSINOPR8->GetXaxis()->SetTitleOffset(0.9); Graph_JPSINOPR8->GetXaxis()->SetTitleFont(42); Graph_JPSINOPR8->GetYaxis()->SetLabelFont(42); Graph_JPSINOPR8->GetYaxis()->SetLabelOffset(0.007); Graph_JPSINOPR8->GetYaxis()->SetLabelSize(0.05); Graph_JPSINOPR8->GetYaxis()->SetTitleSize(0.06); Graph_JPSINOPR8->GetYaxis()->SetTitleOffset(1.25); Graph_JPSINOPR8->GetYaxis()->SetTitleFont(42); Graph_JPSINOPR8->GetZaxis()->SetLabelFont(42); Graph_JPSINOPR8->GetZaxis()->SetLabelOffset(0.007); Graph_JPSINOPR8->GetZaxis()->SetLabelSize(0.05); Graph_JPSINOPR8->GetZaxis()->SetTitleSize(0.06); Graph_JPSINOPR8->GetZaxis()->SetTitleFont(42); graph->SetHistogram(Graph_JPSINOPR8); graph->Draw("l"); Double_t dOS_fx3005[36] = { 2.6125, 2.6375, 2.6625, 2.6875, 2.7125, 2.7375, 2.7625, 2.7875, 2.8125, 2.8375, 2.8625, 2.8875, 2.9125, 2.9375, 2.9625, 2.9875, 3.0125, 3.0375, 3.0625, 3.0875, 3.1125, 3.1375, 3.1625, 3.1875, 3.2125, 3.2375, 3.2625, 3.2875, 3.3125, 3.3375, 3.3625, 3.3875, 3.4125, 3.4375, 3.4625, 3.4875}; Double_t dOS_fy3005[36] = { 407, 379, 378, 398, 356, 365, 371, 343, 390, 377, 378, 426, 390, 422, 414, 463, 528, 795, 969, 1008, 933, 736, 600, 453, 383, 376, 330, 371, 326, 342, 324, 344, 297, 345, 306, 288}; Double_t dOS_felx3005[36] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t dOS_fely3005[36] = { 20.17424, 19.46792, 19.44222, 19.94994, 18.86796, 19.10497, 19.26136, 18.52026, 19.74842, 19.41649, 19.44222, 20.63977, 19.74842, 20.54264, 20.34699, 21.51743, 22.97825, 28.19574, 31.12876, 31.74902, 30.54505, 27.12932, 24.4949, 21.2838, 19.57039, 19.39072, 18.1659, 19.26136, 18.05547, 18.49324, 18, 18.54724, 17.23369, 18.57418, 17.49286, 16.97056}; Double_t dOS_fehx3005[36] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t dOS_fehy3005[36] = { 20.17424, 19.46792, 19.44222, 19.94994, 18.86796, 19.10497, 19.26136, 18.52026, 19.74842, 19.41649, 19.44222, 20.63977, 19.74842, 20.54264, 20.34699, 21.51743, 22.97825, 28.19574, 31.12876, 31.74902, 30.54505, 27.12932, 24.4949, 21.2838, 19.57039, 19.39072, 18.1659, 19.26136, 18.05547, 18.49324, 18, 18.54724, 17.23369, 18.57418, 17.49286, 16.97056}; grae = new TGraphAsymmErrors(36,dOS_fx3005,dOS_fy3005,dOS_felx3005,dOS_fehx3005,dOS_fely3005,dOS_fehy3005); grae->SetName("dOS"); grae->SetTitle("Histogram of dOS_DATA_PbPb_plot__invMass"); grae->SetFillColor(1); grae->SetMarkerStyle(8); grae->SetMarkerSize(1.2); TH1F *Graph_dOS3005 = new TH1F("Graph_dOS3005","Histogram of dOS_DATA_PbPb_plot__invMass",100,2.525,3.575); Graph_dOS3005->SetMinimum(194.1575); Graph_dOS3005->SetMaximum(1116.621); Graph_dOS3005->SetDirectory(0); Graph_dOS3005->SetStats(0); Graph_dOS3005->SetLineStyle(0); Graph_dOS3005->SetMarkerStyle(20); Graph_dOS3005->GetXaxis()->SetLabelFont(42); Graph_dOS3005->GetXaxis()->SetLabelOffset(0.007); Graph_dOS3005->GetXaxis()->SetLabelSize(0.05); Graph_dOS3005->GetXaxis()->SetTitleSize(0.06); Graph_dOS3005->GetXaxis()->SetTitleOffset(0.9); Graph_dOS3005->GetXaxis()->SetTitleFont(42); Graph_dOS3005->GetYaxis()->SetLabelFont(42); Graph_dOS3005->GetYaxis()->SetLabelOffset(0.007); Graph_dOS3005->GetYaxis()->SetLabelSize(0.05); Graph_dOS3005->GetYaxis()->SetTitleSize(0.06); Graph_dOS3005->GetYaxis()->SetTitleOffset(1.25); Graph_dOS3005->GetYaxis()->SetTitleFont(42); Graph_dOS3005->GetZaxis()->SetLabelFont(42); Graph_dOS3005->GetZaxis()->SetLabelOffset(0.007); Graph_dOS3005->GetZaxis()->SetLabelSize(0.05); Graph_dOS3005->GetZaxis()->SetTitleSize(0.06); Graph_dOS3005->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_dOS3005); grae->Draw("p"); Double_t PDF_fx9[86] = { 2.575, 2.575, 2.6, 2.625, 2.65, 2.675, 2.7, 2.725, 2.75, 2.775, 2.8, 2.825, 2.85, 2.875, 2.9, 2.925, 2.9375, 2.95, 2.95625, 2.9625, 2.96875, 2.975, 2.98125, 2.9875, 2.99375, 3, 3.00625, 3.0125, 3.01875, 3.025, 3.03125, 3.0375, 3.05, 3.05625, 3.059375, 3.0625, 3.065625, 3.06875, 3.071875, 3.075, 3.078125, 3.08125, 3.084375, 3.0875, 3.090625, 3.09375, 3.096875, 3.1, 3.103125, 3.10625, 3.109375, 3.1125, 3.115625, 3.11875, 3.125, 3.1375, 3.14375, 3.15, 3.15625, 3.1625, 3.16875, 3.175, 3.18125, 3.1875, 3.19375, 3.2, 3.20625, 3.2125, 3.21875, 3.225, 3.2375, 3.25, 3.2625, 3.275, 3.3, 3.325, 3.35, 3.375, 3.4, 3.425, 3.45, 3.475, 3.5, 3.5, 3.525, 3.525}; Double_t PDF_fy9[86] = { 0, 392.1903, 392.1903, 390.4427, 388.7309, 387.0637, 385.4533, 383.9168, 382.4781, 381.1725, 380.0543, 379.2096, 378.785, 379.0482, 380.5409, 384.5302, 388.4, 394.7343, 399.448, 405.8215, 414.733, 427.7605, 444.8969, 465.3285, 489.2799, 516.8991, 548.2589, 583.4081, 622.571, 666.0134, 712.5446, 761.266, 860.1565, 906.9244, 928.7612, 949.207, 967.9922, 984.856, 999.5531, 1011.861, 1021.586, 1028.571, 1032.701, 1033.903, 1032.155, 1027.48, 1019.952, 1009.686, 996.8411, 981.6106, 964.2177, 944.9081, 923.943, 901.5918, 853.8101, 752.9449, 703.2569, 655.7685, 611.3332, 570.5086, 533.6083, 500.7533, 471.9156, 446.9543, 425.6435, 407.6958, 392.783, 380.5543, 370.653, 362.7309, 351.5408, 344.7325, 340.6176, 338.0476, 334.9814, 332.8124, 330.8178, 328.85, 326.8855, 324.9213, 322.9572, 320.993, 319.0289, 319.0289, 319.0289, 0}; graph = new TGraph(86,PDF_fx9,PDF_fy9); graph->SetName("PDF"); graph->SetTitle("Projection of pdfCTAUMASS_Tot_PbPb"); graph->SetFillColor(1); graph->SetLineWidth(3); graph->SetMarkerStyle(20); TH1F *Graph_PDF9 = new TH1F("Graph_PDF9","Projection of pdfCTAUMASS_Tot_PbPb",100,2.48,3.62); Graph_PDF9->SetMinimum(1.137294); Graph_PDF9->SetMaximum(1137.294); Graph_PDF9->SetDirectory(0); Graph_PDF9->SetStats(0); Graph_PDF9->SetLineStyle(0); Graph_PDF9->SetMarkerStyle(20); Graph_PDF9->GetXaxis()->SetLabelFont(42); Graph_PDF9->GetXaxis()->SetLabelOffset(0.007); Graph_PDF9->GetXaxis()->SetLabelSize(0.05); Graph_PDF9->GetXaxis()->SetTitleSize(0.06); Graph_PDF9->GetXaxis()->SetTitleOffset(0.9); Graph_PDF9->GetXaxis()->SetTitleFont(42); Graph_PDF9->GetYaxis()->SetLabelFont(42); Graph_PDF9->GetYaxis()->SetLabelOffset(0.007); Graph_PDF9->GetYaxis()->SetLabelSize(0.05); Graph_PDF9->GetYaxis()->SetTitleSize(0.06); Graph_PDF9->GetYaxis()->SetTitleOffset(1.25); Graph_PDF9->GetYaxis()->SetTitleFont(42); Graph_PDF9->GetZaxis()->SetLabelFont(42); Graph_PDF9->GetZaxis()->SetLabelOffset(0.007); Graph_PDF9->GetZaxis()->SetLabelSize(0.05); Graph_PDF9->GetZaxis()->SetTitleSize(0.06); Graph_PDF9->GetZaxis()->SetTitleFont(42); graph->SetHistogram(Graph_PDF9); graph->Draw("l"); TH1D *frame_25fab720__6 = new TH1D("frame_25fab720__6","",36,2.6,3.5); frame_25fab720__6->SetBinContent(1,1091.736); frame_25fab720__6->SetMinimum(224.1707); frame_25fab720__6->SetMaximum(2746.091); frame_25fab720__6->SetEntries(1); frame_25fab720__6->SetDirectory(0); frame_25fab720__6->SetStats(0); frame_25fab720__6->SetLineStyle(0); frame_25fab720__6->SetMarkerStyle(20); frame_25fab720__6->GetXaxis()->CenterTitle(true); frame_25fab720__6->GetXaxis()->SetLabelFont(42); frame_25fab720__6->GetXaxis()->SetLabelOffset(3); frame_25fab720__6->GetXaxis()->SetLabelSize(0.05); frame_25fab720__6->GetXaxis()->SetTitleSize(0.045); frame_25fab720__6->GetXaxis()->SetTitleOffset(3); frame_25fab720__6->GetXaxis()->SetTitleFont(42); frame_25fab720__6->GetYaxis()->SetTitle("Events / ( 0.025 GeV/c^{2} )"); frame_25fab720__6->GetYaxis()->SetLabelFont(42); frame_25fab720__6->GetYaxis()->SetLabelOffset(0.007); frame_25fab720__6->GetYaxis()->SetTitleOffset(1.7); frame_25fab720__6->GetYaxis()->SetTitleFont(42); frame_25fab720__6->GetZaxis()->SetLabelFont(42); frame_25fab720__6->GetZaxis()->SetLabelOffset(0.007); frame_25fab720__6->GetZaxis()->SetLabelSize(0.05); frame_25fab720__6->GetZaxis()->SetTitleSize(0.06); frame_25fab720__6->GetZaxis()->SetTitleFont(42); frame_25fab720__6->Draw("AXISSAME"); // TLatex * tex = new TLatex(0.2,0.735,"N_{bkg}^{PbPb} = 12688#pm89 "); //tex->SetNDC(); // tex->SetTextSize(0.026); // tex->SetLineWidth(2); // tex->Draw(); // tex = new TLatex(0.2,0.69,"N_{J/#psi}^{PbPb} = 3622#pm59 "); //tex->SetNDC(); // tex->SetTextSize(0.026); // tex->SetLineWidth(2); // tex->Draw(); // tex = new TLatex(0.2,0.645,"b_{J/#psi}^{PbPb} = 0.2105#pm0.0118"); //tex->SetNDC(); // tex->SetTextSize(0.026); // tex->SetLineWidth(2); // tex->Draw(); // tex = new TLatex(0.2,0.86,"2015 HI Soft Muon ID"); //tex->SetNDC(); // tex->SetTextSize(0.03); // tex->SetLineWidth(2); // tex->Draw(); // tex = new TLatex(0.2,0.815,"HLT_HIL1DoubleMu0_v1"); //tex->SetNDC(); // tex->SetTextSize(0.03); // tex->SetLineWidth(2); // tex->Draw(); // tex = new TLatex(0.5175,0.725,"1.8 < |y^{#mu#mu}| < 2.4"); //tex->SetNDC(); // tex->SetTextSize(0.03); // tex->SetLineWidth(2); // tex->Draw(); // tex = new TLatex(0.5175,0.68,"4.5 < p_{T}^{#mu#mu} < 5.5 GeV/c"); //tex->SetNDC(); // tex->SetTextSize(0.03); // tex->SetLineWidth(2); // tex->Draw(); // tex = new TLatex(0.5175,0.635,"Cent. 0-100%"); //tex->SetNDC(); // tex->SetTextSize(0.03); // tex->SetLineWidth(2); // tex->Draw(); TLatex * tex = new TLatex(0.21,0.78,"4.5 #leq p_{T}^{#scale[1.3]{#mu#mu}} < 5.5 GeV/c"); tex->SetNDC(); tex->SetTextSize(0.036); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.21,0.84,"1.8 #leq |y^{#scale[1.3]{#mu#mu}}| < 2.4"); tex->SetNDC(); tex->SetTextSize(0.036); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.21,0.72,"Cent. 0-100%"); tex->SetNDC(); tex->SetTextSize(0.036); tex->SetLineWidth(2); tex->Draw(); // TLegend *leg = new TLegend(0.49,0.70,0.718,0.8809,NULL,"brNDC"); // TLegend *leg = new TLegend(0.6240602,0.498708,0.8508772,0.6795866,NULL,"brNDC"); // TLegend *leg = new TLegend(0.2055138,0.4728682,0.4323308,0.6537468,NULL,"brNDC"); TLegend *leg = new TLegend(0.1766917,0.4702842,0.4035088,0.6511628,NULL,"brNDC"); leg->SetTextFont(62); leg->SetTextSize(0.036); leg->SetLineColor(0); leg->SetLineStyle(0); leg->SetLineWidth(0); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("dOS","Data","pe"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(8); entry->SetMarkerSize(1.2); entry->SetTextFont(62); entry=leg->AddEntry("PDF","Total fit","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("JPSIPR","Prompt J/#psi","l"); ci = TColor::GetColor("#660000"); entry->SetLineColor(ci); entry->SetLineStyle(9); entry->SetLineWidth(3); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("JPSINOPR","J/#psi from b hadrons","l"); ci = TColor::GetColor("#006600"); entry->SetLineColor(ci); entry->SetLineStyle(4); entry->SetLineWidth(5); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); ci = TColor::GetColor("#9966ff"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("BKG","Background","fl"); ci = TColor::GetColor("#99ccff"); entry->SetFillColor(ci); entry->SetFillStyle(1001); leg->Draw(); // tex = new TLatex(0.96,0.9424,"PbPb 351 #mub^{-1} (5.02 TeV)"); tex = new TLatex(0.96,0.9424,"PbPb 368 #mub^{-1} (5.02 TeV)"); tex->SetNDC(); tex->SetTextAlign(31); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.16,0.9424,""); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.914,0.869275,"CMS"); tex->SetNDC(); tex->SetTextAlign(33); tex->SetTextFont(61); tex->SetTextSize(0.06); tex->SetLineWidth(2); tex->Draw(); // tex = new TLatex(0.914,0.797275,"Preliminary"); // tex->SetNDC(); // tex->SetTextAlign(33); // tex->SetTextFont(52); // tex->SetTextSize(0.0456); // tex->SetLineWidth(2); // tex->Draw(); // pad1_PbPb->Modified(); cMassFig_PbPb->cd(); // \\\\\////// // // TLatex * tex = new TLatex(0.21,0.77,"4.5 #leq p_{T}^{#mu#mu} < 5.5 GeV/c"); // tex->SetNDC(); // tex->SetTextSize(0.03); // tex->SetLineWidth(2); // tex->Draw(); // tex = new TLatex(0.21,0.86,"1.8 #leq |y^{#mu#mu}| < 2.4"); // tex->SetNDC(); // tex->SetTextSize(0.03); // tex->SetLineWidth(2); // tex->Draw(); // tex = new TLatex(0.21,0.725,"Cent. 0-100%"); // tex->SetNDC(); // tex->SetTextSize(0.03); // tex->SetLineWidth(2); // tex->Draw(); // // TLegend *leg = new TLegend(0.5175,0.7602,0.718,0.8809,NULL,"brNDC"); // leg->SetTextFont(62); // leg->SetTextSize(0.03); // leg->SetLineColor(1); // leg->SetLineStyle(1); // leg->SetLineWidth(1); // leg->SetFillColor(0); // leg->SetFillStyle(1001); // TLegendEntry *entry=leg->AddEntry("dOS","Data","pe"); // entry->SetLineColor(1); // entry->SetLineStyle(1); // entry->SetLineWidth(1); // entry->SetMarkerColor(1); // entry->SetMarkerStyle(8); // entry->SetMarkerSize(1.2); // entry->SetTextFont(62); // entry=leg->AddEntry("PDF","Total fit","l"); // entry->SetLineColor(1); // entry->SetLineStyle(1); // entry->SetLineWidth(3); // entry->SetMarkerColor(1); // entry->SetMarkerStyle(21); // entry->SetMarkerSize(1); // entry->SetTextFont(62); // entry=leg->AddEntry("JPSIPR","Prompt J/#psi","l"); // // ci = TColor::GetColor("#660000"); // entry->SetLineColor(ci); // entry->SetLineStyle(1); // entry->SetLineWidth(3); // entry->SetMarkerColor(1); // entry->SetMarkerStyle(21); // entry->SetMarkerSize(1); // entry->SetTextFont(62); // entry=leg->AddEntry("JPSINOPR","Non-Prompt J/#psi","l"); // // ci = TColor::GetColor("#006600"); // entry->SetLineColor(ci); // entry->SetLineStyle(1); // entry->SetLineWidth(3); // entry->SetMarkerColor(1); // entry->SetMarkerStyle(21); // entry->SetMarkerSize(1); // entry->SetTextFont(62); // entry=leg->AddEntry("BKG","Background","fl"); // // ci = TColor::GetColor("#99ccff"); // entry->SetFillColor(ci); // entry->SetFillStyle(1001); // // ci = TColor::GetColor("#0000ff"); // entry->SetLineColor(ci); // entry->SetLineStyle(2); // entry->SetLineWidth(3); // entry->SetMarkerColor(1); // entry->SetMarkerStyle(21); // entry->SetMarkerSize(1); // entry->SetTextFont(62); // leg->Draw(); cMassFig_PbPb->cd(); cMassFig_PbPb->Modified(); cMassFig_PbPb->cd(); cMassFig_PbPb->SetSelected(cMassFig_PbPb); }
plot() { //=========Macro generated from canvas: FigExample/FigExample //========= (Thu Feb 11 11:37:37 2016) by ROOT version5.34/32 TCanvas *FigExample = new TCanvas("FigExample", "FigExample",1,23,1364,719); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); FigExample->Range(-1158.419,-0.195,8561.764,1.43); FigExample->SetFillColor(0); FigExample->SetBorderMode(0); FigExample->SetBorderSize(2); FigExample->SetLeftMargin(0.12); FigExample->SetRightMargin(0.04); FigExample->SetTopMargin(0.08); FigExample->SetBottomMargin(0.12); FigExample->SetFrameFillStyle(0); FigExample->SetFrameBorderMode(0); FigExample->SetFrameFillStyle(0); FigExample->SetFrameBorderMode(0); TGraphErrors *gre = new TGraphErrors(11); gre->SetName("Graph1"); gre->SetTitle(""); gre->SetFillColor(1); gre->SetLineColor(4); gre->SetMarkerColor(4); gre->SetMarkerStyle(22); gre->SetMarkerSize(1.5); gre->SetPoint(0,8.892308,0.97914); gre->SetPointError(0,0,0.00119056); gre->SetPoint(1,10.38462,0.973453); gre->SetPointError(1,0,0.00225169); gre->SetPoint(2,23.53846,0.980456); gre->SetPointError(2,0,0.00126418); gre->SetPoint(3,43.84615,0.97976); gre->SetPointError(3,0,0.001007); gre->SetPoint(4,120.3077,0.971649); gre->SetPointError(4,0,0.000816721); gre->SetPoint(5,164.6154,0.970778); gre->SetPointError(5,0,0.000914539); gre->SetPoint(6,389.2308,0.953326); gre->SetPointError(6,0,0.00131593); gre->SetPoint(7,753.8462,0.942877); gre->SetPointError(7,0,0.0019686); gre->SetPoint(8,1266.154,0.914665); gre->SetPointError(8,0,0.00283506); gre->SetPoint(9,3400,0.867066); gre->SetPointError(9,0,0.00370407); gre->SetPoint(10,7430.769,0.807229); gre->SetPointError(10,0,0.0060241); TH1F *Graph_Graph_Graph116 = new TH1F("Graph_Graph_Graph116","",100,8.003077,8172.957); Graph_Graph_Graph116->SetMinimum(0); Graph_Graph_Graph116->SetMaximum(1.3); Graph_Graph_Graph116->SetDirectory(0); Graph_Graph_Graph116->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); Graph_Graph_Graph116->SetLineColor(ci); Graph_Graph_Graph116->SetLineStyle(0); Graph_Graph_Graph116->SetMarkerStyle(20); Graph_Graph_Graph116->GetXaxis()->SetTitle("Average rate ( N_{#mu}.s^{-1}.cm^{-2} )"); Graph_Graph_Graph116->GetXaxis()->CenterTitle(true); Graph_Graph_Graph116->GetXaxis()->SetLabelFont(42); Graph_Graph_Graph116->GetXaxis()->SetLabelOffset(0.01); Graph_Graph_Graph116->GetXaxis()->SetLabelSize(0.05); Graph_Graph_Graph116->GetXaxis()->SetTitleSize(0.05); Graph_Graph_Graph116->GetXaxis()->SetTitleOffset(1.1); Graph_Graph_Graph116->GetXaxis()->SetTitleFont(42); Graph_Graph_Graph116->GetYaxis()->SetTitle("#mu detection efficiency"); Graph_Graph_Graph116->GetYaxis()->CenterTitle(true); Graph_Graph_Graph116->GetYaxis()->SetLabelFont(42); Graph_Graph_Graph116->GetYaxis()->SetLabelOffset(0.007); Graph_Graph_Graph116->GetYaxis()->SetLabelSize(0.05); Graph_Graph_Graph116->GetYaxis()->SetTitleSize(0.05); Graph_Graph_Graph116->GetYaxis()->SetTitleOffset(0.9); Graph_Graph_Graph116->GetYaxis()->SetTitleFont(42); Graph_Graph_Graph116->GetZaxis()->SetLabelFont(42); Graph_Graph_Graph116->GetZaxis()->SetLabelOffset(0.007); Graph_Graph_Graph116->GetZaxis()->SetLabelSize(0.05); Graph_Graph_Graph116->GetZaxis()->SetTitleSize(0.06); Graph_Graph_Graph116->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph_Graph116); gre->Draw("pa"); gre = new TGraphErrors(11); gre->SetName("Graph3"); gre->SetTitle(""); gre->SetFillColor(1); gre->SetLineColor(4); gre->SetMarkerColor(4); gre->SetMarkerStyle(23); gre->SetMarkerSize(1.5); gre->SetPoint(0,8.892308,0.945552); gre->SetPointError(0,0,0.00222099); gre->SetPoint(1,10.38462,0.937882); gre->SetPointError(1,0,0.00397671); gre->SetPoint(2,23.53846,0.945317); gre->SetPointError(2,0,0.0024096); gre->SetPoint(3,43.84615,0.950864); gre->SetPointError(3,0,0.00176728); gre->SetPoint(4,120.3077,0.94505); gre->SetPointError(4,0,0.00122324); gre->SetPoint(5,164.6154,0.942688); gre->SetPointError(5,0,0.00136884); gre->SetPoint(6,389.2308,0.921693); gre->SetPointError(6,0,0.00178155); gre->SetPoint(7,753.8462,0.905909); gre->SetPointError(7,0,0.002633); gre->SetPoint(8,1266.154,0.891392); gre->SetPointError(8,0,0.00331251); gre->SetPoint(9,3400,0.868524); gre->SetPointError(9,0,0.003775); gre->SetPoint(10,7430.769,0.847397); gre->SetPointError(10,0,0.00551738); TH1F *Graph_Graph_Graph327 = new TH1F("Graph_Graph_Graph327","",100,8.003077,8172.957); Graph_Graph_Graph327->SetMinimum(0.8308045); Graph_Graph_Graph327->SetMaximum(0.9637064); Graph_Graph_Graph327->SetDirectory(0); Graph_Graph_Graph327->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph_Graph327->SetLineColor(ci); Graph_Graph_Graph327->SetLineStyle(0); Graph_Graph_Graph327->SetMarkerStyle(20); Graph_Graph_Graph327->GetXaxis()->SetTitle("Average rate ( N_{#mu}.s^{-1}.cm^{-2} )"); Graph_Graph_Graph327->GetXaxis()->CenterTitle(true); Graph_Graph_Graph327->GetXaxis()->SetLabelFont(42); Graph_Graph_Graph327->GetXaxis()->SetLabelOffset(0.007); Graph_Graph_Graph327->GetXaxis()->SetLabelSize(0.05); Graph_Graph_Graph327->GetXaxis()->SetTitleSize(0.05); Graph_Graph_Graph327->GetXaxis()->SetTitleOffset(1.1); Graph_Graph_Graph327->GetXaxis()->SetTitleFont(42); Graph_Graph_Graph327->GetYaxis()->SetTitle("#mu detection efficiency"); Graph_Graph_Graph327->GetYaxis()->CenterTitle(true); Graph_Graph_Graph327->GetYaxis()->SetLabelFont(42); Graph_Graph_Graph327->GetYaxis()->SetLabelOffset(0.007); Graph_Graph_Graph327->GetYaxis()->SetLabelSize(0.05); Graph_Graph_Graph327->GetYaxis()->SetTitleSize(0.05); Graph_Graph_Graph327->GetYaxis()->SetTitleOffset(0.9); Graph_Graph_Graph327->GetYaxis()->SetTitleFont(42); Graph_Graph_Graph327->GetZaxis()->SetLabelFont(42); Graph_Graph_Graph327->GetZaxis()->SetLabelOffset(0.007); Graph_Graph_Graph327->GetZaxis()->SetLabelSize(0.05); Graph_Graph_Graph327->GetZaxis()->SetTitleSize(0.06); Graph_Graph_Graph327->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph_Graph327); gre->Draw("p&"); gre = new TGraphErrors(10); gre->SetName("Graph4"); gre->SetTitle(""); gre->SetFillColor(1); gre->SetLineColor(4); gre->SetMarkerColor(4); gre->SetMarkerStyle(26); gre->SetMarkerSize(1.5); gre->SetPoint(0,10.38462,0.818118); gre->SetPointError(0,0,0.00652498); gre->SetPoint(1,23.53846,0.859551); gre->SetPointError(1,0,0.00371018); gre->SetPoint(2,43.84615,0.869325); gre->SetPointError(2,0,0.00275425); gre->SetPoint(3,120.3077,0.852496); gre->SetPointError(3,0,0.00191306); gre->SetPoint(4,164.6154,0.844565); gre->SetPointError(4,0,0.00214338); gre->SetPoint(5,389.2308,0.801642); gre->SetPointError(5,0,0.00267808); gre->SetPoint(6,753.8462,0.77863); gre->SetPointError(6,0,0.00379423); gre->SetPoint(7,1266.154,0.751091); gre->SetPointError(7,0,0.00470814); gre->SetPoint(8,3400,0.700803); gre->SetPointError(8,0,0.00534877); gre->SetPoint(9,7430.769,0.681421); gre->SetPointError(9,0,0.00746557); TH1F *Graph_Graph_Graph438 = new TH1F("Graph_Graph_Graph438","",100,9.346154,8172.808); Graph_Graph_Graph438->SetMinimum(0.654143); Graph_Graph_Graph438->SetMaximum(0.8918916); Graph_Graph_Graph438->SetDirectory(0); Graph_Graph_Graph438->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph_Graph438->SetLineColor(ci); Graph_Graph_Graph438->SetLineStyle(0); Graph_Graph_Graph438->SetMarkerStyle(20); Graph_Graph_Graph438->GetXaxis()->SetTitle("Average rate ( N_{#mu}.s^{-1}.cm^{-2} )"); Graph_Graph_Graph438->GetXaxis()->CenterTitle(true); Graph_Graph_Graph438->GetXaxis()->SetLabelFont(42); Graph_Graph_Graph438->GetXaxis()->SetLabelOffset(0.01); Graph_Graph_Graph438->GetXaxis()->SetLabelSize(0.05); Graph_Graph_Graph438->GetXaxis()->SetTitleSize(0.05); Graph_Graph_Graph438->GetXaxis()->SetTitleOffset(1.1); Graph_Graph_Graph438->GetXaxis()->SetTitleFont(42); Graph_Graph_Graph438->GetYaxis()->SetTitle("#mu detection efficiency"); Graph_Graph_Graph438->GetYaxis()->CenterTitle(true); Graph_Graph_Graph438->GetYaxis()->SetLabelFont(42); Graph_Graph_Graph438->GetYaxis()->SetLabelOffset(0.007); Graph_Graph_Graph438->GetYaxis()->SetLabelSize(0.05); Graph_Graph_Graph438->GetYaxis()->SetTitleSize(0.05); Graph_Graph_Graph438->GetYaxis()->SetTitleOffset(0.9); Graph_Graph_Graph438->GetYaxis()->SetTitleFont(42); Graph_Graph_Graph438->GetZaxis()->SetLabelFont(42); Graph_Graph_Graph438->GetZaxis()->SetLabelOffset(0.007); Graph_Graph_Graph438->GetZaxis()->SetLabelSize(0.05); Graph_Graph_Graph438->GetZaxis()->SetTitleSize(0.06); Graph_Graph_Graph438->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph_Graph438); gre->Draw("p&"); gre = new TGraphErrors(11); gre->SetName("Graph5"); gre->SetTitle(""); gre->SetFillColor(1); gre->SetLineColor(4); gre->SetMarkerColor(4); gre->SetMarkerStyle(32); gre->SetMarkerSize(1.5); gre->SetPoint(0,8.892308,0.964904); gre->SetPointError(0,0,0.00161884); gre->SetPoint(1,10.38462,0.968371); gre->SetPointError(1,0,0.00261764); gre->SetPoint(2,23.53846,0.966203); gre->SetPointError(2,0,0.00172469); gre->SetPoint(3,43.84615,0.966627); gre->SetPointError(3,0,0.00131816); gre->SetPoint(4,120.3077,0.952356); gre->SetPointError(4,0,0.00103524); gre->SetPoint(5,164.6154,0.947467); gre->SetPointError(5,0,0.00119486); gre->SetPoint(6,389.2308,0.920595); gre->SetPointError(6,0,0.00164465); gre->SetPoint(7,753.8462,0.899052); gre->SetPointError(7,0,0.00250036); gre->SetPoint(8,1266.154,0.871394); gre->SetPointError(8,0,0.00333283); gre->SetPoint(9,3400,0.817966); gre->SetPointError(9,0,0.00415542); gre->SetPoint(10,7430.769,0.771213); gre->SetPointError(10,0,0.00633324); TH1F *Graph_Graph_Graph549 = new TH1F("Graph_Graph_Graph549","",100,8.003077,8172.957); Graph_Graph_Graph549->SetMinimum(0.7442689); Graph_Graph_Graph549->SetMaximum(0.9915995); Graph_Graph_Graph549->SetDirectory(0); Graph_Graph_Graph549->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph_Graph549->SetLineColor(ci); Graph_Graph_Graph549->SetLineStyle(0); Graph_Graph_Graph549->SetMarkerStyle(20); Graph_Graph_Graph549->GetXaxis()->SetTitle("Average rate ( N_{#mu}.s^{-1}.cm^{-2} )"); Graph_Graph_Graph549->GetXaxis()->CenterTitle(true); Graph_Graph_Graph549->GetXaxis()->SetLabelFont(42); Graph_Graph_Graph549->GetXaxis()->SetLabelOffset(0.01); Graph_Graph_Graph549->GetXaxis()->SetLabelSize(0.05); Graph_Graph_Graph549->GetXaxis()->SetTitleSize(0.05); Graph_Graph_Graph549->GetXaxis()->SetTitleOffset(1.1); Graph_Graph_Graph549->GetXaxis()->SetTitleFont(42); Graph_Graph_Graph549->GetYaxis()->SetTitle("#mu detection efficiency"); Graph_Graph_Graph549->GetYaxis()->CenterTitle(true); Graph_Graph_Graph549->GetYaxis()->SetLabelFont(42); Graph_Graph_Graph549->GetYaxis()->SetLabelOffset(0.007); Graph_Graph_Graph549->GetYaxis()->SetLabelSize(0.05); Graph_Graph_Graph549->GetYaxis()->SetTitleSize(0.05); Graph_Graph_Graph549->GetYaxis()->SetTitleOffset(0.9); Graph_Graph_Graph549->GetYaxis()->SetTitleFont(42); Graph_Graph_Graph549->GetZaxis()->SetLabelFont(42); Graph_Graph_Graph549->GetZaxis()->SetLabelOffset(0.007); Graph_Graph_Graph549->GetZaxis()->SetLabelSize(0.05); Graph_Graph_Graph549->GetZaxis()->SetTitleSize(0.06); Graph_Graph_Graph549->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph_Graph549); gre->Draw("p&"); gre = new TGraphErrors(11); gre->SetName("Graph6"); gre->SetTitle(""); gre->SetFillColor(1); gre->SetLineColor(2); gre->SetMarkerColor(2); gre->SetMarkerStyle(31); gre->SetMarkerSize(1.5); gre->SetPoint(0,8.892308,0.937506); gre->SetPointError(0,0,0.00238084); gre->SetPoint(1,10.38462,0.932408); gre->SetPointError(1,0,0.00416789); gre->SetPoint(2,23.53846,0.852038); gre->SetPointError(2,0,0.00397868); gre->SetPoint(3,43.84615,0.707619); gre->SetPointError(3,0,0.00429972); gre->SetPoint(4,120.3077,0.38838); gre->SetPointError(4,0,0.00401168); gre->SetPoint(5,164.6154,0.348649); gre->SetPointError(5,0,0.00451826); gre->SetPoint(6,389.2308,0.254837); gre->SetPointError(6,0,0.00521552); gre->SetPoint(7,753.8462,0.245527); gre->SetPointError(7,0,0.00698108); gre->SetPoint(8,1266.154,0.250365); gre->SetPointError(8,0,0.00802127); gre->SetPoint(9,3400,0.232597); gre->SetPointError(9,0,0.00840615); gre->SetPoint(10,7430.769,0.186328); gre->SetPointError(10,0,0.0117775); TH1F *Graph_Graph_Graph6510 = new TH1F("Graph_Graph_Graph6510","",100,8.003077,8172.957); Graph_Graph_Graph6510->SetMinimum(0.09801687); Graph_Graph_Graph6510->SetMaximum(1.01642); Graph_Graph_Graph6510->SetDirectory(0); Graph_Graph_Graph6510->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph_Graph6510->SetLineColor(ci); Graph_Graph_Graph6510->SetLineStyle(0); Graph_Graph_Graph6510->SetMarkerStyle(20); Graph_Graph_Graph6510->GetXaxis()->SetTitle("Average rate ( N_{#mu}.s^{-1}.cm^{-2} )"); Graph_Graph_Graph6510->GetXaxis()->CenterTitle(true); Graph_Graph_Graph6510->GetXaxis()->SetLabelFont(42); Graph_Graph_Graph6510->GetXaxis()->SetLabelOffset(0.01); Graph_Graph_Graph6510->GetXaxis()->SetLabelSize(0.05); Graph_Graph_Graph6510->GetXaxis()->SetTitleSize(0.05); Graph_Graph_Graph6510->GetXaxis()->SetTitleOffset(3); Graph_Graph_Graph6510->GetXaxis()->SetTitleFont(42); Graph_Graph_Graph6510->GetYaxis()->SetTitle("#mu detection efficiency"); Graph_Graph_Graph6510->GetYaxis()->CenterTitle(true); Graph_Graph_Graph6510->GetYaxis()->SetLabelFont(42); Graph_Graph_Graph6510->GetYaxis()->SetLabelOffset(0.007); Graph_Graph_Graph6510->GetYaxis()->SetLabelSize(0.05); Graph_Graph_Graph6510->GetYaxis()->SetTitleSize(0.05); Graph_Graph_Graph6510->GetYaxis()->SetTitleOffset(1.1); Graph_Graph_Graph6510->GetYaxis()->SetTitleFont(42); Graph_Graph_Graph6510->GetZaxis()->SetLabelFont(42); Graph_Graph_Graph6510->GetZaxis()->SetLabelOffset(0.007); Graph_Graph_Graph6510->GetZaxis()->SetLabelSize(0.05); Graph_Graph_Graph6510->GetZaxis()->SetTitleSize(0.06); Graph_Graph_Graph6510->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph_Graph6510); gre->Draw("p&"); TLatex * tex = new TLatex(0.96,0.936," "); tex->SetNDC(); tex->SetTextAlign(31); tex->SetTextFont(42); tex->SetTextSize(0.048); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.1722,0.892,"Preliminary"); tex->SetNDC(); tex->SetTextAlign(13); tex->SetTextFont(52); tex->SetTextSize(0.0456); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.1722,0.851872,"Gas mixture : 93% TFE, 5%CO_{2}, 2%SF_{6}"); tex->SetNDC(); tex->SetTextAlign(13); tex->SetTextFont(52); tex->SetTextSize(0.0264); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.1722,0.811744,"Threshold : 0.13pC"); tex->SetNDC(); tex->SetTextAlign(13); tex->SetTextFont(52); tex->SetTextSize(0.0264); tex->SetLineWidth(2); tex->Draw(); TH1F *Graph1 = new TH1F("Graph1","",100,8.003077,8172.957); Graph1->SetMinimum(0.7831534); Graph1->SetMaximum(0.9997717); Graph1->SetDirectory(0); Graph1->SetStats(0); ci = TColor::GetColor("#000099"); Graph1->SetLineColor(ci); Graph1->SetLineStyle(0); Graph1->SetMarkerStyle(20); Graph1->GetXaxis()->SetTitle("Average rate ( N_{#mu}.s^{-1}.cm^{-2} )"); Graph1->GetXaxis()->CenterTitle(true); Graph1->GetXaxis()->SetLabelFont(42); Graph1->GetXaxis()->SetLabelOffset(0.01); Graph1->GetXaxis()->SetLabelSize(0.05); Graph1->GetXaxis()->SetTitleSize(0.05); Graph1->GetXaxis()->SetTitleOffset(1.4); Graph1->GetXaxis()->SetTitleFont(42); Graph1->GetYaxis()->SetTitle("#mu detection efficiency"); Graph1->GetYaxis()->CenterTitle(true); Graph1->GetYaxis()->SetLabelFont(42); Graph1->GetYaxis()->SetLabelOffset(0.007); Graph1->GetYaxis()->SetLabelSize(0.05); Graph1->GetYaxis()->SetTitleSize(0.05); Graph1->GetYaxis()->SetTitleOffset(0.9); Graph1->GetYaxis()->SetTitleFont(42); Graph1->GetZaxis()->SetLabelFont(42); Graph1->GetZaxis()->SetLabelOffset(0.007); Graph1->GetZaxis()->SetLabelSize(0.05); Graph1->GetZaxis()->SetTitleSize(0.06); Graph1->GetZaxis()->SetTitleFont(42); Graph1->Draw("sameaxis"); TH1F *Graph1 = new TH1F("Graph1","",100,8.003077,8172.957); Graph1->SetMinimum(0.7831534); Graph1->SetMaximum(0.9997717); Graph1->SetDirectory(0); Graph1->SetStats(0); ci = TColor::GetColor("#000099"); Graph1->SetLineColor(ci); Graph1->SetLineStyle(0); Graph1->SetMarkerStyle(20); Graph1->GetXaxis()->SetTitle("Average rate ( N_{#mu}.s^{-1}.cm^{-2} )"); Graph1->GetXaxis()->CenterTitle(true); Graph1->GetXaxis()->SetLabelFont(42); Graph1->GetXaxis()->SetLabelOffset(0.01); Graph1->GetXaxis()->SetLabelSize(0.05); Graph1->GetXaxis()->SetTitleSize(0.05); Graph1->GetXaxis()->SetTitleOffset(1.4); Graph1->GetXaxis()->SetTitleFont(42); Graph1->GetYaxis()->SetTitle("#mu detection efficiency"); Graph1->GetYaxis()->CenterTitle(true); Graph1->GetYaxis()->SetLabelFont(42); Graph1->GetYaxis()->SetLabelOffset(0.007); Graph1->GetYaxis()->SetLabelSize(0.05); Graph1->GetYaxis()->SetTitleSize(0.05); Graph1->GetYaxis()->SetTitleOffset(0.9); Graph1->GetYaxis()->SetTitleFont(42); Graph1->GetZaxis()->SetLabelFont(42); Graph1->GetZaxis()->SetLabelOffset(0.007); Graph1->GetZaxis()->SetLabelSize(0.05); Graph1->GetZaxis()->SetTitleSize(0.06); Graph1->GetZaxis()->SetTitleFont(42); Graph1->Draw("sameaxis"); TLegend *leg = new TLegend(0.5,0.8,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextSize(0.025); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("NULL","SPS test beams 06.2015","h"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph1","","p"); entry->SetFillStyle(1001); entry->SetLineColor(2); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(4); entry->SetMarkerStyle(22); entry->SetMarkerSize(1.5); entry->SetTextAlign(13); entry->SetTextFont(42); entry=leg->AddEntry("Graph3","","p"); entry->SetFillStyle(1001); entry->SetLineColor(4); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(4); entry->SetMarkerStyle(23); entry->SetMarkerSize(1.5); entry->SetTextFont(42); entry=leg->AddEntry("Graph4","","p"); entry->SetFillStyle(1001); entry->SetLineColor(5); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(4); entry->SetMarkerStyle(26); entry->SetMarkerSize(1.5); entry->SetTextFont(42); entry=leg->AddEntry("Graph5","Low resistive glass RPC - 10^{10} #Omega.cm : 1,2,3,4","p"); entry->SetFillStyle(1001); entry->SetLineColor(6); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(4); entry->SetMarkerStyle(32); entry->SetMarkerSize(1.5); entry->SetTextFont(42); entry=leg->AddEntry(""," ","p"); entry->SetFillStyle(1001); entry->SetLineColor(6); entry->SetLineWidth(1); entry->SetMarkerColor(6); entry->SetMarkerStyle(21); entry->SetTextFont(42); entry=leg->AddEntry(""," ","p"); entry->SetFillStyle(1001); entry->SetLineColor(6); entry->SetLineWidth(1); entry->SetMarkerColor(6); entry->SetMarkerStyle(21); entry->SetTextFont(42); entry=leg->AddEntry(""," ","p"); entry->SetFillStyle(1001); entry->SetLineColor(6); entry->SetLineWidth(1); entry->SetMarkerColor(6); entry->SetMarkerStyle(21); entry->SetTextFont(42); entry=leg->AddEntry("Graph6","Float glass RPC ~10^{12}-10^{13} #Omega.cm","p"); entry->SetFillStyle(1001); entry->SetLineColor(7); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(2); entry->SetMarkerStyle(31); entry->SetMarkerSize(1.5); entry->SetTextFont(42); leg->Draw(); TLine *line = new TLine(0,1,8185,1); line->SetLineStyle(2); line->Draw(); FigExample->Modified(); FigExample->cd(); FigExample->SetSelected(FigExample); }
void ptetaphi(){ TString coll="PbP"; gStyle->SetPadTickY(1); using namespace std; c1 = new TCanvas("c1"," ",1000,650); gStyle->SetOptStat(kFALSE); gStyle->SetErrorX(0); makeMultiPanelCanvas(c1,3,2,0,0,0.22,0.16,0.12); //TFile *fMCMC = new TFile("/home/maoy/Public/PPb_UnfoPriorGen_akPu3PFOfficialMCNoIDCut_MCJECv8_jtpt20_EtaBin-10_10_Inc_v6.root"); //TFile *fDataMC = new TFile("/home/maoy/Public/DATAPPbakPu3PFJetSpectraKurtCombineJetTriggerEtaWeight7EtabinJetIDCutRecoPt.root"); for(int ivar=0;ivar<2;ivar++){ //TH2F* hPP=(TH2F*)fMCPPxSec->Get(histoname[ivar]); if(coll=="PPb"){ TH2F* hMC=(TH2F*)fMCPPb->Get(histoname[ivar]); TH2F* hdata=(TH2F*)fDataPPb->Get(histoname[ivar]); TH2F* hdata_woRes=(TH2F*)fDataPPb->Get(histoname_woRes[ivar]); } if(coll=="PbP"){ TH2F* hMC=(TH2F*)fMCPbP->Get(histoname[ivar]); TH2F* hdata=(TH2F*)fDataPbP->Get(histoname[ivar]); TH2F* hdata_woRes=(TH2F*)fDataPbP->Get(histoname_woRes[ivar]); } TString varname; if(histoname[ivar].Contains("Eta")) varname="#eta_{lab}^{jet}"; else varname="#phi^{jet}"; if(varname=="#eta_{lab}^{jet}"){ double binbound_var[]={-3.0,-2.7,-2.4,-2.1,-1.8,-1.5,-1.2,-0.9,-0.6,-0.3,0.0,0.3,0.6,0.9,1.2,1.5,1.8,2.1,2.4,2.7,3.0}; int Nbin_var=sizeof(binbound_var)/sizeof(double)-1; TString varname_ = "eta"; } else{ int Nbin_var=20; double binbound_var[21]; for(int i=0;i<Nbin_var+1;i++) binbound_var[i]=-TMath::Pi()+i*TMath::Pi()*2/Nbin_var; TString varname_ = "phi"; } if(varname=="#eta_{lab}^{jet}"){ //double xrange_var[2]={-1-0.465+1e-3,1-0.465-1e-3}; double xrange_var[2]={-2.4+1e-3,2.4-1e-3}; double xrange_var_pre[2]={-2.6,2.7}; } else{ double xrange_var[2]={binbound_var[0]+1e-3,binbound_var[Nbin_var]-1e-3}; double xrange_var_pre[2]={-3.4,3.4}; } double ratiomin=0.7, ratiomax=1.52; TString Titley="Event Fraction"; //TString Titley="Jet cross section d#sigma/dp_{T}"; TH1D* hdata_var=hdata->ProjectionY(Form("hdata_%s",varname_.Data()),hdata->GetXaxis()->FindBin(xrange_pt[0]),hdata->GetXaxis()->FindBin(xrange_pt[1])); //TH1D* hdata_var_all=hdata->ProjectionY("hdata_var_all",hdata->GetXaxis()->FindBin(binbound_pt[10]+1e-4),hdata->GetXaxis()->FindBin(binbound_pt[Nbin_pt]-1e-4)); TH1D* hdata_pt=hdata->ProjectionX("hdata_pt",hdata->GetYaxis()->FindBin(xrange_var[0]),hdata->GetYaxis()->FindBin(xrange_var[1])); //TH1D* hdata_pt=hdata->ProjectionX("hdata_pt",0,-1); //TH1D* hdata_pt_all=hdata->ProjectionX("hdata_pt_all",hdata->GetYaxis()->FindBin(binbound_var[0]+1e-4),hdata->GetYaxis()->FindBin(binbound_var[Nbin_var]-1e-4)); //TH1D* hdata_pt =(TH1D*)fDataPPb->Get("jetpt"); //TH1D* hdata_pt = (TH1D*)fDataMC->Get("jetptEtaBin-10_10"); TH1D* hMC_var=hMC->ProjectionY(Form("hMC_%s",varname_.Data()),hMC->GetXaxis()->FindBin(xrange_pt[0]),hMC->GetXaxis()->FindBin(xrange_pt[1])); //TH1D* hMC_var_all=hMC->ProjectionY("hMC_var_all",hMC->GetXaxis()->FindBin(binbound_pt[10]+1e-4),hMC->GetXaxis()->FindBin(binbound_pt[Nbin_pt]-1e-4)); TH1D* hMC_pt=hMC->ProjectionX("hMC_pt",hMC->GetYaxis()->FindBin(xrange_var[0]),hMC->GetYaxis()->FindBin(xrange_var[1])); //TH1D* hMC_pt=hMC->ProjectionX("hMC_pt",0,-1); //TH1D* hMC_pt_all=hMC->ProjectionX("hMC_pt_all",hMC->GetYaxis()->FindBin(binbound_var[0]+1e-4),hMC->GetYaxis()->FindBin(binbound_var[Nbin_var]-1e-4)); //TH1D* hMC_pt =(TH1D*)fMCPPb->Get("jetpt"); //TH1D* hMC_pt = (TH1D*)fMCMC->Get("hMeas0"); // TH1F *hPP_pt1 = (TH1F*)fMCPP->Get(Form("ak3GenJetSpectrum_QCD10001_%s/JetSpectrum_Fine",etabinnamesym[0].Data())); // TH1F *hPP_pt2 = (TH1F*)fMCPP->Get(Form("ak3GenJetSpectrum_QCD10001_%s/JetSpectrum_Fine",etabinnamesym[1].Data())); // TH1F *hMC_pt = (TH1F*)hPP_pt1->Clone(); // hMC_pt->Add(hPP_pt2); TH1D* re_hdata_pt=(TH1D*)hdata_pt->Rebin(Nbin_pt,"re_hdata_pt",binbound_pt); TH1D* re_hMC_pt=(TH1D*)hMC_pt->Rebin(Nbin_pt,"re_hMC_pt",binbound_pt); TH1D* re_hdata_var=(TH1D*)hdata_var->Rebin(Nbin_var,"re_hdata_var",binbound_var); TH1D* re_hMC_var=(TH1D*)hMC_var->Rebin(Nbin_var,"re_hMC_var",binbound_var); normalizeByBinWidth(re_hdata_pt); normalizeByBinWidth(re_hMC_pt); normalizeByBinWidth(re_hdata_var); normalizeByBinWidth(re_hMC_var); re_hdata_pt->Scale(1./re_hdata_pt->Integral(re_hdata_pt->GetXaxis()->FindBin(xrange_pt[0]),re_hdata_pt->GetXaxis()->FindBin(xrange_pt[1]))); re_hdata_var->Scale(1./re_hdata_var->Integral(re_hdata_var->GetXaxis()->FindBin(xrange_var[0]),re_hdata_var->GetXaxis()->FindBin(xrange_var[1]))); re_hMC_pt->Scale(1./re_hMC_pt->Integral(re_hMC_pt->GetXaxis()->FindBin(xrange_pt[0]),re_hMC_pt->GetXaxis()->FindBin(xrange_pt[1]))); re_hMC_var->Scale(1./re_hMC_var->Integral(re_hMC_var->GetXaxis()->FindBin(xrange_var[0]),re_hMC_var->GetXaxis()->FindBin(xrange_var[1]))); //re_hdata_var->Scale(1.0/20.4*1e-6/208); //re_hdata_pt->Scale(1.0/20.4*1e-6/208); //double scale = re_hdata_pt->Integral(re_hdata_pt->GetXaxis()->FindBin(xrange_pt[0]),re_hdata_pt->GetXaxis()->FindBin(xrange_pt[1]))/re_hdata_pt->Integral(re_hdata_pt->GetXaxis()->FindBin(xrange_pt_pre[0]),re_hdata_pt->GetXaxis()->FindBin(xrange_pt_pre[1])); //re_hdata_pt->Scale((double)scale); //re_hMC_pt->Scale((double)scale); re_hdata_pt->SetMarkerStyle(20); re_hdata_pt->SetMarkerSize(1); re_hdata_pt->SetMarkerColor(1); re_hdata_pt->SetLineColor(1); re_hMC_pt->SetFillStyle(3004); re_hMC_pt->SetFillColor(2); re_hMC_pt->SetLineColor(2); re_hdata_var->SetMarkerStyle(20); re_hdata_var->SetMarkerSize(1); re_hdata_var->SetMarkerColor(1); re_hdata_var->SetLineColor(1); re_hMC_var->SetFillStyle(3004); re_hMC_var->SetFillColor(2); re_hMC_var->SetLineColor(2); TLatex T; T.SetNDC(); T.SetTextAlign(12); T.SetTextSize(0.06); T.SetTextColor(1); T.SetTextFont(42); TH1F* hFrame=new TH1F("","",1000,0,1000); fixedFontHist(hFrame,1.2,1.5); hFrame->GetXaxis()->SetTitleSize(0.06); hFrame->GetYaxis()->SetTitleSize(0.06); //hFrame->GetXaxis()->SetLabelSize(1); //hFrame->GetYaxis()->SetLabelSize(1); TLine *l1 =new TLine(xrange_pt_pre[0],1,xrange_pt_pre[1],1); l1->SetLineStyle(2); l1->SetLineColor(1); TLegend *leg1=new TLegend(0.35,0.64,0.50,0.84); leg1->SetBorderSize(0); leg1->SetFillStyle(0); leg1->SetTextSize(0.05); leg1->SetFillColor(0); TLegend *leg2=new TLegend(0.35,0.22,0.65,0.42); leg2->SetBorderSize(0); leg2->SetFillStyle(0); leg2->SetTextSize(0.05); leg2->SetFillColor(0); if(ivar==0){ c1->cd(1)->SetLogy(); hFrame->GetYaxis()->SetTitle(Titley); hFrame->GetXaxis()->SetTitle(""); hFrame->GetXaxis()->SetNdivisions(505); fixedFontHist(hFrame,1.6,2.2); //hFrame->GetXaxis()->SetRangeUser(27,692); hFrame->GetXaxis()->SetRangeUser(xrange_pt_pre[0],xrange_pt_pre[1]); //hFrame->GetYaxis()->SetRangeUser(1.01e-10,1e-2); hFrame->GetYaxis()->SetRangeUser(1.01e-7,1e1); hFrame->DrawCopy(); re_hdata_pt->Draw("E1same"); re_hMC_pt->Draw("E1 HISTsame"); if(varname=="#eta_{lab}^{jet}") T.DrawLatex(0.44,0.80,Form("%.1f < %s < %.1f",varname.Data(),xrange_var[0],xrange_var[1])); else T.DrawLatex(0.44,0.80,Form("%.2f < %s < %.2f",varname.Data(),xrange_var[0],xrange_var[1])); c1->cd(4); hFrame->GetXaxis()->SetTitle("p^{jet}_{T} [GeV/c]"); hFrame->GetYaxis()->SetRangeUser(ratiomin,ratiomax); TH1D* ratio_DatavsMC_pt=(TH1D*)re_hdata_pt->Clone("ratio_DatavsMC_pt"); ratio_DatavsMC_pt->Divide(re_hMC_pt); hFrame->GetYaxis()->SetTitle("#frac{Data}{MC}"); hFrame->DrawCopy(); ratio_DatavsMC_pt->SetMarkerStyle(20); ratio_DatavsMC_pt->SetLineColor(1); ratio_DatavsMC_pt->SetMarkerColor(1); ratio_DatavsMC_pt->SetMarkerSize(1); ratio_DatavsMC_pt->Draw("E1same"); l1->Draw("same"); } TH1F* hFrame1=new TH1F("","",800,-4,4); //hFrame1->GetYaxis()->SetLabelSize(0.06); hFrame1->GetYaxis()->SetTitleSize(0.06); hFrame1->GetXaxis()->SetTitleSize(0.06); //hFrame1->GetXaxis()->SetLabelSize(0.06); c1->cd(ivar+2); hFrame1->GetYaxis()->SetLabelSize(0.06); hFrame1->GetXaxis()->SetRangeUser(xrange_var_pre[0],xrange_var_pre[1]); hFrame1->GetYaxis()->SetTitle(""); //hFrame1->GetYaxis()->SetRangeUser(1e-6,1e-2); //hFrame1->GetYaxis()->SetRangeUser(1.01e-4,1e-3); hFrame1->GetYaxis()->SetRangeUser(0.008,1e-1); fixedFontHist(hFrame1,1.9,1.2); if(varname=="#eta_{lab}^{jet}"){ hFrame1->DrawCopy(); T.DrawLatex(0.34,0.80,Form("%.f < p_{T}^{jet} < %.f (GeV/c)",xrange_pt_pre[0],xrange_pt_pre[1])); } else{ hFrame1->DrawCopy("Y+"); } re_hdata_var->DrawCopy("E1same"); leg1->AddEntry(re_hdata_var,"Pb going positive Data","lp"); //if(varname!="#eta_{lab}^{jet}"){ //fixedFontHist(hFrame1,1.9,1.2); //hFrame1->DrawCopy("Y+"); //} //hFrame1->DrawCopy(); leg1->AddEntry(re_hMC_var,"PYTHIA+HIJING","lp"); re_hMC_var->DrawCopy("E1HISTsame"); if(varname!="#eta_{lab}^{jet}") leg1->Draw("same"); c1->cd(ivar+5); hFrame1->GetXaxis()->SetTitle(Form("%s",varname.Data())); hFrame1->GetYaxis()->SetRangeUser(ratiomin,ratiomax); hFrame1->GetYaxis()->SetLabelSize(0); hFrame1->GetXaxis()->CenterTitle(); hFrame1->GetXaxis()->CenterTitle(); TLine *l2 =new TLine(xrange_var_pre[0],1,xrange_var_pre[1],1); l2->SetLineStyle(2); l2->SetLineColor(1); TH1D* ratio_DatavsMC_var=(TH1D*)re_hdata_var->Clone("ratio_DatavsMC_var"); ratio_DatavsMC_var->Divide(re_hMC_var); // hFrame1->GetYaxis()->SetTitle(""); if(varname=="#eta_{lab}^{jet}") hFrame1->DrawCopy(); else{ hFrame1->DrawCopy("Y+"); } ratio_DatavsMC_var->SetMarkerStyle(20); ratio_DatavsMC_var->SetMarkerSize(1); ratio_DatavsMC_var->SetMarkerColor(1); ratio_DatavsMC_var->SetLineColor(1); ratio_DatavsMC_var->DrawCopy("E1same"); l2->Draw("same"); } if(Save){ c1->Print(Form("Data%sComp.png",coll.Data())); c1->Print(Form("Data%sComp.pdf",coll.Data())); } }
fitJPsiMassUnbinned(const char *filename = "JPsiMassOS_186nb.txt", const char* plotOpt = "NEU", const int nbins = 50, const char* filenameB = "JPsiMassSS_186nb.txt") { gROOT->ProcessLine(".L tdrstyle.C"); setTDRStyle(); gStyle->SetPadRightMargin(0.05); RooRealVar mass("mass","M^{#mu#mu}", 2.6, 3.5,"GeV/c^{2}"); // Read data set RooDataSet *data = RooDataSet::read(filename,RooArgSet(mass)); RooDataSet *dataB = RooDataSet::read(filenameB,RooArgSet(mass)); // Build p.d.f. //////////////////////////////////////////////// // Parameters // //////////////////////////////////////////////// // Signal p.d.f. parameters // Parameters for a Gaussian and a Crystal Ball Lineshape RooRealVar m0 ("m_{0}", "Bias", 3.1, 2.9, 3.3,"GeV/c^{2}"); RooRealVar sigma("#sigma","Width", 0.04,0.01,0.1,"GeV/c^{2}"); RooRealVar cut ("#alpha","Cut", 0.6,0.6,2.0); RooRealVar power("power","Power", 10.0, 0.5, 20.0); // Background p.d.f. parameters // Parameters for a polynomial lineshape RooRealVar c0("c_{0}", "c0", 0., -10, 10); RooRealVar c1("c_{1}", "c1", 0., -100, 0); RooRealVar c2("c_{2}", "c2", 0., -100, 100); // c0.setConstant(); // fraction of signal // RooRealVar frac("frac", "Signal Fraction", 0.1,0.,0.3.); RooRealVar nsig("N_{S}", "#signal events", 9000, 0.,10000.); RooRealVar nbkg("N_{B}", "#background events", 1000,2,10000.); //////////////////////////////////////////////// // P.D.F.s // //////////////////////////////////////////////// // Di-photon mass signal p.d.f. RooGaussian signal("signal", "A Gaussian Lineshape", mass, m0, sigma); // RooCBShape signal("signal", "A Crystal Ball Lineshape", mass, m0,sigma, cut, power); // Di-photon mass background p.d.f. RooPolynomial bg("bg", "Backgroung Distribution", mass, RooArgList(c0,c1)); // Di-photon mass model p.d.f. // RooAddPdf model("model", "Di-photon mass model", signal, bg, frac); RooAddPdf model("model", "Di-photon mass model", RooArgList(signal, bg), RooArgList(nsig, nbkg)); TStopwatch t ; t.Start() ; model->fitTo(*data,FitOptions("mh"),Optimize(0),Timer(1)); t.Print() ; c = new TCanvas("c","J/psi->mu mu Distributions", 0,0,800,600); // Plot the fit results RooPlot* plot = mass.frame(Range(2.6,3.5),Bins(nbins)); // Plot 1 dataB->plotOn(plot, MarkerColor(kRed)); data->plotOn(plot); model.plotOn(plot); //model.paramOn(plot, Format(plotOpt, AutoPrecision(1)), Parameters(RooArgSet(nsig, nbkg, m0, sigma))); model.paramOn(plot, Format(plotOpt, AutoPrecision(1)), Parameters(RooArgSet(m0, sigma))); /// model.plotOn(plot, Components("signal"), LineStyle(kDashed), LineColor(kRed)); model.plotOn(plot, Components("bg"), LineStyle(kDashed), LineColor(kRed)); plot->Draw(); TLatex * tex = new TLatex(0.2,0.8,"CMS preliminary"); tex->SetTextFont(42); tex->SetNDC(); tex->SetLineWidth(2); tex->Draw(); tex->DrawLatex(0.2, 0.725, "#sqrt{s} = 7 TeV"); tex->DrawLatex(0.2, 0.650, "L = 186 nb^{-1}"); float fsig_peak = NormalizedIntegral(signal, mass, m0.getVal() - 2.5*sigma.getVal(), m0.getVal() + 2.5*sigma.getVal() ); float fbkg_peak = NormalizedIntegral(bg, mass, m0.getVal() - 2.5*sigma.getVal(), m0.getVal() + 2.5*sigma.getVal() ); double nsigVal = fsig_peak * nsig.getVal(); double nsigErr = fsig_peak * nsig.getError(); double nsigErrRel = nsigErr / nsigVal; double nbkgVal = fbkg_peak * nbkg.getVal(); double nbkgErr = fbkg_peak * nbkg.getError(); double nbkgErrRel = nbkgErr / nbkgVal; cout << "nsig " << nsigVal << " +/- " << nsigErr << endl; cout << "S/B_{#pm2.5#sigma} " << nsigVal/nbkgVal << " +/- " << (nsigVal/nbkgVal)*sqrt(nsigErrRel*nsigErrRel + nbkgErrRel*nbkgErrRel) << endl; tex->DrawLatex(0.2, 0.5, Form("N_{S} = %.0f#pm%.0f", nsigVal, nsigErr) ); tex->DrawLatex(0.2, 0.425, Form("S/B_{#pm2.5#sigma} = %.1f", nsigVal/nbkgVal) ); leg = new TLegend(0.65,0.6,0.9,0.75); leg->SetFillColor(kWhite); leg->SetLineColor(kWhite); leg->SetShadowColor(kWhite); leg->SetTextFont(42); TLegendEntry * ldata = leg->AddEntry(data, "Opposite Sign"); TLegendEntry * ldataB = leg->AddEntry(dataB, "Same Sign"); ldata->SetMarkerStyle(20); ldataB->SetMarkerStyle(20); ldataB->SetMarkerColor(kRed); leg->Draw(); }
void compareRegressionHiggsMasses ( string filenameNoRegression, string filenameRegressionV0, string filenameRegressionV1, string filenameRegressionV2, string label, Int_t channel ) { gStyle->SetOptStat(0); TFile *fileNoRegression = new TFile(filenameNoRegression.c_str(), "READ"); TFile *fileRegressionV0 = new TFile(filenameRegressionV0.c_str(), "READ"); TFile *fileRegressionV1 = new TFile(filenameRegressionV1.c_str(), "READ"); TFile *fileRegressionV2 = new TFile(filenameRegressionV2.c_str(), "READ"); TTree *treeNoRegression = (TTree*)fileNoRegression->Get("zz4lTree/probe_tree"); TTree *treeRegressionV0 = (TTree*)fileRegressionV0->Get("zz4lTree/probe_tree"); TTree *treeRegressionV1 = (TTree*)fileRegressionV1->Get("zz4lTree/probe_tree"); TTree *treeRegressionV2 = (TTree*)fileRegressionV2->Get("zz4lTree/probe_tree"); assert(treeNoRegression); assert(treeRegressionV0); assert(treeRegressionV1); assert(treeRegressionV2); TH1F *massNoRegression = new TH1F( "massNoRegression", ";m_{4l} [GeV/c^{2}]; Fraction of Events", 160, 100, 150); TH1F *massRegressionV0 = new TH1F( "massRegressionV0", ";m_{4l} [GeV/c^{2}]; Fraction of Events", 160, 100, 150); TH1F *massRegressionV1 = new TH1F( "massRegressionV1", ";m_{4l} [GeV/c^{2}]; Fraction of Events", 160, 100, 150); TH1F *massRegressionV2 = new TH1F( "massRegressionV2", ";m_{4l} [GeV/c^{2}]; Fraction of Events", 160, 100, 150); TH1F *massNoRegression_finebins = new TH1F( "massNoRegression_finebins", ";m_{4l} [GeV/c^{2}]; Fraction of Events", 50000, 0, 200); TH1F *massRegressionV0_finebins = new TH1F( "massRegressionV0_finebins", ";m_{4l} [GeV/c^{2}]; Fraction of Events", 50000, 0, 200); TH1F *massRegressionV1_finebins = new TH1F( "massRegressionV1_finebins", ";m_{4l} [GeV/c^{2}]; Fraction of Events", 50000, 0, 200); TH1F *massRegressionV2_finebins = new TH1F( "massRegressionV2_finebins", ";m_{4l} [GeV/c^{2}]; Fraction of Events", 50000, 0, 200); //******************************************************************************** //Fill Histogram //******************************************************************************** treeNoRegression->Draw("mass>>massNoRegression_finebins", Form("channel==%d",channel)); treeRegressionV0->Draw("mass>>massRegressionV0_finebins", Form("channel==%d",channel)); treeRegressionV1->Draw("mass>>massRegressionV1_finebins", Form("channel==%d",channel)); treeRegressionV2->Draw("mass>>massRegressionV2_finebins", Form("channel==%d",channel)); treeNoRegression->Draw("mass>>massNoRegression", Form("channel==%d",channel)); treeRegressionV0->Draw("mass>>massRegressionV0", Form("channel==%d",channel)); treeRegressionV1->Draw("mass>>massRegressionV1", Form("channel==%d",channel)); treeRegressionV2->Draw("mass>>massRegressionV2", Form("channel==%d",channel)); NormalizeHist(massNoRegression); NormalizeHist(massRegressionV0); NormalizeHist(massRegressionV1); NormalizeHist(massRegressionV2); //******************************************************************************** //Compute Effective Sigma //******************************************************************************** float sigmaeff_std = effSigma(massNoRegression_finebins ); float sigmaeff_regressionV0 = effSigma(massRegressionV0_finebins ); float sigmaeff_regressionV1 = effSigma(massRegressionV1_finebins ); float sigmaeff_regressionV2 = effSigma(massRegressionV2_finebins ); cout << sigmaeff_std << endl; cout << sigmaeff_regressionV0 << endl; cout << sigmaeff_regressionV1 << endl; cout << sigmaeff_regressionV2 << endl; //******************************************************************************** //Plot just the mass spectra in fine bins //******************************************************************************** TCanvas* cv = new TCanvas("c","Unbinned Invariant Mass Fit", 0,0,800,600); gStyle->SetOptTitle(0); massNoRegression->SetLineColor(kBlack); massRegressionV0->SetLineColor(kRed); massRegressionV1->SetLineColor(kGreen+2); massRegressionV2->SetLineColor(kBlue); massNoRegression->GetXaxis()->SetRangeUser(110,140); massRegressionV0->GetXaxis()->SetRangeUser(110,140); massRegressionV1->GetXaxis()->SetRangeUser(110,140); massRegressionV2->GetXaxis()->SetRangeUser(110,140); double max = 1.2 * massRegressionV2->GetMaximum(); massNoRegression->SetMaximum(max); massNoRegression->Draw("hist"); massRegressionV0->Draw("hist,same"); massRegressionV1->Draw("hist,same"); massRegressionV2->Draw("hist,same"); // Print Fit Values TLatex *tex = 0; tex = new TLatex(); tex->SetNDC(); tex->SetTextSize(.04); tex->SetTextFont(2); tex->Draw(); // tex->SetTextSize(0.022); tex->SetTextSize(0.024); tex->SetTextColor(kBlack); tex->DrawLatex(0.245, 0.84, "No Regression"); tex->DrawLatex(0.245, 0.79, Form("#sigma Effective = %.2f GeV/c^{2}", sigmaeff_std)); tex->SetTextSize(0.024); tex->SetTextColor(kRed); tex->DrawLatex(0.245, 0.74, "RegressionV0"); tex->DrawLatex(0.245, 0.69, Form("#sigma Effective = %.2f GeV/c^{2}", sigmaeff_regressionV0)); tex->SetTextSize(0.024); tex->SetTextColor(kGreen+2); tex->DrawLatex(0.245, 0.64, "RegressionV1"); tex->DrawLatex(0.245, 0.59, Form("#sigma Effective = %.2f GeV/c^{2}", sigmaeff_regressionV1)); tex->SetTextSize(0.024); tex->SetTextColor(kBlue); tex->DrawLatex(0.245, 0.54, "RegressionV2"); tex->DrawLatex(0.245, 0.49, Form("#sigma Effective = %.2f GeV/c^{2}", sigmaeff_regressionV2)); cv->SaveAs(Form("HiggsMassHistogram_%s.gif",label.c_str())); }
void DetermineAnchorsPP(const Char_t* inputDir, TString lPeriodName = "LHC18f", Int_t runNo, const Char_t* chunkName = "", Bool_t automaticMode=kFALSE) { // // In automatic mode the function does not request any standard input and creates anchor points if the fit was ok // using the anchor value determined automatically. // One must check the QA plots for individual run to make sure the automatic values are fine and eventually run this // function again in manual mode. // Bool_t lUseDefaultAnchorPercentile = kFALSE; Double_t lDefaultAnchorPercentile = 0.10; Double_t lMinimumAnchorPercentile = 0.05; // open minimum bias OADB file TString lOADBfile = Form("OADB-%s-MB.root", lPeriodName.Data()); cout << "Opening minimum bias info ... " << endl; TFile *foadb = new TFile( lOADBfile.Data(), "READ" ); AliOADBContainer *lOADBcontainer = (AliOADBContainer*)foadb->Get("MultSel"); // set percentile boundaries for the estimator histos // (based on what is implemented in the calibration) Double_t lDesiredBoundaries[1000]; Long_t lNDesiredBoundaries=0; lDesiredBoundaries[0] = 0.0; //From High To Low Multiplicity for( Int_t ib = 1; ib < 101; ib++) { // 100 bins ] 0.0 , 0.1 ] lNDesiredBoundaries++; lDesiredBoundaries[lNDesiredBoundaries] = lDesiredBoundaries[lNDesiredBoundaries-1] + 0.01; } for( Int_t ib = 1; ib < 91; ib++) { // 90 bins ] 1.0 , 10. ] lNDesiredBoundaries++; lDesiredBoundaries[lNDesiredBoundaries] = lDesiredBoundaries[lNDesiredBoundaries-1] + 0.1; } for( Int_t ib = 1; ib < 91; ib++) { // 90 bins ] 10.0 , 100.0 ] lNDesiredBoundaries++; lDesiredBoundaries[lNDesiredBoundaries] = lDesiredBoundaries[lNDesiredBoundaries-1] + 1.0; } FILE *fap = 0x0; // auxiliary objects TLegend *legEstimator = 0x0; // TLine *anchorLine = new TLine(); anchorLine->SetLineStyle(2); // TLatex *latex = new TLatex(); latex->SetTextFont(42); latex->SetTextSize(0.025); // constant function for the scaling factor determination TF1 *fpol0 = new TF1("fpol0", "[0]", 0.005, lMinimumAnchorPercentile); fpol0->SetLineStyle(3); fpol0->SetLineWidth(1); fpol0->SetLineColor(kBlack); TF1 *fpol0_hi = (TF1*)fpol0->Clone("fpol0_hi"); TF1 *fpol0_lo = (TF1*)fpol0->Clone("fpol0_lo"); // Int_t npar = 3; TF1 *fturnon = new TF1("fturnon", func_turnon, 0., 1., npar); fturnon->SetParameters(1., 0.1, -1.); fturnon->SetParLimits(1, lMinimumAnchorPercentile, 1.0); fturnon->SetParLimits(2, -1.e15, 0.); fturnon->SetLineColor(1); // open input AnalysisResults.root file for the VHM sample TString fileIdentifier = Form("%d", runNo); if(chunkName[0]!='\0') fileIdentifier = chunkName; TFile *fin = TFile::Open(Form("%s/AnalysisResults_%s.root", inputDir, fileIdentifier.Data()), "READ"); TTree *treeEvent = (TTree*)fin->Get("MultSelection/fTreeEvent"); cout << " - run number....................: " << runNo << endl; // define estimator histo for this run TH1D* hEstimator = new TH1D(Form("hEstimator_%d", runNo), "", lNDesiredBoundaries, lDesiredBoundaries); hEstimator->Sumw2(); hEstimator->GetXaxis()->SetTitle("V0M Percentile"); hEstimator->GetYaxis()->SetTitle("Counts"); hEstimator->SetStats(0); hEstimator->SetLineColor(kRed); // get corresponding calibration histogram from OADB AliOADBMultSelection* lOADB = (AliOADBMultSelection*)lOADBcontainer->GetObject( runNo, "Default" ); if( (Int_t)lOADBcontainer->GetIndexForRun( runNo )<0 ) { cout << " ---> Warning: no calibration histo found for this run - skipping..." << endl; return; } // set the pointer to the calib histo for this run hCalib = (TH1D*)lOADB->GetCalibHisto( "hCalib_V0M" );; // Double_t nall = treeEvent->Draw(Form("get_percentile(fAmplitude_V0A+fAmplitude_V0C)>>hEstimator_%d", runNo), Form("fRunNumber==%d && fEvSel_Triggered && fEvSel_IsNotPileupInMultBins && fEvSel_PassesTrackletVsCluster && fEvSel_INELgtZERO && fEvSel_HasNoInconsistentVertices && TMath::Abs(fEvSel_VtxZ)<=10.0 && isSelectedHM(fEvSel_TriggerMask)", runNo), "goff"); hEstimator->Scale(1., "width"); Double_t nevents = (Double_t)hEstimator->GetEntries(); cout << " - number of events (selected)...: " << nevents << endl; // draw histogram TCanvas *cEstimator = new TCanvas(Form("cEstimator_%d", runNo), "Estimator Distribution", 10, 10, 1000, 750); cEstimator->SetRightMargin(0.05); cEstimator->SetTopMargin(0.11); hEstimator->GetXaxis()->SetRangeUser(0., 0.2); hEstimator->Draw("hist e0"); latex->SetNDC(); latex->SetTextSize(0.06); latex->DrawLatex(0.1, 0.93, Form("Run: %d", runNo)); // first, fit a pol0 in the flat region (usually up to 0.05) hEstimator->Fit(fpol0, "RQ0"); Double_t flat_top = fpol0->GetParameter(0); // get standard deviantion of bin contents in the flat region Double_t flat_top_stdev = 0.; for(Int_t ibin=1; ibin<=hEstimator->FindBin(lMinimumAnchorPercentile); ++ibin) { Double_t content = hEstimator->GetBinContent(ibin); Double_t width = hEstimator->GetBinWidth(ibin); flat_top_stdev += TMath::Power((content-flat_top), 2.)*width; } flat_top_stdev = TMath::Sqrt(flat_top_stdev/lMinimumAnchorPercentile) / 2.; fpol0_hi->SetParameter(0, flat_top+flat_top_stdev); fpol0_lo->SetParameter(0, flat_top-flat_top_stdev); // now, fix the constant parameter in the turnon function fturnon->SetParameters(1., 0.1, -1.); fturnon->FixParameter(0, flat_top); // get the maximum range to perform the fit Double_t range_max = (hEstimator->GetBinLowEdge(hEstimator->FindLastBinAbove())) / 1.8; fturnon->SetRange(0.005, (range_max>0.1) ? range_max : 0.1); // get anchor percentile Double_t anchor_percentile = -1.; TString fitstatus = ""; if(nevents>0) { TFitResultPtr fitr = hEstimator->Fit(fturnon, "RQM"); fturnon->Draw("lsame"); fitstatus = gMinuit->fCstatu; } cEstimator->Flush(); cEstimator->Update(); cout << " - fit status....................: " << fitstatus << endl; if( !fitstatus.Contains("OK") ) { if(gROOT->IsBatch()) { cout << " ---> Warning: fit failed! -- skipping this run..." << endl; if(!automaticMode) { fap = fopen(Form("temp/anchors/Anchor_%s_%d_VHM.txt", lPeriodName.Data(), runNo), "w"); fprintf(fap, "%d %d %.2lf %lf\n", runNo, runNo, -1., -1.); } return; } if(!automaticMode) { cout << " - Please, provide an anchor percentile to continue: " << endl; cout << " (entering a negative value will skip this run)" << endl; cout << " >>>> anchor percentile: "; cin >> anchor_percentile; if(anchor_percentile<0.) { cout << " ---> Warning: percentile provided is negative -- skipping this run..." << endl; fap = fopen(Form("temp/anchors/Anchor_%s_%d_VHM.txt", lPeriodName.Data(), runNo), "w"); fprintf(fap, "%d %d %.2lf %lf\n", runNo, runNo, -1., -1.); return; } } else return; // in automatic mode we do not create an anchor file
void annotation3d() { TCanvas *c = new TCanvas("c", "c", 600, 600); c->SetTheta(30); c->SetPhi(50); gStyle->SetOptStat(0); gStyle->SetHistTopMargin(0); gStyle->SetOptTitle(kFALSE); // Define and draw a surface TF2 *f = new TF2("f", "[0]*cos(x)*cos(y)", -1, 1, -1, 1); f->SetParameter(0, 1); double s = 1./f->Integral(-1, 1, -1, 1); f->SetParameter(0, s); f->SetNpx(50); f->SetNpy(50); f->GetXaxis()->SetTitle("x"); f->GetXaxis()->SetTitleOffset(1.4); f->GetXaxis()->SetTitleSize(0.04); f->GetXaxis()->CenterTitle(); f->GetXaxis()->SetNdivisions(505); f->GetXaxis()->SetTitleOffset(1.3); f->GetXaxis()->SetLabelSize(0.03); f->GetXaxis()->ChangeLabel(2,-1,-1,-1,kRed,-1,"X_{0}"); f->GetYaxis()->SetTitle("y"); f->GetYaxis()->CenterTitle(); f->GetYaxis()->SetTitleOffset(1.4); f->GetYaxis()->SetTitleSize(0.04); f->GetYaxis()->SetTitleOffset(1.3); f->GetYaxis()->SetNdivisions(505); f->GetYaxis()->SetLabelSize(0.03); f->GetZaxis()->SetTitle("dP/dx"); f->GetZaxis()->CenterTitle(); f->GetZaxis()->SetTitleOffset(1.3); f->GetZaxis()->SetNdivisions(505); f->GetZaxis()->SetTitleSize(0.04); f->GetZaxis()->SetLabelSize(0.03); f->SetLineWidth(1); f->SetLineColorAlpha(kAzure-2, 0.3); f->Draw("surf1 fb"); // Lines for 3D annotation double x[11] = {-0.500, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.500}; double y[11] = {-0.985, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 0.985}; double z[11]; for (int i = 0; i < 11; ++i) z[i] = s*cos(x[i])*cos(y[i]); TPolyLine3D *g2 = new TPolyLine3D(11, x, y, z); double xx[2] = {-0.5, -0.5}; double yy[2] = {-0.985, -0.985}; double zz[2] = {0.11, s*cos(-0.5)*cos(-0.985)}; TPolyLine3D *l2 = new TPolyLine3D(2, xx, yy, zz); g2->SetLineColor(kRed); g2->SetLineWidth(3); g2->Draw(); l2->SetLineColor(kRed); l2->SetLineStyle(2); l2->SetLineWidth(1); l2->Draw(); // Draw text Annotations TLatex *txt = new TLatex(0.05, 0, "f(y,x_{0})"); txt->SetTextFont(42); txt->SetTextColor(kRed); txt->Draw(); TLatex *txt1 = new TLatex(0.12, 0.52, "f(x,y)"); txt1->SetTextColor(kBlue); txt1->SetTextFont(42); txt1->Draw(); }