Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:34:13

0001 #include "CMS_lumi_v2.h"
0002 
0003 void 
0004 CMS_lumi_v2( TPad* pad, int iPeriod, int iPosX )
0005 {            
0006   bool outOfFrame    = false;
0007   if( iPosX/10==0 ) 
0008     {
0009       outOfFrame = true;
0010     }
0011   int alignY_=3;
0012   int alignX_=2;
0013   if( iPosX/10==0 ) alignX_=1;
0014   if( iPosX==0    ) alignY_=1;
0015   if( iPosX/10==1 ) alignX_=1;
0016   if( iPosX/10==2 ) alignX_=2;
0017   if( iPosX/10==3 ) alignX_=3;
0018   int align_ = 10*alignX_ + alignY_;
0019 
0020   float H = pad->GetWh();
0021   float W = pad->GetWw();
0022   float l = pad->GetLeftMargin();
0023   float t = pad->GetTopMargin();
0024   float r = pad->GetRightMargin();
0025   float b = pad->GetBottomMargin();
0026   float e = 0.025;
0027 
0028   pad->cd();
0029 
0030   TString lumiText;
0031   if( iPeriod==1 )
0032     {
0033       lumiText += lumi_7TeV;
0034       lumiText += " (7 TeV)";
0035     }
0036   else if ( iPeriod==2 )
0037     {
0038       lumiText += lumi_8TeV;
0039       lumiText += " (8 TeV)";
0040     }
0041   else if( iPeriod==3 ) 
0042     {
0043       lumiText = lumi_8TeV; 
0044       lumiText += " (8 TeV)";
0045       lumiText += " + ";
0046       lumiText += lumi_7TeV;
0047       lumiText += " (7 TeV)";
0048     }
0049   else if ( iPeriod==4 )
0050     {
0051       lumiText += lumi_13TeV;
0052       lumiText += " 13 TeV";
0053     }
0054   else if ( iPeriod==7 )
0055     { 
0056       if( outOfFrame ) lumiText += "#scale[0.85]{";
0057       lumiText += lumi_13TeV; 
0058       lumiText += " (13 TeV)";
0059       lumiText += " + ";
0060       lumiText += lumi_8TeV; 
0061       lumiText += " (8 TeV)";
0062       lumiText += " + ";
0063       lumiText += lumi_7TeV;
0064       lumiText += " (7 TeV)";
0065       if( outOfFrame) lumiText += "}";
0066     }
0067   else if ( iPeriod==12 )
0068     {
0069       lumiText += "8 TeV";
0070     }
0071   else if ( iPeriod==14 )
0072     {
0073       /*
0074       lumiText += "14 TeV, ";  
0075       lumiText += lumi_14TeV;
0076       */
0077       lumiText += "14 TeV";
0078     }
0079  
0080   //cout << lumiText << endl;
0081 
0082   TLatex latex;
0083   latex.SetNDC();
0084   latex.SetTextAngle(0);
0085   latex.SetTextColor(kBlack);    
0086 
0087   float extraTextSize = extraOverCmsTextSize*cmsTextSize;
0088 
0089   latex.SetTextFont(42);
0090   latex.SetTextAlign(31); 
0091   latex.SetTextSize(lumiTextSize*t);    
0092   latex.DrawLatex(1-r,1-t+lumiTextOffset*t,lumiText);
0093 
0094   if( outOfFrame )
0095     {
0096       latex.SetTextFont(cmsTextFont);
0097       latex.SetTextAlign(11); 
0098       latex.SetTextSize(cmsTextSize*t);    
0099       latex.DrawLatex(l,1-t+lumiTextOffset*t,cmsText);
0100     }
0101   
0102   pad->cd();
0103 
0104   float posX_;
0105   if( iPosX%10<=1 )
0106     {
0107       posX_ =   l + relPosX*(1-l-r);
0108     }
0109   else if( iPosX%10==2 )
0110     {
0111       posX_ =  l + 0.5*(1-l-r);
0112     }
0113   else if( iPosX%10==3 )
0114     {
0115       posX_ =  1-r - relPosX*(1-l-r);
0116     }
0117   float posY_ = 1-t - relPosY*(1-t-b);
0118   if( !outOfFrame )
0119     {
0120       if( drawLogo )
0121     {
0122       posX_ =   l + 0.045*(1-l-r)*W/H;
0123       posY_ = 1-t - 0.045*(1-t-b);
0124       float xl_0 = posX_;
0125       float yl_0 = posY_ - 0.15;
0126       float xl_1 = posX_ + 0.15*H/W;
0127       float yl_1 = posY_;
0128       TASImage* CMS_logo = new TASImage("CMS-BW-label.png");
0129       TPad* pad_logo = new TPad("logo","logo", xl_0, yl_0, xl_1, yl_1 );
0130       pad_logo->Draw();
0131       pad_logo->cd();
0132       CMS_logo->Draw("X");
0133       pad_logo->Modified();
0134       pad->cd();
0135     }
0136       else
0137     {
0138       latex.SetTextFont(cmsTextFont);
0139       latex.SetTextSize(cmsTextSize*t);
0140       latex.SetTextAlign(align_);
0141       latex.DrawLatex(posX_, posY_, cmsText);
0142       if( writeExtraText ) 
0143         {
0144           latex.SetTextFont(extraTextFont);
0145           latex.SetTextAlign(align_);
0146           latex.SetTextSize(extraTextSize*t);
0147           latex.DrawLatex(posX_, posY_- relExtraDY*cmsTextSize*t, extraText);
0148         }
0149     }
0150     }
0151   else if( writeExtraText )
0152     {
0153       if( iPosX==0) 
0154     {
0155       //posX_ =   l +  relPosX*(1-l-r);
0156       posX_ =   l +  relPosX*(1-l-r) + 0.1;
0157       posY_ =   1-t+lumiTextOffset*t;
0158     }
0159       latex.SetTextFont(extraTextFont);
0160       latex.SetTextSize(extraTextSize*t);
0161       latex.SetTextAlign(align_);
0162       latex.DrawLatex(posX_, posY_, extraText);      
0163     }
0164   return;
0165 }
0166