This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| limits:brazilianplotexample [2016/09/22 22:13] – iwn | limits:brazilianplotexample [2017/09/18 15:19] (current) – iwn | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | {{ limits: | ||
| + | |||
| + | To be used with [[plots: | ||
| + | |||
| <file python BrazilianPlots.py> | <file python BrazilianPlots.py> | ||
| Line 32: | Line 36: | ||
| " | " | ||
| #" | #" | ||
| - | " | + | " |
| #" | #" | ||
| ] | ] | ||
| Line 80: | Line 84: | ||
| # PLOT upper limits | # PLOT upper limits | ||
| def plotUpperLimits(labels, | def plotUpperLimits(labels, | ||
| - | # see CMA plot guidelines: https:// | + | # see CMS plot guidelines: https:// |
| | | ||
| N = len(labels) | N = len(labels) | ||
| Line 102: | Line 106: | ||
| T = 0.08*H | T = 0.08*H | ||
| B = 0.12*H | B = 0.12*H | ||
| - | L = 0.12*W*scaleleftmargin | + | L = 0.12*W |
| - | R = 0.04*W*scalerightmargin | + | R = 0.04*W |
| c = TCanvas(" | c = TCanvas(" | ||
| c.SetFillColor(0) | c.SetFillColor(0) | ||
| Line 200: | Line 204: | ||
| main() | main() | ||
| | | ||
| - | </ | ||
| - | |||
| - | |||
| - | |||
| - | <file python CMS_lumi.py> | ||
| - | import ROOT as rt | ||
| - | |||
| - | # CMS_lumi | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | |||
| - | cmsText | ||
| - | cmsTextFont | ||
| - | |||
| - | writeExtraText = True | ||
| - | extraText | ||
| - | extraTextFont = 52 | ||
| - | |||
| - | lumiTextSize | ||
| - | lumiTextOffset | ||
| - | |||
| - | cmsTextSize | ||
| - | cmsTextOffset | ||
| - | |||
| - | relPosX | ||
| - | relPosY | ||
| - | relExtraDY = 1.2 | ||
| - | |||
| - | extraOverCmsTextSize | ||
| - | |||
| - | lumi_13TeV = "40.2 fb^{-1}" | ||
| - | lumi_8TeV | ||
| - | lumi_7TeV | ||
| - | lumi_sqrtS = "" | ||
| - | |||
| - | drawLogo | ||
| - | |||
| - | def CMS_lumi(pad, | ||
| - | outOfFrame | ||
| - | if(iPosX/ | ||
| - | |||
| - | alignY_=3 | ||
| - | alignX_=2 | ||
| - | if( iPosX/10==0 ): alignX_=1 | ||
| - | if( iPosX==0 | ||
| - | if( iPosX/10==1 ): alignX_=1 | ||
| - | if( iPosX/10==2 ): alignX_=2 | ||
| - | if( iPosX/10==3 ): alignX_=3 | ||
| - | align_ = 10*alignX_ + alignY_ | ||
| - | |||
| - | H = pad.GetWh() | ||
| - | W = pad.GetWw() | ||
| - | l = pad.GetLeftMargin() | ||
| - | t = pad.GetTopMargin() | ||
| - | r = pad.GetRightMargin() | ||
| - | b = pad.GetBottomMargin() | ||
| - | e = 0.025 | ||
| - | |||
| - | pad.cd() | ||
| - | |||
| - | lumiText = "" | ||
| - | if( iPeriod==1 ): | ||
| - | lumiText += lumi_7TeV | ||
| - | lumiText += " (7 TeV)" | ||
| - | elif ( iPeriod==2 ): | ||
| - | lumiText += lumi_8TeV | ||
| - | lumiText += " (8 TeV)" | ||
| - | |||
| - | elif( iPeriod==3 ): | ||
| - | lumiText = lumi_8TeV | ||
| - | lumiText += " (8 TeV)" | ||
| - | lumiText += " + " | ||
| - | lumiText += lumi_7TeV | ||
| - | lumiText += " (7 TeV)" | ||
| - | elif ( iPeriod==4 ): | ||
| - | lumiText += lumi_13TeV | ||
| - | lumiText += " (13 TeV)" | ||
| - | elif ( iPeriod==7 ): | ||
| - | if( outOfFrame ):lumiText += "# | ||
| - | lumiText += lumi_13TeV | ||
| - | lumiText += " (13 TeV)" | ||
| - | lumiText += " + " | ||
| - | lumiText += lumi_8TeV | ||
| - | lumiText += " (8 TeV)" | ||
| - | lumiText += " + " | ||
| - | lumiText += lumi_7TeV | ||
| - | lumiText += " (7 TeV)" | ||
| - | if( outOfFrame): | ||
| - | elif ( iPeriod==12 ): | ||
| - | lumiText += "8 TeV" | ||
| - | elif ( iPeriod==0 ): | ||
| - | lumiText += lumi_sqrtS | ||
| - | | ||
| - | print lumiText | ||
| - | |||
| - | latex = rt.TLatex() | ||
| - | latex.SetNDC() | ||
| - | latex.SetTextAngle(0) | ||
| - | latex.SetTextColor(rt.kBlack) | ||
| - | | ||
| - | extraTextSize = extraOverCmsTextSize*cmsTextSize | ||
| - | | ||
| - | latex.SetTextFont(42) | ||
| - | latex.SetTextAlign(31) | ||
| - | latex.SetTextSize(lumiTextSize*t) | ||
| - | |||
| - | latex.DrawLatex(1-r, | ||
| - | |||
| - | if( outOfFrame ): | ||
| - | latex.SetTextFont(cmsTextFont) | ||
| - | latex.SetTextAlign(11) | ||
| - | latex.SetTextSize(cmsTextSize*t) | ||
| - | latex.DrawLatex(l, | ||
| - | | ||
| - | pad.cd() | ||
| - | |||
| - | posX_ = 0 | ||
| - | if( iPosX%10< | ||
| - | posX_ = l + relPosX*(1-l-r) | ||
| - | elif( iPosX%10==2 ): | ||
| - | posX_ = l + 0.5*(1-l-r) | ||
| - | elif( iPosX%10==3 ): | ||
| - | posX_ = 1-r - relPosX*(1-l-r) | ||
| - | |||
| - | posY_ = 1-t - relPosY*(1-t-b) | ||
| - | |||
| - | if( not outOfFrame ): | ||
| - | if( drawLogo ): | ||
| - | posX_ = l + 0.045*(1-l-r)*W/ | ||
| - | posY_ = 1-t - 0.045*(1-t-b) | ||
| - | xl_0 = posX_ | ||
| - | yl_0 = posY_ - 0.15 | ||
| - | xl_1 = posX_ + 0.15*H/W | ||
| - | yl_1 = posY_ | ||
| - | CMS_logo = rt.TASImage(" | ||
| - | pad_logo = rt.TPad(" | ||
| - | pad_logo.Draw() | ||
| - | pad_logo.cd() | ||
| - | CMS_logo.Draw(" | ||
| - | pad_logo.Modified() | ||
| - | pad.cd() | ||
| - | else: | ||
| - | latex.SetTextFont(cmsTextFont) | ||
| - | latex.SetTextSize(cmsTextSize*t) | ||
| - | latex.SetTextAlign(align_) | ||
| - | latex.DrawLatex(posX_, | ||
| - | if( writeExtraText ) : | ||
| - | latex.SetTextFont(extraTextFont) | ||
| - | latex.SetTextAlign(align_) | ||
| - | latex.SetTextSize(extraTextSize*t) | ||
| - | latex.DrawLatex(posX_, | ||
| - | elif( writeExtraText ): | ||
| - | if( iPosX==0): | ||
| - | posX_ = l + relPosX*(1-l-r) | ||
| - | posY_ = | ||
| - | |||
| - | latex.SetTextFont(extraTextFont) | ||
| - | latex.SetTextSize(extraTextSize*t) | ||
| - | latex.SetTextAlign(align_) | ||
| - | latex.DrawLatex(posX_, | ||
| - | |||
| - | pad.Update() | ||
| </ | </ | ||