Example #1
0
void hggPaperStyle()
{

    // Hgg Paper style for plots
    TStyle *hggStyle = new TStyle("hggStyle","Hgg Paper Style");

    //hggStyle->SetCanvasColor(0);
    //hggStyle->SetPadColor(0);
    hggStyle->SetPadTickX(0);
    hggStyle->SetPadTickY(0);

    hggStyle->SetFrameFillColor(0);
    hggStyle->SetStatColor(0);
    hggStyle->SetOptStat(0);
    hggStyle->SetTitleFillColor(0);
    hggStyle->SetCanvasBorderMode(0);
    hggStyle->SetPadBorderMode(0);
    hggStyle->SetFrameBorderMode(0);
    hggStyle->SetFrameBorderSize(1);
    hggStyle->SetPadColor(kWhite);
    hggStyle->SetCanvasColor(kWhite);

    hggStyle->SetCanvasDefH(600); //Height of canvas
    hggStyle->SetCanvasDefW(800); //Width of canvas
    hggStyle->SetCanvasDefX(0);   //POsition on screen
    hggStyle->SetCanvasDefY(0);

    hggStyle->SetPadLeftMargin(0.16);//0.16);
    hggStyle->SetPadRightMargin(0.1);//0.02);
    hggStyle->SetPadTopMargin(0.085);//0.02);
    hggStyle->SetPadBottomMargin(0.12);//0.02);

    // For hgg axis titles:
    hggStyle->SetTitleColor(1, "XYZ");
    hggStyle->SetTitleFont(42, "XYZ");
    hggStyle->SetTitleSize(0.05, "XYZ");
    hggStyle->SetTitleYOffset(1.5); // => 1.15 if exponents
    hggStyle->SetTitleXOffset(1.);//0.9);

    // For hgg axis labels:
    hggStyle->SetLabelColor(1, "XYZ");
    hggStyle->SetLabelFont(42, "XYZ");
    hggStyle->SetLabelOffset(0.007, "XYZ");
    hggStyle->SetLabelSize(0.045, "XYZ");

    // Legends
    hggStyle->SetLegendBorderSize(0);
    hggStyle->SetLegendFillColor(kWhite);
    hggStyle->SetLegendFont(42);

    hggStyle->SetFillColor(10);
    // Nothing for now
    hggStyle->SetTextFont(42);
    hggStyle->SetTextSize(0.03);

    hggStyle->SetOptTitle(0);
    hggStyle->SetOptStat(0);
    hggStyle->cd();
}
int main(int argc, const char* argv[])
{
  if(argc < 4)
    {
      usage(argv[0]);
      return -1;
    }
  int mode = 0;
  string modestr(argv[3]);
  if(modestr=='2')
    mode=2;
  else if(modestr=='1')
    mode=1;
  else
    mode=0;
  SetAtlasStyle();
  TStyle* style = gROOT->GetStyle("ATLAS");


  style->SetOptTitle(1);

  // Margins:
  style->SetPadTopMargin(0.15);
  style->SetPadBottomMargin(0.13);
  style->SetPadLeftMargin(0.13);
  style->SetPadRightMargin(0.35);

  style->SetCanvasDefH(500);
  style->SetCanvasDefW(800);
  
  style->SetTitleFont(42);
  style->SetTitleColor(1);
  style->SetTitleTextColor(1);
  style->SetTitleFillColor(10);
  style->SetTitleFontSize(0.06);
  style->SetTitleBorderSize(0);

  style->SetOptStat("emrou");
  style->SetStatColor(kWhite);
  style->SetStatFont(42);
  style->SetStatFontSize(0.03);
  style->SetStatTextColor(1);
  style->SetStatFormat("6.4g");
  style->SetStatBorderSize(0);
  style->SetStatX(1.0);
  style->SetStatY(0.95);//0.85
  style->SetStatH(0.1);
  style->SetStatW(0.2);
  
  

  HistoMaker(argv[1],argv[2],mode);
  return 0;
}
Example #3
0
// TStyle used for HPlus Studies and AnalysisPack.
//********************************************************************//
void HPlusStyle(void) {

    TStyle *HplusStyle = new TStyle("HplusStyle", "HplusStyle");
    HplusStyle->SetCanvasBorderMode(0);
    HplusStyle->SetCanvasColor(kWhite);
    HplusStyle->SetPadBorderMode(0);
    HplusStyle->SetPadColor(kWhite);
    HplusStyle->SetTitleFillColor(kWhite);
    HplusStyle->SetGridColor(0);
    HplusStyle->SetFrameBorderMode(0);
    HplusStyle->SetFrameBorderSize(1);
    HplusStyle->SetFrameFillColor(0);
    HplusStyle->SetFrameFillStyle(0);
    HplusStyle->SetFrameLineColor(1);
    HplusStyle->SetFrameLineStyle(1);
    HplusStyle->SetFrameLineWidth(1);
    // HplusStyle->SetFillColor(kWhite);
    HplusStyle->SetOptTitle(0);
    HplusStyle->SetTitleFont(42, "XYZ");
    HplusStyle->SetTitleFontSize(0.05);
    HplusStyle->SetTitleSize(0.06, "XYZ");
    HplusStyle->SetTextFont(42);
    HplusStyle->SetTitleXOffset(0.9);
    HplusStyle->SetTitleYOffset(1.25);

    HplusStyle->SetLabelColor(1, "XYZ");
    HplusStyle->SetLabelFont(42, "XYZ");
    HplusStyle->SetLabelOffset(0.007, "XYZ");
    HplusStyle->SetLabelSize(0.05, "XYZ");
    HplusStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
    HplusStyle->SetPadTickY(1);  // To get tick marks on the opposite side of the frame
    HplusStyle->SetNdivisions(508,"XYZ");

    HplusStyle->SetPadTopMargin(0.05);
    HplusStyle->SetPadBottomMargin(0.12);
    HplusStyle->SetPadLeftMargin(0.16);
    HplusStyle->SetPadRightMargin(0.04);//0.02
    HplusStyle->SetCanvasDefH(1280); //Height of canvas
    HplusStyle->SetCanvasDefW(1024); //Width of canvas
    HplusStyle->SetCanvasDefX(0);   //POsition on screen
    HplusStyle->SetCanvasDefY(0);
    HplusStyle->SetPaintTextFormat("5.2f");
    // HplusStyle->SetPalette(1, 0); // Pretty palette
    HplusStyle->SetOptStat(0);
    /// Statistics Box
    HplusStyle->SetStatX(0.9);
    HplusStyle->SetStatY(0.9);
    // HplusStyle->SetStatW(0.19) // default
    // HplusStyle->SetStatH(0.1)  // default
    HplusStyle->SetStatW(0.15);
    HplusStyle->SetStatH(0.1);
    HplusStyle->cd();
} //eof: void HPlusStyle(void){
Example #4
0
/////////
// the Style Section
/////////
void setHLTStyle() {
  setTDRStyle();
  //  TStyle *hltStyle = new TStyle(*tdrStyle);
  TStyle *hltStyle  = new TStyle("hltStyle","My HLT Styles");
  gStyle->Copy(*hltStyle);

  hltStyle->SetCanvasColor(-1);

  hltStyle->SetCanvasDefH(600);
  hltStyle->SetCanvasDefW(600);
  hltStyle->SetPadColor(-1);  
  hltStyle->SetPadGridX(false);
  hltStyle->SetPadGridY(false);
  hltStyle->SetGridWidth(0.25);
  
  hltStyle->SetFrameFillColor(-1); // Transparent

  hltStyle->SetHistFillColor(-1); // Transparent
  hltStyle->SetHistFillStyle(0);  // None
  hltStyle->SetHistLineWidth(3);

  hltStyle->SetPadTopMargin(0.08);
  hltStyle->SetPadBottomMargin(0.12);
  hltStyle->SetPadLeftMargin(0.15);
  hltStyle->SetPadRightMargin(0.04);

  hltStyle->SetTitleSize(0.05);
  hltStyle->SetTitleFillColor(-1); // Transparent
  hltStyle->SetTitleH(0.05); // Set the height of the title box
  hltStyle->SetTitleW(0.); // Set the width of the title box

  hltStyle->SetTitleSize(0.04, "XYZ");     
  hltStyle->SetTitleOffset(1.2, "X"); // Another way to set the Offset
  hltStyle->SetTitleOffset(1.8, "Y"); // Another way to set the Offset

  hltStyle->SetLabelSize(0.035, "XYZ");

  hltStyle->SetPalette(1,0);
  hltStyle->SetFillColor(0);    // White
  hltStyle->SetFillStyle(4000); // Transparent

  hltStyle->SetStatStyle(0);
  hltStyle->SetTitleStyle(0);
  hltStyle->SetCanvasBorderSize(0);
  hltStyle->SetFrameBorderSize(0);
  hltStyle->SetLegendBorderSize(0);
  hltStyle->SetStatBorderSize(0);
  hltStyle->SetTitleBorderSize(0);

  hltStyle->cd();
}
Example #5
0
void placeholder(TString saveas,Bool_t wide)
{
    TStyle *tdrStyle = setTDRStyle();
    if (wide)
        tdrStyle->SetCanvasDefW(678);
    TText *line1 = new TText(.5,.6,"This is a placeholder so that when there are");
    TText *line2 = new TText(.5,.4,"4 plots per line it lines up nicely");
    line1->SetTextAlign(22);
    line2->SetTextAlign(22);
    TCanvas *c1 = TCanvas::MakeDefCanvas();
    line1->Draw();
    line2->Draw();
    if (saveas != "")
        saveplot(c1,saveas);
}
Example #6
0
// Lauri's Style (LAuri Wendland)
//********************************************************************//
void LAWStyle() {
    TStyle *LAWStyle = new TStyle("LAWStyle", "Neat style");
    LAWStyle->SetCanvasBorderMode(0);
    LAWStyle->SetCanvasColor(kWhite);
    LAWStyle->SetPadBorderMode(0);
    LAWStyle->SetPadColor(kWhite);
    LAWStyle->SetTitleFillColor(kWhite);
    LAWStyle->SetGridColor(0);
    LAWStyle->SetFrameBorderMode(0);
    LAWStyle->SetFrameBorderSize(1);
    LAWStyle->SetFrameFillColor(0);
    LAWStyle->SetFrameFillStyle(0);
    LAWStyle->SetFrameLineColor(1);
    LAWStyle->SetFrameLineStyle(1);
    LAWStyle->SetFrameLineWidth(1);
    LAWStyle->SetFillColor(kWhite);
    LAWStyle->SetFillColor(kWhite);
    LAWStyle->SetOptTitle(0);
    LAWStyle->SetTitleFont(42, "XYZ");
    LAWStyle->SetTitleFontSize(0.05);
    LAWStyle->SetTitleSize(0.06, "XYZ");
    LAWStyle->SetTextFont(42);
    LAWStyle->SetTitleXOffset(0.9);
    LAWStyle->SetTitleYOffset(1.25);

    LAWStyle->SetLabelColor(1, "XYZ");
    LAWStyle->SetLabelFont(42, "XYZ");
    LAWStyle->SetLabelOffset(0.007, "XYZ");
    LAWStyle->SetLabelSize(0.05, "XYZ");
    LAWStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
    LAWStyle->SetPadTickY(1);  // To get tick marks on the opposite side of the frame
    LAWStyle->SetNdivisions(508,"XYZ");

    LAWStyle->SetPadTopMargin(0.05);
    LAWStyle->SetPadBottomMargin(0.12);
    LAWStyle->SetPadLeftMargin(0.16);
    LAWStyle->SetPadRightMargin(0.04);//0.02
    LAWStyle->SetCanvasDefH(600); //Height of canvas
    LAWStyle->SetCanvasDefW(600); //Width of canvas
    LAWStyle->SetCanvasDefX(0);   //POsition on screen
    LAWStyle->SetCanvasDefY(0);
    LAWStyle->SetOptTitle(0);
    LAWStyle->SetOptStat(0);
    LAWStyle->cd();
} //end of: void LAWStyle(){
Example #7
0
void setDefaultStyle()
{
  TStyle *defaultStyle = new TStyle("defaultStyle","Default Style");
  defaultStyle->SetOptStat(0000);
  defaultStyle->SetOptFit(000); 
  defaultStyle->SetPalette(1);
  /////// pad ////////////
  defaultStyle->SetPadBorderMode(1);
  defaultStyle->SetPadBorderSize(1);
  defaultStyle->SetPadColor(0);
  defaultStyle->SetPadTopMargin(0.05);
  defaultStyle->SetPadBottomMargin(0.13);
  defaultStyle->SetPadLeftMargin(0.14);
  defaultStyle->SetPadRightMargin(0.02);
  /////// canvas /////////
  defaultStyle->SetCanvasBorderMode(0);
  defaultStyle->SetCanvasColor(0);
  defaultStyle->SetCanvasDefH(600);
  defaultStyle->SetCanvasDefW(600);
  /////// frame //////////
  defaultStyle->SetFrameBorderMode(0);
  defaultStyle->SetFrameBorderSize(1);
  defaultStyle->SetFrameFillColor(0); 
  defaultStyle->SetFrameLineColor(1);
  /////// label //////////
  defaultStyle->SetLabelOffset(0.005,"XY");
  defaultStyle->SetLabelSize(0.05,"XY");
  defaultStyle->SetLabelFont(42,"XY");
  /////// title //////////
  defaultStyle->SetTitleOffset(1.2,"X");
  defaultStyle->SetTitleSize(0.05,"X");
  defaultStyle->SetTitleOffset(1.4,"Y");
  defaultStyle->SetTitleSize(0.05,"Y");
  defaultStyle->SetTitleFont(42, "XYZ");
  /////// various ////////
  defaultStyle->SetLegendBorderSize(0);
  
  
  defaultStyle->cd();
}
Example #8
0
void setTDRStyle() {
  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");

  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasColor(kWhite);
  tdrStyle->SetCanvasDefH(600);
  tdrStyle->SetCanvasDefW(600);
  tdrStyle->SetCanvasDefX(0);
  tdrStyle->SetCanvasDefY(0);

  tdrStyle->SetPadBorderMode(0);
  tdrStyle->SetPadColor(kWhite);

  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetFrameBorderSize(1);
  tdrStyle->SetFrameFillColor(0);
  tdrStyle->SetFrameFillStyle(0);
  tdrStyle->SetFrameLineColor(1);
  tdrStyle->SetFrameLineStyle(1);
  tdrStyle->SetFrameLineWidth(1);

  tdrStyle->SetHistLineColor(1);
  tdrStyle->SetHistLineStyle(0);
  tdrStyle->SetHistLineWidth(1);

  tdrStyle->SetEndErrorSize(2);
  tdrStyle->SetErrorX(0.);
  
  tdrStyle->SetMarkerStyle(20);
  tdrStyle->SetMarkerSize(2);

  tdrStyle->SetOptFit(1);
  tdrStyle->SetFitFormat("5.4g");
  tdrStyle->SetFuncColor(2);
  tdrStyle->SetFuncStyle(1);
  tdrStyle->SetFuncWidth(1);

  tdrStyle->SetOptDate(0);

  tdrStyle->SetOptFile(0);
  tdrStyle->SetOptStat(0); 
  tdrStyle->SetStatColor(kWhite);
  tdrStyle->SetStatFont(42);
  tdrStyle->SetStatFontSize(0.025);
  tdrStyle->SetStatTextColor(1);
  tdrStyle->SetStatFormat("6.4g");
  tdrStyle->SetStatBorderSize(1);
  tdrStyle->SetStatH(0.1);
  tdrStyle->SetStatW(0.15);

  tdrStyle->SetPadTopMargin(0.05);
  tdrStyle->SetPadBottomMargin(0.13);
  tdrStyle->SetPadLeftMargin(0.10);
  tdrStyle->SetPadRightMargin(0.05);

  tdrStyle->SetOptTitle(0);
  tdrStyle->SetTitleFont(42);
  tdrStyle->SetTitleColor(1);
  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(10);
  tdrStyle->SetTitleFontSize(0.05);

 
  // For the axis labels:

  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelOffset(0.007, "XYZ");
  tdrStyle->SetLabelSize(0.03, "XYZ");

  tdrStyle->SetAxisColor(1, "XYZ");
  tdrStyle->SetStripDecimals(kTRUE);
  tdrStyle->SetTickLength(0.03, "XYZ");
  tdrStyle->SetNdivisions(510, "XYZ");
  tdrStyle->SetPadTickX(1);  
  tdrStyle->SetPadTickY(1);


  tdrStyle->SetOptLogx(0);
  tdrStyle->SetOptLogy(0);
  tdrStyle->SetOptLogz(0);

  tdrStyle->SetPaperSize(20.,20.);

  tdrStyle->cd();
}
Example #9
0
// Create my custom FORMAL style
//********************************************************************//
void getFormalStyle(void) {

    // std::cout << " *** void getFormalStyle(void) *** Custom  TStyle initialized!" << std::endl;
    TStyle *formalStyle = new TStyle("formalStyle","Style for AN09");

    // For the canvas:
    //********************
    formalStyle->SetCanvasBorderMode(0);
    formalStyle->SetCanvasColor(kWhite);
    formalStyle->SetCanvasDefH(600); //Height of canvas
    formalStyle->SetCanvasDefW(600); //Width of canvas
    formalStyle->SetCanvasDefX(0);   //POsition on screen
    formalStyle->SetCanvasDefY(0);
    // For the Pad:
    //********************
    formalStyle->SetPadBorderMode(0);
    formalStyle->SetOptTitle(0); // delete histogram titles
    // formalStyle->SetPadBorderSize(Width_t size = 1);
    formalStyle->SetPadColor(kWhite);
    formalStyle->SetPadGridX(false);
    formalStyle->SetPadGridY(false);
    formalStyle->SetGridColor(0);
    formalStyle->SetGridStyle(3);
    formalStyle->SetGridWidth(1);

    // For the frame:
    //********************
    formalStyle->SetFrameBorderMode(0);
    formalStyle->SetFrameBorderSize(1);
    formalStyle->SetFrameFillColor(0);
    formalStyle->SetFrameFillStyle(0);
    formalStyle->SetFrameLineColor(1);
    formalStyle->SetFrameLineStyle(1);
    formalStyle->SetFrameLineWidth(1);

    // For the histo:
    //********************
    // formalStyle->SetHistFillColor(1);
    // formalStyle->SetHistFillStyle(0);
    formalStyle->SetHistLineColor(1);
    formalStyle->SetHistLineStyle(0);
    formalStyle->SetHistLineWidth(1);
    // formalStyle->SetLegoInnerR(Float_t rad = 0.5);
    // formalStyle->SetNumberContours(Int_t number = 20);
    formalStyle->SetEndErrorSize(2);
    //formalStyle->SetErrorMarker(20);
    formalStyle->SetErrorX(0.);
    formalStyle->SetMarkerStyle(20);

    //For the fit/function:
    //********************
    formalStyle->SetOptFit(1);
    formalStyle->SetFitFormat("5.4g");
    formalStyle->SetFuncColor(2);
    formalStyle->SetFuncStyle(1);
    formalStyle->SetFuncWidth(1);

    //For the date:
    //********************
    formalStyle->SetOptDate(0);
    // formalStyle->SetDateX(Float_t x = 0.01);
    // formalStyle->SetDateY(Float_t y = 0.01);

    // For the statistics box:
    //********************
    formalStyle->SetOptFile(0);
    formalStyle->SetOptStat(0); // stats box
    formalStyle->SetOptFit(0000); // fit box
    formalStyle->SetStatColor(kWhite);
    formalStyle->SetStatFont(42);
    formalStyle->SetStatFontSize(0.025);
    formalStyle->SetStatTextColor(1);
    formalStyle->SetStatFormat("6.4g");
    formalStyle->SetStatBorderSize(1);
    formalStyle->SetStatH(0.1);
    formalStyle->SetStatW(0.15);
    // formalStyle->SetStatStyle(Style_t style = 1001);
    // formalStyle->SetStatX(Float_t x = 0);
    // formalStyle->SetStatY(Float_t y = 0);

    // Margins:
    //********************
    formalStyle->SetPadTopMargin(0.15);
    formalStyle->SetPadBottomMargin(0.13);
    formalStyle->SetPadLeftMargin(0.13);
    formalStyle->SetPadRightMargin(0.15);

    // For the Global title:
    //********************
    //  formalStyle->SetOptTitle(0);
    formalStyle->SetTitleFont(42);
    formalStyle->SetTitleColor(1);
    formalStyle->SetTitleTextColor(1);
    formalStyle->SetTitleFillColor(10);
    formalStyle->SetTitleFontSize(0.05);
    // formalStyle->SetTitleH(0); // Set the height of the title box
    // formalStyle->SetTitleW(0); // Set the width of the title box
    // formalStyle->SetTitleX(0); // Set the position of the title box
    // formalStyle->SetTitleY(0.985); // Set the position of the title box
    // formalStyle->SetTitleStyle(Style_t style = 1001);
    // formalStyle->SetTitleBorderSize(2);

    // For the axis titles:
    //********************
    formalStyle->SetTitleColor(1, "XYZ");
    formalStyle->SetTitleFont(42, "XYZ");
    formalStyle->SetTitleSize(0.06, "XYZ");
    // formalStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
    // formalStyle->SetTitleYSize(Float_t size = 0.02);
    formalStyle->SetTitleXOffset(1.2);
    formalStyle->SetTitleYOffset(1.2);

    // For the axis labels:
    //********************
    // formalStyle->SetLabelColor(1, "XYZ");
    // formalStyle->SetLabelFont(42, "XYZ");
    // formalStyle->SetLabelOffset(0.007, "XYZ");
    // formalStyle->SetLabelSize(0.05, "XYZ");

    // For the axis:
    //********************
    formalStyle->SetAxisColor(1, "XYZ");
    // formalStyle->SetStripDecimals(kTRUE);
    // formalStyle->SetTickLength(0.03, "XYZ");
    // formalStyle->SetNdivisions(510, "XYZ");
    // formalStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
    // formalStyle->SetPadTickY(1);

    // Change for log plots:
    formalStyle->SetOptLogx(0);
    formalStyle->SetOptLogy(0);
    formalStyle->SetOptLogz(0);

    formalStyle->SetPalette(1,0);

    formalStyle->cd();

} //end of: void getTStyle(void){
Example #10
0
void TDRStyle() {
    TStyle *TDRStyle = new TStyle("TDRStyle", "TDR style");

    /// helvetica, size absolute
    // TDRStyle->font = 43
    // TDRStyle->titleSize = 33
    // TDRStyle->labelSize = 27
    // TDRStyle->statSize = 14

    ///  for the canvas
    TDRStyle->SetCanvasBorderMode(0);
    TDRStyle->SetCanvasColor(kWhite);
    TDRStyle->SetCanvasDefH(600); // Height of canvas
    TDRStyle->SetCanvasDefW(600); // Width of canvas
    TDRStyle->SetCanvasDefX(0);   // POsition on screen
    TDRStyle->SetCanvasDefY(0);

    /// For the Pad:
    TDRStyle->SetPadBorderMode(0);
    TDRStyle->SetPadColor(kWhite);
    TDRStyle->SetPadGridX(false);
    TDRStyle->SetPadGridY(false);
    TDRStyle->SetGridColor(0);
    TDRStyle->SetGridStyle(3);
    TDRStyle->SetGridWidth(1);

    /// For the frame:
    TDRStyle->SetFrameBorderMode(0);
    TDRStyle->SetFrameBorderSize(1);
    TDRStyle->SetFrameFillColor(0);
    TDRStyle->SetFrameFillStyle(0);
    TDRStyle->SetFrameLineColor(1);
    TDRStyle->SetFrameLineStyle(1);
    TDRStyle->SetFrameLineWidth(1);

    /// For the histo:
    TDRStyle->SetHistLineColor(1);
    TDRStyle->SetHistLineStyle(0);
    TDRStyle->SetHistLineWidth(1);
    TDRStyle->SetEndErrorSize(2);
    TDRStyle->SetErrorX(0.5); // needed for uncertainty histograms
    TDRStyle->SetMarkerStyle(20);
    /// For the fit/function:
    TDRStyle->SetOptFit(1);
    TDRStyle->SetFitFormat("5.4g");
    TDRStyle->SetFuncColor(2);
    TDRStyle->SetFuncStyle(1);
    TDRStyle->SetFuncWidth(1);

    /// For the date:
    TDRStyle->SetOptDate(0);;

    /// For the statistics box:
    TDRStyle->SetOptFile(0);
    TDRStyle->SetOptStat(0); // To display the mean and RMS:   SetOptStat("mr");;
    TDRStyle->SetStatColor(kWhite);
    TDRStyle->SetStatFont(43);
    TDRStyle->SetStatFontSize(14);
    TDRStyle->SetStatTextColor(1);
    TDRStyle->SetStatFormat("6.4g");
    TDRStyle->SetStatBorderSize(1);
    TDRStyle->SetStatH(0.1);
    TDRStyle->SetStatW(0.15);

    ///  Margins:
    TDRStyle->SetPadTopMargin(0.05); // default
    TDRStyle->SetPadBottomMargin(0.13);
    TDRStyle->SetPadLeftMargin(0.16);
    TDRStyle->SetPadRightMargin(0.05); // default

    /// For the Global title:
    TDRStyle->SetOptTitle(0);
    TDRStyle->SetTitleFont(43);
    TDRStyle->SetTitleColor(1);
    TDRStyle->SetTitleTextColor(1);
    TDRStyle->SetTitleFillColor(10);
    TDRStyle->SetTitleFontSize(27);

    /// For the axis titles:
    TDRStyle->SetTitleColor(1, "XYZ");
    TDRStyle->SetTitleFont(43, "XYZ");
    TDRStyle->SetTitleSize(33, "XYZ");
    TDRStyle->SetTitleXOffset(0.9);
    TDRStyle->SetTitleYOffset(1.25);

    ///  For the axis labels:
    TDRStyle->SetLabelColor(1, "XYZ");
    TDRStyle->SetLabelFont(43, "XYZ");
    TDRStyle->SetLabelOffset(0.007, "XYZ");
    TDRStyle->SetLabelSize(27, "XYZ");

    /// For the axis:
    TDRStyle->SetAxisColor(1, "XYZ");
    TDRStyle->SetStripDecimals(true);
    TDRStyle->SetTickLength(0.03, "XYZ");
    TDRStyle->SetNdivisions(510, "XYZ");
    TDRStyle->SetPadTickX(1);  /// To get tick marks on the opposite side of the frame
    TDRStyle->SetPadTickY(1);

    /// For the text boxes
    TDRStyle->SetTextFont(43+20); // Bold
    TDRStyle->SetTextSize(27);

    /// Change for log plots:
    TDRStyle->SetOptLogx(0);
    TDRStyle->SetOptLogy(0);
    TDRStyle->SetOptLogz(0);

    /// Postscript options:
    TDRStyle->SetPaperSize(20,20);
    TDRStyle->cd();

}
Example #11
0
void roc_plot(){

 TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");

  // For the canvas:
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasColor(kWhite);
  tdrStyle->SetCanvasDefH(600); //Height of canvas
  tdrStyle->SetCanvasDefW(600); //Width of canvas
  tdrStyle->SetCanvasDefX(0);   //POsition on screen
  tdrStyle->SetCanvasDefY(0);

  // For the Pad:
  tdrStyle->SetPadBorderMode(0);
  tdrStyle->SetPadColor(kWhite);
  tdrStyle->SetPadGridX(true);
  tdrStyle->SetPadGridY(true);
  tdrStyle->SetGridColor(0);
  tdrStyle->SetGridStyle(3);
  tdrStyle->SetGridWidth(1);

  // For the frame:
  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetFrameBorderSize(1);
  tdrStyle->SetFrameFillColor(0);
  tdrStyle->SetFrameFillStyle(0);
  tdrStyle->SetFrameLineColor(1);
  tdrStyle->SetFrameLineStyle(1);
  tdrStyle->SetFrameLineWidth(1);

  // For the histo:
  tdrStyle->SetHistLineColor(1);
  tdrStyle->SetHistLineStyle(0);
  tdrStyle->SetHistLineWidth(1);
  tdrStyle->SetEndErrorSize(2);
  tdrStyle->SetErrorX(0.);

  tdrStyle->SetMarkerStyle(20);

  //For the fit/function:
  tdrStyle->SetOptFit(1);
  tdrStyle->SetFitFormat("5.4g");
  tdrStyle->SetFuncColor(2);
  tdrStyle->SetFuncStyle(1);
  tdrStyle->SetFuncWidth(1);

  //For the date:
  tdrStyle->SetOptDate(0);

  // For the statistics box:
  tdrStyle->SetOptFile(0);
  tdrStyle->SetOptStat("emr"); // To display the mean and RMS:   SetOptStat("mr");
  tdrStyle->SetStatColor(kWhite);
  tdrStyle->SetStatFont(42);
  tdrStyle->SetStatFontSize(0.025);
  tdrStyle->SetStatTextColor(1);
  tdrStyle->SetStatFormat("6.4g");
  tdrStyle->SetStatBorderSize(1);
  tdrStyle->SetStatH(0.1);
  tdrStyle->SetStatW(0.15);

  // Margins:
  tdrStyle->SetPadTopMargin(0.05);
  tdrStyle->SetPadBottomMargin(0.13);
  tdrStyle->SetPadLeftMargin(0.13);
  tdrStyle->SetPadRightMargin(0.05);

  // For the Global title:
  tdrStyle->SetOptTitle(0);
  tdrStyle->SetTitleFont(42);
  tdrStyle->SetTitleColor(1);
  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(10);
  tdrStyle->SetTitleFontSize(0.05);

  // For the axis titles:
  tdrStyle->SetTitleColor(1, "XYZ");
  tdrStyle->SetTitleFont(42, "XYZ");
  tdrStyle->SetTitleSize(0.06, "XYZ");
  tdrStyle->SetTitleXOffset(0.9);
  tdrStyle->SetTitleYOffset(1.05);

  // For the axis labels:
  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelFont(42, "XYZ");
  tdrStyle->SetLabelOffset(0.007, "XYZ");
  tdrStyle->SetLabelSize(0.05, "XYZ");

  // For the axis:
  tdrStyle->SetAxisColor(1, "XYZ");
  tdrStyle->SetStripDecimals(kTRUE);
  tdrStyle->SetTickLength(0.03, "XYZ");
  tdrStyle->SetNdivisions(510, "XYZ");
  tdrStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  tdrStyle->SetPadTickY(1);

  // Change for log plots:
  tdrStyle->SetOptLogx(0);
  tdrStyle->SetOptLogy(0);
  tdrStyle->SetOptLogz(0);

  // Postscript options:
  tdrStyle->SetPaperSize(20.,20.);
  tdrStyle->SetPalette(1);
  
  gROOT -> ForceStyle();
  
  tdrStyle->cd();
  
  gStyle->SetOptStat(0111);
  gStyle->SetOptFit(1111);
  

  int bkg = 787623.93;
  int sig = 9313.;
  
  const int n = 5;
  
  //minmet
  //Double_t cut[n] = {10,15,20,25,30,35,40,45,50,55} ;
  
  //pvalue
  //Double_t cut[n] = {0,0.5,1,1.5,2,2.5,3,3.5,4.0};

  //metsig
  Double_t cut[n] = {5,10,15,20,25};

  //minmet
  //Double_t sensitivity_bkg_n[n]={660142.26/bkg,551026.78/bkg,444547.21/bkg,354649.92/bkg,283093.63/bkg ,227934.73/bkg ,187564.23/bkg,158191.46/bkg,103089.49/bkg,68423.49/bkg};
  //Double_t sensitivity_sig_n[n]={9274./sig ,9233./sig,9172./sig,9089./sig,8995./sig,8870./sig,8718./sig,8539./sig,7398./sig,6497./sig};

  //pvalue
  //Double_t sensitivity_bkg_n[n]={787623.93/bkg,290416.84/bkg, 166165.65/bkg, 87792.43/bkg, 49447.43/bkg, 30536.76/bkg, 19869.09/bkg, 13705.00/bkg, 10075.21/bkg};
  //Double_t sensitivity_sig_n[n]={9313./sig,9005./sig, 8499./sig,7547./sig,6508./sig,5579./sig,4832./sig,4213./sig,3649./sig};

  //metsig
  Double_t sensitivity_bkg_n[n]={579088.98/bkg,94310.14/bkg, 13034.68/bkg,2503.93./bkg,756.13./bkg};
  Double_t sensitivity_sig_n[n]={9045./sig,7492./sig,5899./sig,4654./sig,3726./sig};

  sensitivity_bkg = new TGraph(n,cut,sensitivity_bkg_n);
  sensitivity_sig = new TGraph(n,cut,sensitivity_sig_n);
  
  //Double_t xdummy[2] = {10,55};
  //Double_t xdummy[2] = {-0.1,3};
  Double_t xdummy[2] = {0,25};
  Double_t ydummy[2] = {0.0,1.0};
  
  dummy = new TGraph(2,xdummy,ydummy);
  dummy->SetLineColor(0);
  dummy->SetLineWidth(0);
  dummy->SetMarkerColor(0);
  dummy->SetMarkerSize(0);
  dummy->Draw("AP*");
  dummy->GetYaxis()->SetTitle("Efficiency");
  //dummy->GetXaxis()->SetTitle("Minimized #slash{E}_{T} Cut [GeV]");
  //dummy->GetXaxis()->SetTitle("|Log10(P_{#Chi^{2}})|");
  dummy->GetXaxis()->SetTitle("Met Significance");
  dummy->GetYaxis()->SetLabelSize(0.04);
  dummy->GetXaxis()->SetLabelSize(0.04);
  
  sensitivity_bkg->SetLineColor(2);
  sensitivity_bkg->SetMarkerColor(2);
  
  sensitivity_sig->SetLineColor(4);
  sensitivity_sig->SetMarkerColor(4);
  
  sensitivity_bkg->Draw("LPSame");
  sensitivity_sig->Draw("LPSame");

  //legend = new TLegend(.70,.70,.90,.90,"Final Selection e/#mu+jets");
  legend = new TLegend(0.1845638,0.2027972,0.3674497,0.3024476,NULL,"brNDC");

  legend->AddEntry(sensitivity_bkg, "#gamma + Jets", "lp");
  legend->AddEntry(sensitivity_sig, "Z (#nu#nu) #gamma" , "lp");
  
  legend->SetShadowColor(0);
  legend->SetFillColor(0);
  legend->SetLineColor(0);
  legend->Draw("Same");
  
  latex2 = new TLatex();
  latex2->SetNDC();
  latex2->SetTextSize(0.04);
  latex2->SetTextAlign(31); 
  latex2->DrawLatex(0.87, 0.96, "CMS Preliminary, #sqrt{s} = 8 TeV");

  
}
Example #12
0
void SetStyle()
{
  TStyle *MYStyle = new TStyle("Style","Style");
  gStyle = MYStyle;

  // Canvas
  MYStyle->SetCanvasColor     (0);
  MYStyle->SetCanvasBorderSize(10);
  MYStyle->SetCanvasBorderMode(0);
  MYStyle->SetCanvasDefH      (700);
  MYStyle->SetCanvasDefW      (700);
  MYStyle->SetCanvasDefX      (100);
  MYStyle->SetCanvasDefY      (100);

  // Pads
  MYStyle->SetPadColor       (0);
  MYStyle->SetPadBorderSize  (10);
  MYStyle->SetPadBorderMode  (0);
  MYStyle->SetPadBottomMargin(0.13);
  MYStyle->SetPadTopMargin   (0.08);
  MYStyle->SetPadLeftMargin  (0.15);
  MYStyle->SetPadRightMargin (0.05);
  MYStyle->SetPadGridX       (0);
  MYStyle->SetPadGridY       (0);
  MYStyle->SetPadTickX       (0);
  MYStyle->SetPadTickY       (0);

  // Frames
  MYStyle->SetFrameFillStyle ( 0);
  MYStyle->SetFrameFillColor ( 0);
  MYStyle->SetFrameLineColor ( 1);
  MYStyle->SetFrameLineStyle ( 0);
  MYStyle->SetFrameLineWidth ( 1);
  MYStyle->SetFrameBorderSize(10);
  MYStyle->SetFrameBorderMode( 0);

  // Histograms
  MYStyle->SetHistFillColor(2);
//   MYStyle->SetHistFillStyle(0);
  MYStyle->SetHistLineColor(1);
  MYStyle->SetHistLineStyle(0);
  MYStyle->SetHistLineWidth(2);
  MYStyle->SetNdivisions(505);

  // Functions
  MYStyle->SetFuncColor(1);
  MYStyle->SetFuncStyle(0);
  MYStyle->SetFuncWidth(2);

  // Various
  MYStyle->SetMarkerStyle(20);
  MYStyle->SetMarkerColor(kBlack);
  MYStyle->SetMarkerSize (1.2);

  MYStyle->SetTitleSize  (0.055,"X");
  MYStyle->SetTitleOffset(1.050,"X");
  MYStyle->SetLabelOffset(0.005,"X");
  MYStyle->SetLabelSize  (0.045,"X");
  MYStyle->SetLabelFont  (42   ,"X");

  MYStyle->SetStripDecimals(kFALSE);

  MYStyle->SetTitleSize  (0.055,"Y");
  MYStyle->SetTitleOffset(1.400,"Y");
  MYStyle->SetLabelOffset(0.010,"Y");
  MYStyle->SetLabelSize  (0.045,"Y");
  MYStyle->SetLabelFont  (42   ,"Y");

  MYStyle->SetTextSize   (0.055);
  MYStyle->SetTextFont   (42);

  MYStyle->SetStatFont   (42);
  MYStyle->SetTitleFont  (42);
  MYStyle->SetTitleFont  (42,"X");
  MYStyle->SetTitleFont  (42,"Y");

  MYStyle->SetOptStat    (0);

  MYStyle->SetPalette    (1);
  return;
}
Example #13
0
int electronCompare()
 {
  TString CMP_DIR          = gSystem->Getenv( "CMP_DIR"          ) ;
  TString CMP_URL          = gSystem->Getenv( "CMP_URL"          ) ;
  TString CMP_TITLE        = gSystem->Getenv( "CMP_TITLE"        ) ;
  TString CMP_RED_FILE     = gSystem->Getenv( "CMP_RED_FILE"     ) ;
  TString CMP_BLUE_FILE    = gSystem->Getenv( "CMP_BLUE_FILE"    ) ;
  TString CMP_RED_NAME     = gSystem->Getenv( "CMP_RED_NAME"     ) ;
  TString CMP_BLUE_NAME    = gSystem->Getenv( "CMP_BLUE_NAME"    ) ;
  TString CMP_RED_COMMENT  = gSystem->Getenv( "CMP_RED_COMMENT"  ) ;
  TString CMP_BLUE_COMMENT = gSystem->Getenv( "CMP_BLUE_COMMENT" ) ;
  TString CMP_CONFIG       = gSystem->Getenv( "CMP_CONFIG"       ) ;
  TString CMP_RED_RELEASE  = gSystem->Getenv( "CMP_RED_RELEASE"  ) ;
  TString CMP_BLUE_RELEASE = gSystem->Getenv( "CMP_BLUE_RELEASE" ) ;

//-----
// AC
//  std::cout << "red_file : C : " << CMP_RED_FILE << std::endl;
//  std::cout << "blue_file : C : " << CMP_BLUE_FILE << std::endl;
  std::cout << "red_release : C : " << CMP_RED_RELEASE << std::endl;
  std::cout << "blue_release : C : " << CMP_BLUE_RELEASE << std::endl;
//-----
  
// style:
  TStyle *eleStyle = new TStyle("eleStyle","Style for electron validation");
  eleStyle->SetCanvasBorderMode(0);
  eleStyle->SetCanvasColor(kWhite);
  eleStyle->SetCanvasDefH(600);
  eleStyle->SetCanvasDefW(800);
  eleStyle->SetCanvasDefX(0);
  eleStyle->SetCanvasDefY(0);
  eleStyle->SetPadBorderMode(0);
  eleStyle->SetPadColor(kWhite);
  eleStyle->SetPadGridX(false);
  eleStyle->SetPadGridY(false);
  eleStyle->SetGridColor(0);
  eleStyle->SetGridStyle(3);
  eleStyle->SetGridWidth(1);
  eleStyle->SetOptStat(1);
  eleStyle->SetPadTickX(1);
  eleStyle->SetPadTickY(1);
  eleStyle->SetHistLineColor(1);
  eleStyle->SetHistLineStyle(0);
  eleStyle->SetHistLineWidth(2);
  eleStyle->SetEndErrorSize(2);
  eleStyle->SetErrorX(0.);
  eleStyle->SetOptStat(1);
  eleStyle->SetTitleColor(1, "XYZ");
  eleStyle->SetTitleFont(42, "XYZ");
  eleStyle->SetTitleXOffset(1.0);
  eleStyle->SetTitleYOffset(1.0);
  eleStyle->SetLabelOffset(0.005, "XYZ");
  eleStyle->SetTitleSize(0.05, "XYZ");
  eleStyle->SetTitleFont(22,"X");
  eleStyle->SetTitleFont(22,"Y");
  eleStyle->SetHistLineWidth(2);
  eleStyle->SetPadBottomMargin(0.13);
  eleStyle->SetPadLeftMargin(0.15);
  eleStyle->SetMarkerStyle(21);
  eleStyle->SetMarkerSize(0.8);
  //-- AC --
  eleStyle->SetPadRightMargin(0.2) ; 

  eleStyle->cd();

  gROOT->ForceStyle();

  TString internal_path("DQMData/Run 1/EgammaV/Run summary/") ;
  TString old_internal_path("DQMData/EgammaV/") ;

  TString file_ref_dir ;
  TFile * file_ref = 0 ;
  if ( CMP_BLUE_FILE != "" )
   {
    file_ref = TFile::Open(CMP_BLUE_FILE) ;
    if (file_ref!=0)
     {
      std::cout<<"open "<<CMP_BLUE_FILE<<std::endl ;
      if (file_ref->cd(internal_path)==kTRUE)
       {
        std::cerr<<"cd "<<internal_path<<std::endl ;
        file_ref_dir = internal_path ;
        file_ref->cd() ;
       }
      else if (file_ref->cd(old_internal_path)==kTRUE)
       {
        std::cerr<<"cd "<<old_internal_path<<std::endl ;
        file_ref_dir = old_internal_path ;
        file_ref->cd() ;
       }
      else
       {
        std::cerr<<"Failed move to: "<<internal_path<<" and "<<old_internal_path<<std::endl ;
        file_ref_dir = "" ;
       }
     }
    else
     { std::cerr<<"Failed to open: "<<CMP_BLUE_FILE<<std::endl ; }
   }

  TString file_new_dir = internal_path  ;
  TFile * file_new = 0 ;
  if ( CMP_RED_FILE != "" )
   {
    file_new = TFile::Open(CMP_RED_FILE) ;
    if (file_new!=0)
     {
      std::cout<<"open "<<CMP_RED_FILE<<std::endl ;
      if (file_new->cd(internal_path)==kTRUE)
       {
        std::cerr<<"cd "<<internal_path<<std::endl ;
        file_new_dir = internal_path ;
        file_new->cd() ;
       }
      else if (file_new->cd(old_internal_path)==kTRUE)
       {
        std::cerr<<"cd "<<old_internal_path<<std::endl ;
        file_new_dir = old_internal_path ;
        file_new->cd() ;
       }
      else
       {
        std::cerr<<"Failed move to: "<<internal_path<<" and "<<old_internal_path<<std::endl ;
        file_new_dir = "" ;
       }
     }
    else
     { std::cerr<<"Failed to open: "<<CMP_RED_FILE<<std::endl ; }
   }

  TCanvas * canvas ;
  TH1 * histo_ref, * histo_new ;
  TPaveStats * st_ref, * st_new ;

  std::ofstream web_page(CMP_DIR+"/index.html") ;

  web_page
    <<"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n"
    <<"<html>\n"
    <<"<head>\n"
    <<"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />\n"
    <<"<title>"<<CMP_TITLE<<"</title>\n"
    <<"</head>\n"
    <<"<h1><a href=\"../\"><img border=0 width=\"22\" height=\"22\" src=\"../../../../img/up.gif\" alt=\"Up\"/></a>&nbsp;"<<CMP_TITLE<<"</h1>\n" ;

  if (file_ref==0)
   {
    web_page
     <<"<p>In all plots below"
     <<", there was no reference histograms to compare with"
     <<", and the "<<CMP_RED_NAME<<" histograms are in red." ;
   }
  else
   {
/*    web_page
     <<"<p>In all plots below"
     <<", the "<<CMP_RED_NAME<<" histograms are in red"
     <<", and the "<<CMP_BLUE_NAME<<" histograms are in blue." ;*/
    web_page
     <<"<p>In all plots below"
     <<", the "<<CMP_RED_RELEASE<<" histograms are in red"
     <<", and the "<<CMP_BLUE_RELEASE<<" histograms are in blue." ;
/*	std::cout <<"<p>In all plots below "
     <<", the "<<CMP_RED_RELEASE<<" histograms are in red"
     <<", and the "<<CMP_BLUE_RELEASE<<" histograms are in blue." << std::endl ;*/
   }

  std::ifstream red_comment_file(CMP_RED_COMMENT) ;
  std::string red_comment ;
  std::getline(red_comment_file,red_comment) ;
  red_comment_file.close() ;

  std::ifstream blue_comment_file(CMP_BLUE_COMMENT) ;
  std::string blue_comment ;
  std::getline(blue_comment_file,blue_comment) ;
  blue_comment_file.close() ;

  web_page<<" "<<red_comment<<" "<<blue_comment
    <<" Some more details"
    <<": <a href=\"electronCompare.C\">script</a> used to make the plots"
    <<", <a href=\""<<CMP_CONFIG<<"\">specification</a> of histograms"
    <<", <a href=\"gifs/\">images</a> of histograms"
    <<"." ;
  web_page<<"</p>\n" ;

  // canvas_name std::string => TString
  TString canvas_name, histo_name, histo_full_path, gif_name, gif_path ;
  TString short_histo_name ;
  TString first_short_histo_name, first_histo_name ;
  TString dl_short_histo_name, dl_histo_name ;
  TString num_ref, denom_ref, num_full, denom_full ;
  Int_t n_ele_charge ;
  int scaled, err ;
  int divide;
  std::string cat, line, histo_path, num, denom ;
  int eol ; // end of line
  int eoc ; // enf of category
  double rescale_factor = 0. ;

  std::ifstream histo_file1(CMP_CONFIG) ;

  web_page
    <<"<br><table border=\"1\" cellpadding=\"5\" width=\"100%\">"
    <<"<tr valign=\"top\"><td width=\"20%\">\n" ;
  int cat_num = 0 ;

  cat = "" ;
  do
   {
    std::getline(histo_file1,cat) ;
   } while (cat.find_first_not_of(" \t")==std::string::npos) ;

  web_page<<"<b>"<<cat<<"</b><br><br>" ;

  while (std::getline(histo_file1,line))
   {
    if (line.empty()) continue ;
    std::size_t first = line.find_first_not_of(" \t") ;
    if (first==std::string::npos) continue ;
    if (line[first]=='#') continue ;

    std::istringstream linestream(line) ;
    divide = 0 ; num = denom = "" ;
    linestream >> histo_path >> scaled >> err >> eol >> eoc >> divide >> num >> denom ;

    histo_name = histo_path ;
    Ssiz_t pos = histo_name.Last('/') ;
    if (pos!=kNPOS) histo_name.Remove(0,pos+1) ;
    short_histo_name = histo_name ;
    short_histo_name.Remove(0,2) ;
    if (short_histo_name.BeginsWith("ele_"))
     { short_histo_name.Remove(0,4) ; }

    if (first_histo_name.IsNull())
     {
      first_short_histo_name = short_histo_name ;
      first_histo_name = histo_name ;
      dl_short_histo_name = short_histo_name ;
      dl_histo_name = histo_name ;
     }
    else
     {
      TString common ;
      TString first_specific ;
      TString second_specific ;
      CompareHistoNames(first_short_histo_name,short_histo_name,common,first_specific,second_specific) ;
      if (!dl_histo_name.IsNull())
       {
        if (first_specific.IsNull())
         { web_page<<"<a href=\"#"<<first_histo_name<<"\">"<<first_short_histo_name<<"</a>" ; }
        else
         { web_page<<common<<"&nbsp;|&nbsp;<a href=\"#"<<first_histo_name<<"\">"<<first_specific<<"</a>" ; }
        dl_short_histo_name = dl_histo_name = "" ;
       }
      web_page<<"&nbsp;|&nbsp;<a href=\"#"<<histo_name<<"\">"<<second_specific<<"</a>" ;
     }

    if ((eol)||(eoc))
     {
      if (!dl_histo_name.IsNull())
       { web_page<<"<a href=\"#"<<dl_histo_name<<"\">"<<dl_short_histo_name<<"</a>" ; }
      web_page<<"<br>\n" ;
      first_histo_name = first_short_histo_name = "" ;
     }

    if (eoc)
     {
      cat_num++ ;
      if ((cat_num%5)==0)
       { web_page<<"<br></td></tr>\n<tr valign=\"top\"><td width=\"20%\">" ; }
      else
       { web_page<<"<br></td><td width=\"20%\">\n" ; }
      cat = "" ;
      do
       {
        std::getline(histo_file1,cat) ;
       } while (cat.find_first_not_of(" \t")==std::string::npos) ;
      web_page<<"<b>"<<cat<<"</b><br><br>" ;
     }
   }
  web_page<<"<br></td></tr></table>\n" ;
  histo_file1.close() ;

  web_page<<"<br><br><table cellpadding=\"5\"><tr valign=\"top\"><td><a href=\""<<CMP_URL<<"/\"><img width=\"18\" height=\"18\" border=\"0\" align=\"middle\" src=\"../../../../img/up.gif\" alt=\"Top\"/></a></td><td>\n" ;
  std::ifstream histo_file2(CMP_CONFIG) ;

  n_ele_charge = 0 ;
  cat = "" ;
  do
   {
    std::getline(histo_file2,cat) ;
   } while (cat.empty()) ;

  while (std::getline(histo_file2,line))
   {
    if (line.empty()) continue ;
    std::size_t first = line.find_first_not_of(" \t") ;
    if (first==std::string::npos) continue ;
    if (line[first]=='#') continue ;

    std::istrstream linestream(line) ;
    divide = 0 ; num = denom = "" ;
    linestream >> histo_path >> scaled >> err >> eol >> eoc >> divide >> num >> denom ;

    histo_name = histo_path.c_str() ;
    histo_ref = 0 ;
    histo_new = 0 ;
    st_ref = 0 ;
    st_new = 0 ;

    Ssiz_t pos = histo_name.Last('/') ;
    if (pos!=kNPOS) histo_name.Remove(0,pos+1) ;
    short_histo_name = histo_name ;
    short_histo_name.Remove(0,2) ;

    gif_name = "gifs/" ; gif_name += histo_name ; gif_name += ".gif" ;
    gif_path = CMP_DIR ; gif_path += "/" ; gif_path += gif_name ;
    canvas_name = "c" ; canvas_name += histo_name ;
    canvas = new TCanvas(canvas_name) ;
    canvas->SetFillColor(10) ;
	//std::cout << "canvas width " << canvas->GetWindowWidth() << std::endl; // 800 default
	//std::cout << "canvas height " << canvas->GetWindowHeight() << std::endl; // 600 default
	//std::cout << "canvas Y real " << canvas->GetYsizeReal() << std::endl;
	//std::cout << "canvas Y user " << canvas->GetYsizeUser() << std::endl;

    web_page<<"<a id=\""<<histo_name<<"\" name=\""<<short_histo_name<<"\"></a>" ;

    // search histo_ref
    if ( file_ref != 0 )
     {
      if (file_ref_dir.IsNull())
       { histo_full_path = histo_name ; }
      else
       { histo_full_path = file_ref_dir ; histo_full_path += histo_path.c_str() ; }
      histo_ref = (TH1 *)file_ref->Get(histo_full_path) ;
      if (histo_ref!=0)
       {
        // renaming those histograms avoid very strange bugs because they
        // have the same names as the ones loaded from the new file
        histo_ref->SetName(TString(histo_ref->GetName())+"_ref") ;
       }
      else
       {
        web_page<<"No <b>"<<histo_path<<"</b> for "<<CMP_BLUE_NAME<<".<br>" ;
       }
     }

    // search histo_new
    histo_full_path = file_new_dir ; histo_full_path += histo_path.c_str() ;
    histo_new = (TH1 *)file_new->Get(histo_full_path) ;
	//std::cout << "size " << histo_new->GetSize() << std::endl ;

    // special treatments
    if ((scaled==1)&&(histo_new!=0)&&(histo_ref!=0)&&(histo_ref->GetEntries()!=0))
     {
      Int_t new_entries = histo_new->GetEntries() ;
      if (new_entries==0) { new_entries = n_ele_charge ; }
      if (new_entries==0)
       { std::cerr<<"DO NOT KNOW HOW TO RESCALE "<<histo_name<<std::endl ; }
      else
       {
        // we want to reuse the rescale factor of the first histogram
        // for all the subsequent histograms.
        if (rescale_factor==0.) { rescale_factor = new_entries/histo_ref->GetEntries() ; }
        histo_ref->Scale(rescale_factor) ;
       }
     }
    if ((histo_new!=0)&&(histo_ref!=0)&&(histo_ref->GetMaximum()>histo_new->GetMaximum()))
     { histo_new->SetMaximum(histo_ref->GetMaximum()*1.1) ; }

    if (histo_new==0)
     {
      web_page<<"No <b>"<<histo_path<<"</b> for "<<CMP_RED_NAME<<".<br>" ;
     }
    else
     {
      // catch n_ele_charge
      if (histo_name=="h_ele_charge")
       { n_ele_charge = histo_new->GetEntries() ; }

      // draw histo_new
      TString newDrawOptions(err==1?"E1 P":"hist") ;
      gErrorIgnoreLevel = kWarning ;
      if (divide!=0)
       {
        num_full = file_new_dir ; num_full += num.c_str() ;
        denom_full = file_new_dir ; denom_full += denom.c_str() ;
        histo_new = DivideHistos(file_new,histo_new,num_full,denom_full) ;
       }
      histo_new->SetLineColor(kRed) ;
      histo_new->SetMarkerColor(2) ;
      histo_new->SetLineWidth(3) ;
      RenderHisto(histo_new,canvas) ;
      histo_new->Draw(newDrawOptions) ;
//	  std::cout << "SIZE : " << canvas->GetWw() << std::endl ; // 796 default
//	  std::cout << "SIZE : " << canvas->GetWh() << std::endl ; // 572 default
      //canvas->Update() ;
	  //canvas->SetWindowSize(440, 600);
	  canvas->SetCanvasSize(960, 600);
      canvas->Update() ;
      st_new = (TPaveStats*)histo_new->FindObject("stats");
      st_new->SetTextColor(kRed) ;

      // draw histo_ref
      if (histo_ref!=0)
       {
        if (divide!=0)
         {
          num_ref = num ;
          denom_ref = denom ;
          if (file_ref_dir.IsNull())
           {
            pos = num_ref.Last('/') ;
            if (pos!=kNPOS) num_ref.Remove(0,pos+1) ;
            pos = denom_ref.Last('/') ;
            if (pos!=kNPOS) denom_ref.Remove(0,pos+1) ;
           }
          histo_ref = DivideHistos(file_ref,histo_ref,file_ref_dir+num_ref,file_ref_dir+denom_ref) ;
         }
        RenderHisto(histo_ref,canvas) ;
        histo_ref->SetLineColor(kBlue) ;
        histo_ref->SetLineWidth(3) ;
        histo_ref->Draw("sames hist") ;
        canvas->Update() ;
        st_ref = (TPaveStats*)histo_ref->FindObject("stats");
        st_ref->SetTextColor(kBlue) ;
        Double_t y1 = st_ref->GetY1NDC() ;
        Double_t y2 = st_ref->GetY2NDC() ;
        st_ref->SetY1NDC(2*y1-y2) ;
        st_ref->SetY2NDC(y1) ;
        //Double_t x1 = st_ref->GetX1NDC() ;
        //Double_t x2 = st_ref->GetX2NDC() ;
		//std::cout << "position s x1 = " << x1 << std::endl ; // 0.78 par defaut
		//std::cout << "position s x2 = " << x2 << std::endl ; // 0.98 par defaut
		//std::cout << "position s y1 = " << y1 << std::endl ; // 0.755 ou 0.835 par defaut
		//std::cout << "position s y2 = " << y2 << std::endl ; // 0.995 par defaut
       }

      // Redraws
      newDrawOptions = "sames " ;
      newDrawOptions += (err==1?"E1 P":"hist") ;
      histo_new->Draw(newDrawOptions) ;
      if (st_ref!=0) st_ref->Draw() ;
      if (st_new!=0) st_new->Draw() ;

      // eventual log scale
      //if ( (log==1) && ( (histo_new->GetEntries()>0) || ( (histo_ref!=0) && (histo_ref->GetEntries()!=0) ) ) )
      // { canvas->SetLogy(1) ; }


// ne pas oublier de decommenter les 4 lignes suivantes
      std::cout<<histo_name
        <<" has "<<histo_new->GetEffectiveEntries()<<" entries"
        <<" of mean value "<<histo_new->GetMean()
        <<std::endl ;
      canvas->SaveAs(gif_path.Data()) ;
      web_page<<"<a href=\""<<gif_name<<"\"><img border=\"0\" class=\"image\" width=\"440\" src=\""<<gif_name<<"\"></a><br>" ;
     }

//    else if ((file_ref!=0)&&(histo_ref!=0))
//     {
//      std::cout<<histo_path<<" NOT FOUND"<<std::endl ;
//      web_page<<"<br>(no such histo)" ;
//      canvas->SaveAs(gif_path.Data()) ;
//      web_page<<"<a href=\""<<gif_name<<"\"><img border=\"0\" class=\"image\" width=\"440\" src=\""<<gif_name<<"\"></a><br>" ;
//     }

    if (eol)
     { web_page<<"</td></tr>\n<tr valign=\"top\"><td><a href=\""<<CMP_URL<<"/\"><img width=\"18\" height=\"18\" border=\"0\" align=\"middle\" src=\"../../../../img/up.gif\" alt=\"Top\"/></a></td><td>" ; }
    else
     { web_page<<"</td><td>" ; }
    if (eoc)
     {
      cat = "" ;
      do
       {
        std::getline(histo_file2,cat) ;
       } while (cat.empty()) ;
     }
   }
  histo_file2.close() ;
  web_page<<"</td></tr></table>\n" ;

  web_page<<"\n</html>"<<std::endl ;
  web_page.close() ;

 }
Example #14
0
/////
//   Set setTDRStyle_modified (from link https://twiki.cern.ch/twiki/pub/CMS/TRK10001/setTDRStyle_modified.C)
/////
void setTDRStyle(){
  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");

  // For the canvas:
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasColor(kWhite);
  tdrStyle->SetCanvasDefH(600); //Height of canvas
  tdrStyle->SetCanvasDefW(600); //Width of canvas
  tdrStyle->SetCanvasDefX(0);   //POsition on screen
  tdrStyle->SetCanvasDefY(0);
  // For the Pad:
  tdrStyle->SetPadBorderMode(0);
  tdrStyle->SetPadColor(kWhite);
  tdrStyle->SetPadGridX(false);
  tdrStyle->SetPadGridY(false);
  tdrStyle->SetGridColor(0);
  tdrStyle->SetGridStyle(3);
  tdrStyle->SetGridWidth(1);
  // For the frame:
  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetFrameBorderSize(1);
  tdrStyle->SetFrameFillColor(0);
  tdrStyle->SetFrameFillStyle(0);
  tdrStyle->SetFrameLineColor(1);
  tdrStyle->SetFrameLineStyle(1);
  tdrStyle->SetFrameLineWidth(1);

  // For the histo:
  tdrStyle->SetHistFillColor(0);
  tdrStyle->SetHistLineColor(1);
  tdrStyle->SetHistLineStyle(0);
  tdrStyle->SetHistLineWidth(1);
  tdrStyle->SetErrorX(0.);
  tdrStyle->SetMarkerStyle(20);

  //For the fit/function:
  tdrStyle->SetOptFit(1);
  tdrStyle->SetFitFormat("5.4g");
  tdrStyle->SetFuncStyle(1);
  tdrStyle->SetFuncWidth(1);

  //For the date:
  tdrStyle->SetOptDate(0);

  // For the statistics box:
  tdrStyle->SetOptFile(0);
  tdrStyle->SetOptStat("e");
  tdrStyle->SetStatColor(kGray);
  tdrStyle->SetStatFont(42);

  tdrStyle->SetStatTextColor(1);
  tdrStyle->SetStatFormat("6.4g");
  tdrStyle->SetStatBorderSize(0);
  tdrStyle->SetStatX(1.); //Starting position on X axis
  tdrStyle->SetStatY(1.); //Starting position on Y axis
  tdrStyle->SetStatFontSize(0.025); //Vertical Size
  tdrStyle->SetStatW(0.15); //Horizontal size 
  // tdrStyle->SetStatStyle(Style_t style = 1001);

  // Margins:
  tdrStyle->SetPadTopMargin(0.05);
  tdrStyle->SetPadBottomMargin(0.125);
  tdrStyle->SetPadLeftMargin(0.105);
  tdrStyle->SetPadRightMargin(0.1);

  // For the Global title:

  //  tdrStyle->SetOptTitle(0);
  tdrStyle->SetTitleFont(42);
  tdrStyle->SetTitleColor(1);
  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(10);
  tdrStyle->SetTitleFontSize(0.05);

  // For the axis titles:
  tdrStyle->SetTitleColor(1, "XYZ");
  tdrStyle->SetTitleFont(42, "XYZ");
  tdrStyle->SetTitleSize(0.05, "XYZ");
  tdrStyle->SetTitleXOffset(0.9);
  tdrStyle->SetTitleYOffset(0.8);
  tdrStyle->SetTitleOffset(0.7, "Y"); // Another way to set the Offset

  // For the axis labels:
  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelFont(42, "XYZ");
  tdrStyle->SetLabelOffset(0.007, "XYZ");
  tdrStyle->SetLabelSize(0.045, "XYZ");

  // For the axis:

  tdrStyle->SetAxisColor(1, "XYZ");
  tdrStyle->SetStripDecimals(kTRUE);
  tdrStyle->SetTickLength(0.03, "XYZ");
  tdrStyle->SetNdivisions(510, "XYZ");
  tdrStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  tdrStyle->SetPadTickY(1);

  // Change for log plots:
  tdrStyle->SetOptLogx(0);
  tdrStyle->SetOptLogy(0);
  tdrStyle->SetOptLogz(0);

  tdrStyle->cd();
}
Example #15
0
void setTDRStyle() {
  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");

  tdrStyle->SetCanvasColor     (0);
  tdrStyle->SetCanvasBorderSize(10);
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasDefH      (700);
  tdrStyle->SetCanvasDefW      (700);
  tdrStyle->SetCanvasDefX      (100);
  tdrStyle->SetCanvasDefY      (100);

  // color palette for 2D temperature plots
  tdrStyle->SetPalette(1,0);
  
  // Pads
  tdrStyle->SetPadColor       (0);
  tdrStyle->SetPadBorderSize  (5);
  tdrStyle->SetPadBorderMode  (0);
  tdrStyle->SetPadBorderMode  (0);
  tdrStyle->SetPadBottomMargin(0.15);
  tdrStyle->SetPadTopMargin   (0.08);
  tdrStyle->SetPadLeftMargin  (0.12);
  tdrStyle->SetPadRightMargin (0.07);
  tdrStyle->SetPadGridX       (0);
  tdrStyle->SetPadGridY       (0);
  tdrStyle->SetPadTickX       (1);
  tdrStyle->SetPadTickY       (1);

  // Frames
  tdrStyle->SetLineWidth(3);
  tdrStyle->SetFrameFillStyle ( 0);
  tdrStyle->SetFrameFillColor ( 0);
  tdrStyle->SetFrameLineColor ( 1);
  tdrStyle->SetFrameLineStyle ( 0);
  tdrStyle->SetFrameLineWidth ( 2);
  tdrStyle->SetFrameBorderSize(5);
  tdrStyle->SetFrameBorderMode( 0);

  
  tdrStyle->SetFillStyle( 0);

  // Histograms
  tdrStyle->SetHistFillColor(2);
  tdrStyle->SetHistFillStyle(0);
  tdrStyle->SetHistLineColor(1);
  tdrStyle->SetHistLineStyle(0);
  tdrStyle->SetHistLineWidth(4);
  tdrStyle->SetNdivisions(510);

  // Functions
  tdrStyle->SetFuncColor(1);
  tdrStyle->SetFuncStyle(0);
  tdrStyle->SetFuncWidth(2);

  // Various
  tdrStyle->SetMarkerStyle(20);
  tdrStyle->SetMarkerColor(kBlack);
  tdrStyle->SetMarkerSize (1.4);

  tdrStyle->SetTitleBorderSize(0);
  tdrStyle->SetTitleFillColor (0);
  tdrStyle->SetTitleX         (0.2);

  tdrStyle->SetTitleSize  (0.055,"X");
  tdrStyle->SetTitleOffset(1.200,"X");
  tdrStyle->SetLabelOffset(0.005,"X");
  tdrStyle->SetLabelSize  (0.050,"X");
  tdrStyle->SetLabelFont  (42   ,"X");

  tdrStyle->SetStripDecimals(kFALSE);

  tdrStyle->SetTitleSize  (0.055,"Y");
  tdrStyle->SetTitleOffset(1.000,"Y");
  tdrStyle->SetLabelOffset(0.010,"Y");
  tdrStyle->SetLabelSize  (0.050,"Y");
  tdrStyle->SetLabelFont  (42   ,"Y");

  tdrStyle->SetTextSize   (0.055);
  tdrStyle->SetTextFont   (42);

  tdrStyle->SetStatFont   (42);
  tdrStyle->SetTitleFont  (42);
  tdrStyle->SetTitleFont  (42,"X");
  tdrStyle->SetTitleFont  (42,"Y");

  tdrStyle->SetOptStat    (0);
  tdrStyle->SetOptTitle    (0);

  tdrStyle->SetLineStyleString(11,"20 10");


  tdrStyle->SetLegendBorderSize(0);




  tdrStyle->cd();
}
Example #16
0
void SetStyle() {

  TH1::SetDefaultSumw2();
  gROOT->SetStyle("Plain");

  TStyle *MITStyle = new TStyle("MIT-Style","The Perfect Style for Plots ;-)");
  gStyle = MITStyle;

  gStyle->SetTitleSize(0.08,"t");//  gStyle->SetTitleX(0.8);
  gStyle->SetTitleW(0.3);
  gStyle->SetFrameFillColor(2);
  gStyle->SetFrameLineColor(2);

  // Canvas

  MITStyle->SetCanvasColor     (0);
  MITStyle->SetCanvasBorderSize(10);
  MITStyle->SetCanvasBorderMode(0);

  MITStyle->SetCanvasDefH      (500);
  MITStyle->SetCanvasDefW      (550);
  //  MITStyle->SetCanvasDefX      (100);
  //  MITStyle->SetCanvasDefY      (100);

  // Pads

  MITStyle->SetPadColor       (0);
  //  MITStyle->SetPadBorderSize  (10);
  MITStyle->SetPadBorderMode  (0);
  MITStyle->SetPadBottomMargin(0.18);
  MITStyle->SetPadTopMargin   (0.06);
  MITStyle->SetPadLeftMargin  (0.22);
  MITStyle->SetPadRightMargin (0.06);
  MITStyle->SetPadGridX       (0);
  MITStyle->SetPadGridY       (0);
  MITStyle->SetPadTickX       (1);
  MITStyle->SetPadTickY       (1);

  // Frames

  MITStyle->SetFrameFillStyle ( 0);
  MITStyle->SetFrameFillColor ( 0);
  MITStyle->SetFrameLineColor ( 1);
  MITStyle->SetFrameLineStyle ( 0);
  MITStyle->SetFrameLineWidth ( 1);
  //  MITStyle->SetFrameBorderSize(10);
  MITStyle->SetFrameBorderMode( 0);

  // Histograms

  MITStyle->SetHistLineColor(1);
  MITStyle->SetHistLineStyle(0);
  MITStyle->SetHistLineWidth(3);
  MITStyle->SetNdivisions(505,"X");
  MITStyle->SetNdivisions(505,"Y");
  MITStyle->SetNdivisions(505,"Z");

  // Functions

  MITStyle->SetFuncColor(1);
  MITStyle->SetFuncStyle(0);
  MITStyle->SetFuncWidth(2);

  // Various

  MITStyle->SetMarkerStyle(20);
  MITStyle->SetMarkerColor(kBlack);
  MITStyle->SetMarkerSize (1.2);

//  MITStyle->SetTitleSize  (0.1,"t");

  MITStyle->SetTitleSize  (0.070,"X");
  MITStyle->SetTitleOffset(1.0,"X");
  MITStyle->SetTitleFont  (42,"X");
  MITStyle->SetLabelOffset(0.005,"X");
  MITStyle->SetLabelSize  (0.070,"X");
  MITStyle->SetLabelFont  (42   ,"X");

  MITStyle->SetTitleSize  (0.070,"Y");
  MITStyle->SetTitleOffset(1.0,"Y");
  MITStyle->SetTitleFont  (42,"Y");
  MITStyle->SetLabelOffset(0.005,"Y");
  MITStyle->SetLabelSize  (0.070,"Y");
  MITStyle->SetLabelFont  (42   ,"Y");

  MITStyle->SetTitleSize  (0.06,"Z");
  MITStyle->SetTitleOffset(1.640,"Z");
  MITStyle->SetTitleFont  (42,"Z");
  MITStyle->SetLabelOffset(0.005,"Z");
  MITStyle->SetLabelSize  (0.070,"Z");
  MITStyle->SetLabelFont  (42   ,"Z");

  MITStyle->SetStripDecimals(kFALSE);
  MITStyle->SetTitleBorderSize(0);
  MITStyle->SetTitleFillColor(0);
  //  MITStyle->SetTitleAlign(6);

  MITStyle->SetTextSize   (20);
  MITStyle->SetTextFont   (43);

  MITStyle->SetStatFont   (42);
  MITStyle->SetOptStat    (0);

  MITStyle->SetLegendBorderSize(0);
  MITStyle->SetEndErrorSize(0);
  MITStyle->SetErrorX(0);

  MITStyle->SetPalette    (1,0);
}
void ChargeRatioStyle()
{
  TStyle* GloStyle;
  GloStyle = gStyle;

  TStyle* ChargeRatioStyle = new TStyle("ChargeRatioStyle", "ChargeRatioStyle");
  gStyle = ChargeRatioStyle;

  //----------------------------------------------------------------------------
  // Canvas
  //----------------------------------------------------------------------------
  ChargeRatioStyle->SetCanvasBorderMode(  0);
  ChargeRatioStyle->SetCanvasBorderSize( 10);
  ChargeRatioStyle->SetCanvasColor     (  0);
  ChargeRatioStyle->SetCanvasDefH      (600);
  ChargeRatioStyle->SetCanvasDefW      (550);
  ChargeRatioStyle->SetCanvasDefX      ( 10);
  ChargeRatioStyle->SetCanvasDefY      ( 10);

  //----------------------------------------------------------------------------
  // Pad
  //----------------------------------------------------------------------------
  ChargeRatioStyle->SetPadBorderMode  (   0);
  ChargeRatioStyle->SetPadBorderSize  (  10);
  ChargeRatioStyle->SetPadColor       (   0);
  ChargeRatioStyle->SetPadBottomMargin(0.20);
  ChargeRatioStyle->SetPadTopMargin   (0.08);
  ChargeRatioStyle->SetPadLeftMargin  (0.18);
  ChargeRatioStyle->SetPadRightMargin (0.05);

  //----------------------------------------------------------------------------
  // Frame
  //----------------------------------------------------------------------------
  ChargeRatioStyle->SetFrameFillStyle ( 0);
  ChargeRatioStyle->SetFrameFillColor ( 0);
  ChargeRatioStyle->SetFrameLineColor ( 1);
  ChargeRatioStyle->SetFrameLineStyle ( 0);
  ChargeRatioStyle->SetFrameLineWidth ( 2);
  ChargeRatioStyle->SetFrameBorderMode( 0);
  ChargeRatioStyle->SetFrameBorderSize(10);

  //----------------------------------------------------------------------------
  // Hist
  //----------------------------------------------------------------------------
  ChargeRatioStyle->SetHistFillColor(0);
  ChargeRatioStyle->SetHistFillStyle(1);
  ChargeRatioStyle->SetHistLineColor(1);
  ChargeRatioStyle->SetHistLineStyle(0);
  ChargeRatioStyle->SetHistLineWidth(1);

  //----------------------------------------------------------------------------
  // Axis
  //----------------------------------------------------------------------------
  ChargeRatioStyle->SetLabelFont  (   42, "xyz");
  ChargeRatioStyle->SetLabelOffset(0.015, "xyz");
  ChargeRatioStyle->SetLabelSize  (0.050, "xyz");
  ChargeRatioStyle->SetNdivisions (  505, "xyz");
  ChargeRatioStyle->SetTitleFont  (   42, "xyz");
  ChargeRatioStyle->SetTitleSize  (0.050, "xyz");

  //  ChargeRatioStyle->SetNdivisions ( -503, "y");

  ChargeRatioStyle->SetTitleOffset(  1.4,   "x");
  ChargeRatioStyle->SetTitleOffset(  1.2,   "y");
  ChargeRatioStyle->SetPadTickX   (           1);  // Tick marks on the opposite side of the frame
  ChargeRatioStyle->SetPadTickY   (           1);  // Tick marks on the opposite side of the frame


  //----------------------------------------------------------------------------
  // Title
  //----------------------------------------------------------------------------
  ChargeRatioStyle->SetTitleBorderSize( 0);
  ChargeRatioStyle->SetTitleFillColor (10);
  ChargeRatioStyle->SetTitleFont      (42, "");

  ChargeRatioStyle->SetTitleAlign   (   33);
  ChargeRatioStyle->SetTitleFontSize(0.045);

  ChargeRatioStyle->SetTitleX       (0.560);
  ChargeRatioStyle->SetTitleY       (0.890);
  //  ChargeRatioStyle->SetTitleX       (0.940);
  //  ChargeRatioStyle->SetTitleY       (0.990);


  //----------------------------------------------------------------------------
  // Stat
  //----------------------------------------------------------------------------
  ChargeRatioStyle->SetOptStat       (1110);
  ChargeRatioStyle->SetStatBorderSize(   0);
  ChargeRatioStyle->SetStatColor     (  10);
  ChargeRatioStyle->SetStatFont      (  42);
  ChargeRatioStyle->SetStatX         (0.94);
  ChargeRatioStyle->SetStatY         (0.91);

  return();
}
Example #18
0
void WZPaperStyle()
{
  TStyle* WZPaperStyle = new TStyle("WZPaperStyle", "WZPaperStyle");

  gStyle = WZPaperStyle;


  //----------------------------------------------------------------------------
  // Canvas
  //----------------------------------------------------------------------------
  WZPaperStyle->SetCanvasBorderMode(  0);
  WZPaperStyle->SetCanvasBorderSize( 10);
  WZPaperStyle->SetCanvasColor     (  0);
  WZPaperStyle->SetCanvasDefH      (600);
  WZPaperStyle->SetCanvasDefW      (550);
  WZPaperStyle->SetCanvasDefX      ( 10);
  WZPaperStyle->SetCanvasDefY      ( 10);


  //----------------------------------------------------------------------------
  // Pad
  //----------------------------------------------------------------------------
  WZPaperStyle->SetPadBorderMode  (   0);
  WZPaperStyle->SetPadBorderSize  (  10);
  WZPaperStyle->SetPadColor       (   0);
  WZPaperStyle->SetPadBottomMargin(0.20);
  WZPaperStyle->SetPadTopMargin   (0.08);
  WZPaperStyle->SetPadLeftMargin  (0.18);
  WZPaperStyle->SetPadRightMargin (0.05);


  //----------------------------------------------------------------------------
  // Frame
  //----------------------------------------------------------------------------
  WZPaperStyle->SetFrameBorderMode( 0);
  WZPaperStyle->SetFrameBorderSize(10);
  WZPaperStyle->SetFrameFillStyle ( 0);
  WZPaperStyle->SetFrameFillColor ( 0);
  WZPaperStyle->SetFrameLineColor ( 1);
  WZPaperStyle->SetFrameLineStyle ( 0);
  WZPaperStyle->SetFrameLineWidth ( 2);


  //----------------------------------------------------------------------------
  // Hist
  //----------------------------------------------------------------------------
  WZPaperStyle->SetHistFillColor(0);
  WZPaperStyle->SetHistFillStyle(1);
  WZPaperStyle->SetHistLineColor(1);
  WZPaperStyle->SetHistLineStyle(0);
  WZPaperStyle->SetHistLineWidth(1);


  //----------------------------------------------------------------------------
  // Axis
  //----------------------------------------------------------------------------
  WZPaperStyle->SetLabelFont  (   42, "xyz");
  WZPaperStyle->SetLabelOffset(0.015, "xyz");
  WZPaperStyle->SetLabelSize  (0.040, "xyz");
  WZPaperStyle->SetNdivisions (  505, "xyz");
  WZPaperStyle->SetTitleFont  (   42, "xyz");
  WZPaperStyle->SetTitleSize  (0.040, "xyz");
  WZPaperStyle->SetTitleOffset( 1.15,   "x");
  WZPaperStyle->SetTitleOffset( 1.15,   "y");
  WZPaperStyle->SetPadTickX   (           1);
  WZPaperStyle->SetPadTickY   (           1);


  //----------------------------------------------------------------------------
  // Title
  //----------------------------------------------------------------------------
  WZPaperStyle->SetTitleAlign     (   33);
  WZPaperStyle->SetTitleBorderSize(    0);
  WZPaperStyle->SetTitleFillColor (   10);
  WZPaperStyle->SetTitleFont      (   42);
  WZPaperStyle->SetTitleFontSize  (0.045);
  WZPaperStyle->SetTitleX         (0.960);
  WZPaperStyle->SetTitleY         (0.990);


  //----------------------------------------------------------------------------
  // Stat
  //----------------------------------------------------------------------------
  WZPaperStyle->SetOptStat       (   0);
  WZPaperStyle->SetStatBorderSize(   0);
  WZPaperStyle->SetStatColor     (  10);
  WZPaperStyle->SetStatFont      (  42);
  WZPaperStyle->SetStatX         (0.94);
  WZPaperStyle->SetStatY         (0.91);
}
void setStyle() {

  // set the TStyle
  TStyle* style = new TStyle("DrawBaseStyle", "");
  style->SetCanvasColor(0);
  style->SetPadColor(0);
  style->SetFrameFillColor(0);
  style->SetStatColor(0);
  style->SetOptStat(0);
  style->SetTitleFillColor(0);
  style->SetCanvasBorderMode(0);
  style->SetPadBorderMode(0);
  style->SetFrameBorderMode(0);
  style->SetPadBottomMargin(0.12);
  style->SetPadLeftMargin(0.12);
  style->cd();
  // For the canvas:
  style->SetCanvasBorderMode(0);
  style->SetCanvasColor(kWhite);
  style->SetCanvasDefH(600); //Height of canvas
  style->SetCanvasDefW(600); //Width of canvas
  style->SetCanvasDefX(0); //POsition on screen
  style->SetCanvasDefY(0);
  // For the Pad:
  style->SetPadBorderMode(0);
  style->SetPadColor(kWhite);
  style->SetPadGridX(false);
  style->SetPadGridY(false);
  style->SetGridColor(0);
  style->SetGridStyle(3);
  style->SetGridWidth(1);
  // For the frame:
  style->SetFrameBorderMode(0);
  style->SetFrameBorderSize(1);
  style->SetFrameFillColor(0);
  style->SetFrameFillStyle(0);
  style->SetFrameLineColor(1);
  style->SetFrameLineStyle(1);
  style->SetFrameLineWidth(1);
  // Margins:
  style->SetPadTopMargin(0.05);
  style->SetPadBottomMargin(0.15);//0.13);
  style->SetPadLeftMargin(0.15);//0.16);
  style->SetPadRightMargin(0.05);//0.02);
  // For the Global title:
  style->SetOptTitle(0);
  style->SetTitleFont(42);
  style->SetTitleColor(1);
  style->SetTitleTextColor(1);
  style->SetTitleFillColor(10);
  style->SetTitleFontSize(0.05);
  // For the axis titles:
  style->SetTitleColor(1, "XYZ");
  style->SetTitleFont(42, "XYZ");
  style->SetTitleSize(0.05, "XYZ");
  style->SetTitleXOffset(1.15);//0.9);
  style->SetTitleYOffset(1.3); // => 1.15 if exponents
  // For the axis labels:
  style->SetLabelColor(1, "XYZ");
  style->SetLabelFont(42, "XYZ");
  style->SetLabelOffset(0.007, "XYZ");
  style->SetLabelSize(0.045, "XYZ");
  // For the axis:
  style->SetAxisColor(1, "XYZ");
  style->SetStripDecimals(kTRUE);
  style->SetTickLength(0.03, "XYZ");
  style->SetNdivisions(510, "XYZ");
  style->SetPadTickX(1); // To get tick marks on the opposite side of the frame
  style->SetPadTickY(1);
  // for histograms:
  style->SetHistLineColor(0);
  style->cd();

}
Example #20
0
void setTDRStyle() {

  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR"); 

// For the canvas:
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasColor(kWhite);
  tdrStyle->SetCanvasDefH(600); //Height of canvas
  tdrStyle->SetCanvasDefW(600); //Width of canvas
  tdrStyle->SetCanvasDefX(0);   //POsition on screen
  tdrStyle->SetCanvasDefY(0);

// For the Pad:
  tdrStyle->SetPadBorderMode(0);
  tdrStyle->SetPadColor(kWhite);
  tdrStyle->SetPadGridX(false);
  tdrStyle->SetPadGridY(false);
  tdrStyle->SetGridColor(0);
  tdrStyle->SetGridStyle(3);
  tdrStyle->SetGridWidth(1);

// For the frame:
  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetFrameBorderSize(1);
  tdrStyle->SetFrameFillColor(0);
  tdrStyle->SetFrameFillStyle(0);
  tdrStyle->SetFrameLineColor(1);
  tdrStyle->SetFrameLineStyle(1);
  tdrStyle->SetFrameLineWidth(1);

// For the histo:
  tdrStyle->SetHistLineColor(1);
  tdrStyle->SetHistLineStyle(0);
  tdrStyle->SetHistLineWidth(1);
  tdrStyle->SetEndErrorSize(2);
  tdrStyle->SetErrorX(0.);
  tdrStyle->SetMarkerStyle(20);

//For the fit/function:
  tdrStyle->SetOptFit(1);
  tdrStyle->SetFitFormat("5.4g");
  tdrStyle->SetFuncColor(2);
  tdrStyle->SetFuncStyle(1);
  tdrStyle->SetFuncWidth(1);

//For the date:
  tdrStyle->SetOptDate(0);

// For the statistics box:
  tdrStyle->SetOptFile(0);
  tdrStyle->SetOptStat(0); // To display the mean and RMS:   SetOptStat("mr");
  tdrStyle->SetStatColor(kWhite);
  tdrStyle->SetStatFont(42);
  tdrStyle->SetStatFontSize(0.025);
  tdrStyle->SetStatTextColor(1);
  tdrStyle->SetStatFormat("6.4g");
  tdrStyle->SetStatBorderSize(1);
  tdrStyle->SetStatH(0.1);
  tdrStyle->SetStatW(0.15);

// Margins:
  tdrStyle->SetPadTopMargin(0.05);
  tdrStyle->SetPadBottomMargin(0.13);
  tdrStyle->SetPadLeftMargin(0.16);
  tdrStyle->SetPadRightMargin(0.02);

// For the Global title:
  tdrStyle->SetOptTitle(0);
  tdrStyle->SetTitleFont(42);
  tdrStyle->SetTitleColor(1);
  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(10);
  tdrStyle->SetTitleFontSize(0.05);

// For the axis titles:
  tdrStyle->SetTitleColor(1, "XYZ");
  tdrStyle->SetTitleFont(42, "XYZ");
  tdrStyle->SetTitleSize(0.06, "XYZ");
  tdrStyle->SetTitleXOffset(0.9);
  tdrStyle->SetTitleYOffset(1.25);

// For the axis labels:
  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelFont(42, "XYZ");
  tdrStyle->SetLabelOffset(0.007, "XYZ");
  tdrStyle->SetLabelSize(0.05, "XYZ");

// For the axis:
  tdrStyle->SetAxisColor(1, "XYZ");
  tdrStyle->SetStripDecimals(kTRUE);
  tdrStyle->SetTickLength(0.03, "XYZ");
  tdrStyle->SetNdivisions(510, "XYZ");
  tdrStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  tdrStyle->SetPadTickY(1);

// Change for log plots:
  tdrStyle->SetOptLogx(0);
  tdrStyle->SetOptLogy(0);
  tdrStyle->SetOptLogz(0);

// Postscript options:
  tdrStyle->SetPaperSize(20.,20.);

  tdrStyle->cd();
}
Example #21
0
void Style_Toby_2()
{
   // Add the saved style to the current ROOT session.

   delete gROOT->GetStyle("Toby_2");

   TStyle *tmpStyle = new TStyle("Toby_2", "Style for posters and talks");
   tmpStyle->SetNdivisions(510, "x");
   tmpStyle->SetNdivisions(510, "y");
   tmpStyle->SetNdivisions(510, "z");
   tmpStyle->SetAxisColor(1, "x");
   tmpStyle->SetAxisColor(1, "y");
   tmpStyle->SetAxisColor(1, "z");
   tmpStyle->SetLabelColor(1, "x");
   tmpStyle->SetLabelColor(1, "y");
   tmpStyle->SetLabelColor(1, "z");
   tmpStyle->SetLabelFont(42, "x");
   tmpStyle->SetLabelFont(42, "y");
   tmpStyle->SetLabelFont(42, "z");
   tmpStyle->SetLabelOffset(0.005, "x");
   tmpStyle->SetLabelOffset(0.005, "y");
   tmpStyle->SetLabelOffset(0.005, "z");
   tmpStyle->SetLabelSize(0.035, "x");
   tmpStyle->SetLabelSize(0.035, "y");
   tmpStyle->SetLabelSize(0.035, "z");
   tmpStyle->SetTickLength(0.03, "x");
   tmpStyle->SetTickLength(0.03, "y");
   tmpStyle->SetTickLength(0.03, "z");
   tmpStyle->SetTitleOffset(1, "x");
   tmpStyle->SetTitleOffset(1, "y");
   tmpStyle->SetTitleOffset(1, "z");
   tmpStyle->SetTitleSize(0.035, "x");
   tmpStyle->SetTitleSize(0.035, "y");
   tmpStyle->SetTitleSize(0.035, "z");
   tmpStyle->SetTitleColor(1, "x");
   tmpStyle->SetTitleColor(1, "y");
   tmpStyle->SetTitleColor(1, "z");
   tmpStyle->SetTitleFont(42, "x");
   tmpStyle->SetTitleFont(42, "y");
   tmpStyle->SetTitleFont(42, "z");
   tmpStyle->SetBarWidth(1);
   tmpStyle->SetBarOffset(0);
   tmpStyle->SetDrawBorder(0);
   tmpStyle->SetOptLogx(0);
   tmpStyle->SetOptLogy(0);
   tmpStyle->SetOptLogz(0);
   tmpStyle->SetOptDate(0);
   tmpStyle->SetOptStat(111);
   tmpStyle->SetOptTitle(kTRUE);
   tmpStyle->SetOptFit(0);
   tmpStyle->SetNumberContours(20);
   tmpStyle->GetAttDate()->SetTextFont(62);
   tmpStyle->GetAttDate()->SetTextSize(0.025);
   tmpStyle->GetAttDate()->SetTextAngle(0);
   tmpStyle->GetAttDate()->SetTextAlign(11);
   tmpStyle->GetAttDate()->SetTextColor(1);
   tmpStyle->SetDateX(0.01);
   tmpStyle->SetDateY(0.01);
   tmpStyle->SetEndErrorSize(2);
   tmpStyle->SetErrorX(0.5);
   tmpStyle->SetFuncColor(2);
   tmpStyle->SetFuncStyle(1);
   tmpStyle->SetFuncWidth(2);
   tmpStyle->SetGridColor(0);
   tmpStyle->SetGridStyle(3);
   tmpStyle->SetGridWidth(1);
   tmpStyle->SetLegendBorderSize(1);
   tmpStyle->SetLegendFillColor(0);
   tmpStyle->SetLegendFont(42);
   tmpStyle->SetHatchesLineWidth(1);
   tmpStyle->SetHatchesSpacing(1);
   tmpStyle->SetFrameFillColor(0);
   tmpStyle->SetFrameLineColor(1);
   tmpStyle->SetFrameFillStyle(1001);
   tmpStyle->SetFrameLineStyle(1);
   tmpStyle->SetFrameLineWidth(1);
   tmpStyle->SetFrameBorderSize(1);
   tmpStyle->SetFrameBorderMode(0);
   tmpStyle->SetHistFillColor(0);
   tmpStyle->SetHistLineColor(602);
   tmpStyle->SetHistFillStyle(1001);
   tmpStyle->SetHistLineStyle(1);
   tmpStyle->SetHistLineWidth(1);
   tmpStyle->SetHistMinimumZero(kFALSE);
   tmpStyle->SetCanvasPreferGL(kFALSE);
   tmpStyle->SetCanvasColor(0);
   tmpStyle->SetCanvasBorderSize(2);
   tmpStyle->SetCanvasBorderMode(0);
   tmpStyle->SetCanvasDefH(500);
   tmpStyle->SetCanvasDefW(700);
   tmpStyle->SetCanvasDefX(10);
   tmpStyle->SetCanvasDefY(10);
   tmpStyle->SetPadColor(0);
   tmpStyle->SetPadBorderSize(2);
   tmpStyle->SetPadBorderMode(0);
   tmpStyle->SetPadBottomMargin(0.1);
   tmpStyle->SetPadTopMargin(0.1);
   tmpStyle->SetPadLeftMargin(0.1);
   tmpStyle->SetPadRightMargin(0.1);
   tmpStyle->SetPadGridX(kFALSE);
   tmpStyle->SetPadGridY(kFALSE);
   tmpStyle->SetPadTickX(0);
   tmpStyle->SetPadTickY(0);
   tmpStyle->SetPaperSize(20, 26);
   tmpStyle->SetScreenFactor(1);
   tmpStyle->SetStatColor(0);
   tmpStyle->SetStatTextColor(1);
   tmpStyle->SetStatBorderSize(1);
   tmpStyle->SetStatFont(42);
   tmpStyle->SetStatFontSize(0);
   tmpStyle->SetStatStyle(1001);
   tmpStyle->SetStatFormat("6.4g");
   tmpStyle->SetStatX(0.9);
   tmpStyle->SetStatY(0.97);
   tmpStyle->SetStatW(0.15);
   tmpStyle->SetStatH(0.16);
   tmpStyle->SetStripDecimals(kTRUE);
   tmpStyle->SetTitleAlign(23);
   tmpStyle->SetTitleFillColor(0);
   tmpStyle->SetTitleTextColor(1);
   tmpStyle->SetTitleBorderSize(0);
   tmpStyle->SetTitleFont(42);
   tmpStyle->SetTitleFontSize(0.05);
   tmpStyle->SetTitleStyle(0);
   tmpStyle->SetTitleX(0.5);
   tmpStyle->SetTitleY(0.995);
   tmpStyle->SetTitleW(0);
   tmpStyle->SetTitleH(0);
   tmpStyle->SetLegoInnerR(0.5);

   Int_t fPaletteColor[50] = {51, 52, 53, 54, 55, 56, 57, 58, 59, 
                             60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 
                             70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 
                             80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 
                             90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100};
   tmpStyle->SetPalette(50, fPaletteColor);

   TString fLineStyleArrayTmp[30] = {"", "   ", "  12 12", "  4 8", 
                             "  12 16 4 16", "  20 12 4 12", "  20 12 4 12 4 12 4 12", "  20 20", "  20 12 4 12 4 12", 
                             "  80 20", "  80 40 4 40", "   ", "   ", "   ", 
                             "   ", "   ", "   ", "   ", "   ", 
                             "   ", "   ", "   ", "   ", "   ", 
                             "   ", "   ", "   ", "   ", "   ", "   "};
   for (Int_t i=0; i<30; i++)
      tmpStyle->SetLineStyleString(i, fLineStyleArrayTmp[i]);

   tmpStyle->SetHeaderPS("");
   tmpStyle->SetTitlePS("");
   tmpStyle->SetFitFormat("5.4g");
   tmpStyle->SetPaintTextFormat("g");
   tmpStyle->SetLineScalePS(3);
   tmpStyle->SetColorModelPS(0);
   tmpStyle->SetTimeOffset(788918400);

   tmpStyle->SetLineColor(1);
   tmpStyle->SetLineStyle(1);
   tmpStyle->SetLineWidth(1);
   tmpStyle->SetFillColor(19);
   tmpStyle->SetFillStyle(1001);
   tmpStyle->SetMarkerColor(1);
   tmpStyle->SetMarkerSize(1);
   tmpStyle->SetMarkerStyle(1);
   tmpStyle->SetTextAlign(11);
   tmpStyle->SetTextAngle(0);
   tmpStyle->SetTextColor(1);
   tmpStyle->SetTextFont(62);
   tmpStyle->SetTextSize(0.05);
}
void setHHStyle(TStyle& HHStyle)
{
    const int fontstyle=42;
    HHStyle.SetPalette(1);
        
    // ==============
    //  Canvas
    // ==============
            
    HHStyle.SetCanvasBorderMode(0);
    HHStyle.SetCanvasColor(kWhite);
    HHStyle.SetCanvasDefH(600); //Height of canvas
    HHStyle.SetCanvasDefW(600); //Width of canvas
    HHStyle.SetCanvasDefX(0);   //Position on screen
    HHStyle.SetCanvasDefY(0);
            
    // ==============
    //  Pad
    // ==============
            
    HHStyle.SetPadBorderMode(0);
    // HHStyle.SetPadBorderSize(Width_t size = 1);
    HHStyle.SetPadColor(kWhite);
    HHStyle.SetPadGridX(false);
    HHStyle.SetPadGridY(false);
    HHStyle.SetGridColor(kGray);
    HHStyle.SetGridStyle(3);
    HHStyle.SetGridWidth(1);
            
    // ==============
    //  Frame
    // ==============
            
    HHStyle.SetFrameBorderMode(0);
    HHStyle.SetFrameBorderSize(1);
    HHStyle.SetFrameFillColor(0);
    HHStyle.SetFrameFillStyle(0);
    HHStyle.SetFrameLineColor(1);
    HHStyle.SetFrameLineStyle(1);
    HHStyle.SetFrameLineWidth(1);
            
    // ==============
    //  Histo
    // ==============

    HHStyle.SetErrorX(0.0);
    HHStyle.SetEndErrorSize(8);
            
    // HHStyle.SetHistFillColor(1);
    // HHStyle.SetHistFillStyle(0);
    // HHStyle.SetHistLineColor(1);
    HHStyle.SetHistLineStyle(0);
    HHStyle.SetHistLineWidth(1);
    // HHStyle.SetLegoInnerR(Float_t rad = 0.5);
    // HHStyle.SetNumberContours(Int_t number = 20);

    // HHStyle.SetErrorMarker(20);
            
    HHStyle.SetMarkerStyle(20);
            
    // ==============
    //  Fit/function
    // ==============
            
    HHStyle.SetOptFit(0);
    HHStyle.SetFitFormat("5.4g");
    HHStyle.SetFuncColor(2);
    HHStyle.SetFuncStyle(1);
    HHStyle.SetFuncWidth(1);
            
    // ==============
    //  Date
    // ============== 
            
    HHStyle.SetOptDate(0);
    // HHStyle.SetDateX(Float_t x = 0.01);
    // HHStyle.SetDateY(Float_t y = 0.01);
            
    // =====================
    //  Statistics Box
    // =====================
            
    HHStyle.SetOptFile(0);
    HHStyle.SetOptStat(0); // To display the mean and RMS:   SetOptStat("mr");
    HHStyle.SetStatColor(kWhite);
    HHStyle.SetStatFont(fontstyle);
    HHStyle.SetStatFontSize(0.025);
    HHStyle.SetStatTextColor(1);
    HHStyle.SetStatFormat("6.4g");
    HHStyle.SetStatBorderSize(1);
    HHStyle.SetStatH(0.1);
    HHStyle.SetStatW(0.15);
    // HHStyle.SetStatStyle(Style_t style = 1001);
    // HHStyle.SetStatX(Float_t x = 0);
    // HHStyle.SetStatY(Float_t y = 0);
            
    // ==============
    //  Margins
    // ==============

    HHStyle.SetPadTopMargin(0.1);
    HHStyle.SetPadBottomMargin(0.15);
    HHStyle.SetPadLeftMargin(0.20);
    HHStyle.SetPadRightMargin(0.05);
            
    // ==============
    //  Global Title
    // ==============
            
    HHStyle.SetOptTitle(0);
    HHStyle.SetTitleFont(fontstyle);
    HHStyle.SetTitleColor(1);
    HHStyle.SetTitleTextColor(1);
    HHStyle.SetTitleFillColor(10);
    HHStyle.SetTitleFontSize(0.05);
    // HHStyle.SetTitleH(0); // Set the height of the title box
    // HHStyle.SetTitleW(0); // Set the width of the title box
    // HHStyle.SetTitleX(0); // Set the position of the title box
    // HHStyle.SetTitleY(0.985); // Set the position of the title box
    // HHStyle.SetTitleStyle(Style_t style = 1001);
    // HHStyle.SetTitleBorderSize(2);
            
    // ==============
    //  Axis titles
    // ==============
            
    HHStyle.SetTitleColor(1, "XYZ");
    HHStyle.SetTitleFont(fontstyle, "XYZ");
    HHStyle.SetTitleSize(0.05, "XYZ");
    // HHStyle.SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
    // HHStyle.SetTitleYSize(Float_t size = 0.02);
    HHStyle.SetTitleXOffset(1.0);
    HHStyle.SetTitleYOffset(1.7);
    // HHStyle.SetTitleOffset(1.1, "Y"); // Another way to set the Offset
            
    // ==============
    //  Axis Label
    // ==============
            
    //HHStyle.SetLabelColor(1, "XYZ");
    HHStyle.SetLabelFont(fontstyle, "XYZ");
    HHStyle.SetLabelOffset(0.007, "XYZ");
    HHStyle.SetLabelSize(0.04, "XYZ");
            
    // ==============
    //  Axis
    // ==============
            
    HHStyle.SetAxisColor(1, "XYZ");
    HHStyle.SetStripDecimals(kTRUE);
    HHStyle.SetTickLength(0.03, "XYZ");
    HHStyle.SetNdivisions(510, "XYZ");
    HHStyle.SetPadTickX(1);  // To get tick marks on the opposite side of the frame
    HHStyle.SetPadTickY(1);
            
    // Change for log plots:
    HHStyle.SetOptLogx(0);
    HHStyle.SetOptLogy(0);
    HHStyle.SetOptLogz(0);
            
    // ==============
    //  Text
    // ==============
            
    HHStyle.SetTextAlign(11);
    HHStyle.SetTextAngle(0);
    HHStyle.SetTextColor(1);
    HHStyle.SetTextFont(fontstyle);
    HHStyle.SetTextSize(0.05);
            
    // =====================
    //  Postscript options:
    // =====================
            
    HHStyle.SetPaperSize(20.,20.);
    // HHStyle.SetLineScalePS(Float_t scale = 3);
    // HHStyle.SetLineStyleString(Int_t i, const char* text);
    // HHStyle.SetHeaderPS(const char* header);
    // HHStyle.SetTitlePS(const char* pstitle);
            
    // HHStyle.SetBarOffset(Float_t baroff = 0.5);
    // HHStyle.SetBarWidth(Float_t barwidth = 0.5);
    // HHStyle.SetPaintTextFormat(const char* format = "g");
    // HHStyle.SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
    // HHStyle.SetTimeOffset(Double_t toffset);
    // HHStyle.SetHistMinimumZero(kTRUE);
}
void blinding_study() 
{
	gSystem->CompileMacro("MitGPTree.h");
	
// First we define MIT Style for the plots.

	TStyle *MitStyle = gStyle;
	//gStyle = MitStyle;

	// Canvas
	MitStyle->SetCanvasColor     (0);
	MitStyle->SetCanvasBorderSize(10);
	MitStyle->SetCanvasBorderMode(0);
	MitStyle->SetCanvasDefH      (700);
	MitStyle->SetCanvasDefW      (700);
	MitStyle->SetCanvasDefX      (100);
	MitStyle->SetCanvasDefY      (100);

	// Pads
	MitStyle->SetPadColor       (0);
	MitStyle->SetPadBorderSize  (10);
	MitStyle->SetPadBorderMode  (0);
	MitStyle->SetPadBottomMargin(0.13);
	MitStyle->SetPadTopMargin   (0.04);
	MitStyle->SetPadLeftMargin  (0.18);
	MitStyle->SetPadRightMargin (0.04);
	MitStyle->SetPadGridX       (0);
	MitStyle->SetPadGridY       (0);
	MitStyle->SetPadTickX       (0);
	MitStyle->SetPadTickY       (0);

	// Frames
	MitStyle->SetFrameFillStyle ( 0);
	MitStyle->SetFrameFillColor ( 0);
	MitStyle->SetFrameLineColor ( 1);
	MitStyle->SetFrameLineStyle ( 0);
	MitStyle->SetFrameLineWidth ( 1);
	MitStyle->SetFrameBorderSize(10);
	MitStyle->SetFrameBorderMode( 0);

	// Histograms
	MitStyle->SetHistFillColor(2);
	MitStyle->SetHistFillStyle(0);
	MitStyle->SetHistLineColor(1);
	MitStyle->SetHistLineStyle(0);
	MitStyle->SetHistLineWidth(2);
	MitStyle->SetNdivisions(505);

	// Functions
	MitStyle->SetFuncColor(1);
	MitStyle->SetFuncStyle(0);
	MitStyle->SetFuncWidth(2);

	// Various
	MitStyle->SetMarkerStyle(20);
	MitStyle->SetMarkerColor(kBlack);
	MitStyle->SetMarkerSize (1.2);

	MitStyle->SetTitleSize  (0.055,"X");
	MitStyle->SetTitleOffset(1.200,"X");
	MitStyle->SetLabelOffset(0.005,"X");
	MitStyle->SetLabelSize  (0.050,"X");
	MitStyle->SetLabelFont  (42   ,"X");
	MitStyle->SetTickLength (-0.03,"X");

	MitStyle->SetStripDecimals(kFALSE);

	MitStyle->SetTitleSize  (0.055,"Y");
	MitStyle->SetTitleOffset(1.800,"Y");
	MitStyle->SetLabelOffset(0.010,"Y");
	MitStyle->SetLabelSize  (0.050,"Y");
	MitStyle->SetLabelFont  (42   ,"Y");
	MitStyle->SetTickLength (-0.03,"Y");

	MitStyle->SetTextSize   (0.055);
	MitStyle->SetTextFont   (42);

	MitStyle->SetStatFont   (42);
	MitStyle->SetTitleFont  (42);
	MitStyle->SetTitleFont  (42,"X");
	MitStyle->SetTitleFont  (42,"Y");

	MitStyle->SetOptStat    (0);
  
// Here the style section ends and the macro begins.
	
	string sig_samples[] = 
	{
		"s12-dmmpho-v_m1-v7a",
		"s12-dmmpho-av_m1-v7a",
		"s12-dmmpho-v_m10-v7a",
		"s12-dmmpho-av_m10-v7a",
		"s12-dmmpho-v_m100-v7a",
		"s12-dmmpho-av_m100-v7a",
		"s12-dmmpho-v_m200-v7a",
		"s12-dmmpho-av_m200-v7a",
		"s12-dmmpho-av_m300-v7a",	
		"s12-dmmpho-v_m500-v7a",
		"s12-dmmpho-av_m500-v7a",		
		"s12-dmmpho-v_m1000-v7a",
		"s12-dmmpho-av_m1000-v7a",
		"s12-addmpho-md1_d2-v7a",
		"s12-addmpho-md1_d3-v7a",
		"s12-addmpho-md1_d4-v7a",
		"s12-addmpho-md1_d5-v7a",		
		"s12-addmpho-md1_d6-v7a",
		"s12-addmpho-md2_d2-v7a",
		"s12-addmpho-md2_d3-v7a",
		"s12-addmpho-md2_d5-v7a",
		"s12-addmpho-md2_d6-v7a",
		"s12-addmpho-md3_d2-v7a",
		"s12-addmpho-md3_d3-v7a",
		"s12-addmpho-md3_d4-v7a",
		"s12-addmpho-md3_d5-v7a",
		"s12-addmpho-md3_d6-v7a"
	}
	
	Int_t signal_num=0; 
	
// This macro considers only one signal sample at a time, so the variable signal_num defines
// which signal sample to work on (it is the index of the sample in sig_samples).
	
	double sig_weights[] =
	{
		4.81E-07,
		4.79E-07,
		4.80E-07,
		4.81E-07,
		4.77E-07,
		4.26E-07,
		4.23E-07,
		3.18E-07,
		2.19E-07,
		2.01E-07,
		9.52E-08,
		3.00E-08,
		8.22E-09,
		6.48E-02,
		1.73E-01,
		6.93E-02,
		9.17E-02,
		9.63E-01,
		5.87E-03,
		4.91E-03,
		4.37E-03,
		4.26E-03,
		1.45E-03,
		7.93E-04,
		5.53E-04,
		4.26E-04,
		3.24E-04
	};
	
// The signal weights are given by (sigma_MC * lumi)/(N_processed). Background weights are defined similarly below.

	string bg_samples[] = {"s12-zgptg130-v7c", "s12-wjets-ptw100-v7a", "s12-wgptg130-v7a", "s12-qcdht100-250-v7a", "s12-qcdht250-500-v7a", "s12-qcdht500-1000-v7a", 
	"s12-qcdht1000-v7a", "s12-2pibo10_25-v7a", "s12-2pibo25_250-v7a", "s12-2pibo250-v7a", "s12-2pibx10_25-v7a", "s12-2pibx25_250-v7a", "s12-2pibx250-v7a", 
	"s12-pj50_80-v7a", "s12-pj80_120-v7a", "s12-pj120_170-v7a", "s12-pj170_300-v7a", "s12-pj300_470-v7a", "s12-pj470_800-v7a", "s12-pj800_1400-v7a", 
	"s12-pj1400_1800-v7a", "s12-pj1800-v7a", "s12-zgllgptg130-v7a", "s12-zgllg-v7a"};

	double bg_weights[]=
	{
		5.28E-03,
		1.14E-01,
		1.38E-02,
		5.63E+03,
		2.34E+02,
		9.71E+00,
		3.09E-01,
		9.21E+00,
		9.90E-01,
		4.21E-04,
		1.66E+01,
		6.43E-01,
		4.91E-05,
		3.30E+01,
		5.49E+00,
		1.09E+00,
		3.01E-01,
		2.15E-02,
		2.10E-03,
		7.11E-05,
		4.45E-07,
		1.88E-08,
		3.18E-03,
		5.10E-01
	};
	
	string sigLine = sig_samples[signal_num];
	Double_t sigWeight = sig_weights[signal_num];
	
	TH1* sig_hist = new TH1F("sig_hist", TString("Phi Between Met and Photon for Signal Events [") + TString(sigLine) + TString("]"), 70, 0, 3.5); 
	TH1* bg_hist = new TH1F("bg_hist", TString("Phi Between Met and Photon for Background Events [") + TString(sigLine) + TString("]"), 70, 0, 3.5);
	
	TH1* signifhist = new TH1F("signifhist", TString(" "), 24, 2, 3.2);

	cout<<"The selected signal sample is: "<<TString(sigLine)<<" "<<endl;
	
	TString sigFilename = TString("monoph-2013-July9_") + TString(sigLine) + TString("_noskim.root");
	
	MitGPTree sigEvent;
	sigEvent.LoadTree(TString("/scratch/cferko/hist/monoph-2013-July9/merged/")+sigFilename, 0);
	sigEvent.InitTree(0);
	
	int nDataSig=sigEvent.tree_->GetEntries();
	
	for (int evt=0; evt<nDataSig; ++evt) 
	{
		sigEvent.tree_->GetEntry(evt);
		Double_t pho1Pt = sigEvent.pho1_.Pt();
		Double_t jet1Pt = sigEvent.jet1_.Pt();
		Double_t met = sigEvent.met_;
		Double_t metPhi = sigEvent.metPhi_;
		Double_t nphotons = sigEvent.nphotons_;
		Double_t ncosmics = sigEvent.ncosmics_;
		Double_t phoPassEleVeto = sigEvent.phoPassEleVeto_a1_;
		Double_t jet1Pt = sigEvent.jet1_.Pt();
		Double_t nlep = sigEvent.nlep_;
		Double_t pho1Eta = sigEvent.pho1_.Eta();
		Double_t pho1Phi = sigEvent.pho1_.Phi();
		Double_t phoIsTrigger = sigEvent.phoIsTrigger_a1_;
		Double_t phoLeadTimeSpan = sigEvent.phoLeadTimeSpan_a1_;
		Double_t phoCoviEtaiEta = sigEvent.phoCoviEtaiEta_a1_;
		Double_t phoCoviPhiiPhi = sigEvent.phoCoviPhiiPhi_a1_;
		Double_t phoMipIsHalo = sigEvent.phoMipIsHalo_a1_;
		Double_t phoSeedTime = sigEvent.phoSeedTime_a1_;
		
		Double_t deltaPhi = TMath::ACos(TMath::Cos(pho1Phi - metPhi));
		
		if (TMath::Abs(pho1Eta)<1.479 && met>140 && pho1Pt>160 && nphotons>0 && phoPassEleVeto>0 && phoIsTrigger==1 && TMath::Abs(phoLeadTimeSpan) < 8. && phoCoviEtaiEta > 0.001 && phoCoviPhiiPhi > 0.001 && phoMipIsHalo == 0 && phoSeedTime > -1.5 && nlep==0 && ncosmics==0 && jet1Pt<100) sig_hist->Fill(deltaPhi, sigWeight);			
	}

	for (int i=0; i<24; i++)
	{
		string bgLine = bg_samples[i];
		Double_t bgWeight = bg_weights[i];

		TString bgFilename = TString("monoph-2013-July9_") + TString(bgLine) + TString("_noskim.root");

		MitGPTree bgEvent;
		bgEvent.LoadTree(TString("/scratch/cferko/hist/monoph-2013-July9/merged/") + bgFilename, 0);
		bgEvent.InitTree(0);
		
		int nDataBg=bgEvent.tree_->GetEntries();
		
		for (int evt=0; evt<nDataBg; ++evt) 
		{
			bgEvent.tree_->GetEntry(evt);
			Double_t pho1Pt = bgEvent.pho1_.Pt();
			Double_t jet1Pt = bgEvent.jet1_.Pt();
			Double_t met = bgEvent.met_;
			Double_t metPhi = bgEvent.metPhi_;
			Double_t nphotons = bgEvent.nphotons_;
			Double_t ncosmics = bgEvent.ncosmics_;
			Double_t phoPassEleVeto = bgEvent.phoPassEleVeto_a1_;
			Double_t jet1Pt = bgEvent.jet1_.Pt();
			Double_t nlep = bgEvent.nlep_;
			Double_t pho1Eta = bgEvent.pho1_.Eta();
			Double_t pho1Phi = bgEvent.pho1_.Phi();
			Double_t phoIsTrigger = bgEvent.phoIsTrigger_a1_;
			Double_t phoLeadTimeSpan = bgEvent.phoLeadTimeSpan_a1_;
			Double_t phoCoviEtaiEta = bgEvent.phoCoviEtaiEta_a1_;
			Double_t phoCoviPhiiPhi = bgEvent.phoCoviPhiiPhi_a1_;
			Double_t phoMipIsHalo = bgEvent.phoMipIsHalo_a1_;
			Double_t phoSeedTime = bgEvent.phoSeedTime_a1_;
			
			Double_t deltaPhi = TMath::ACos(TMath::Cos(pho1Phi - metPhi));
			
			if (TMath::Abs(pho1Eta)<1.479 && met>140 && pho1Pt>160 && nphotons>0 && phoPassEleVeto>0 && phoIsTrigger==1 && TMath::Abs(phoLeadTimeSpan) < 8. && phoCoviEtaiEta > 0.001 && phoCoviPhiiPhi > 0.001 && phoMipIsHalo == 0 && phoSeedTime > -1.5 && nlep==0 && ncosmics==0 && jet1Pt<100) bg_hist->Fill(deltaPhi, bgWeight);			
		}	
	}
	
	Double_t sigTot = sig_hist->Integral();
	Double_t bgTot = bg_hist->Integral();
	
	Double_t signifTot = sigTot/TMath::Sqrt(bgTot);
	Double_t signifTarget = 0.25*signifTot;
	
	Int_t reduced=0;

// The strange limits in the for loop are a messy hack to get the integral to work out. Since hist->Integral(a,b)
// integrates from BIN a to BIN b (bin numbers instead of values of the x-axis), I choose to work from bin 64
// (an angle cut of 3.2) to bin 40 (an angle cut of 2).

	for (int i=64; i>=40; i--)
	{
		Double_t sigcount = sig_hist->Integral(0, i);
		Double_t bgcount = bg_hist->Integral(0, i);
		if (bgcount>0)
		{
			Double_t significance = sigcount/TMath::Sqrt(bgcount);
//			cout<<"At a phi cut of "<<sig_hist->GetBinCenter(i)+0.025<<" the significance is "<<significance<<", which is a fraction "<<significance/signifTot<<" of max."<<endl;
			if (significance<signifTarget && reduced==0)
			{
				cout<<"The signal significance is reduced to one-fourth of its uncut value at a phi cut of "<<sig_hist->GetBinCenter(i)+0.025<<endl;
				reduced=1;
			}
			signifhist->Fill(sig_hist->GetBinCenter(i), significance);
		}
	}
	
	signifhist->SetStats(kFALSE);
	signifhist->GetXaxis()->SetTitle("Maximum #Delta#phi");
	signifhist->GetYaxis()->SetTitle("Signal Significance");
	signifhist->Draw();
	c1->Print(TString("Blinding_") + TString(sigLine) + TString(".pdf"));
}
Example #24
0
void setStyle(){

//Style//

  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");

// For the canvas:
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasColor(kWhite);
  tdrStyle->SetCanvasDefH(600); //Height of canvas
  tdrStyle->SetCanvasDefW(600); //Width of canvas
  tdrStyle->SetCanvasDefX(0);   //POsition on screen
  tdrStyle->SetCanvasDefY(0);

// For the Pad:
  tdrStyle->SetPadBorderMode(0);
  tdrStyle->SetPadColor(kWhite);
  tdrStyle->SetPadGridX(false);
  tdrStyle->SetPadGridY(false);
  tdrStyle->SetGridColor(0);
  tdrStyle->SetGridStyle(3);
  tdrStyle->SetGridWidth(1);

// For the frame:
  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetFrameBorderSize(1);
  tdrStyle->SetFrameFillColor(0);
  tdrStyle->SetFrameFillStyle(0);
  tdrStyle->SetFrameLineColor(1);
  tdrStyle->SetFrameLineStyle(1);
  tdrStyle->SetFrameLineWidth(1);

  tdrStyle->SetPadTopMargin(0.05);
  tdrStyle->SetPadBottomMargin(0.13);
  tdrStyle->SetPadLeftMargin(0.16);
  tdrStyle->SetPadRightMargin(0.02);

// For the Global title:

  tdrStyle->SetOptTitle(0);
  tdrStyle->SetTitleFont(42);
  tdrStyle->SetTitleColor(1);
  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(10);
  tdrStyle->SetTitleFontSize(0.05);

// For the axis titles:

  tdrStyle->SetTitleColor(1, "XYZ");
  tdrStyle->SetTitleFont(42, "XYZ");
  tdrStyle->SetTitleSize(0.06, "XYZ");
  tdrStyle->SetTitleXOffset(0.9);
  tdrStyle->SetTitleYOffset(0.9);

// For the axis labels:

  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelFont(42, "XYZ");
  tdrStyle->SetLabelOffset(0.007, "XYZ");
  tdrStyle->SetLabelSize(0.05, "XYZ");

// For the axis:

  tdrStyle->SetAxisColor(1, "XYZ");
  //tdrStyle->SetStripDecimals(kTRUE);
  tdrStyle->SetTickLength(0.03, "XYZ");
  tdrStyle->SetNdivisions(510, "XYZ");
  tdrStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  tdrStyle->SetPadTickY(1);

  tdrStyle->SetPaperSize(20.,20.);

  tdrStyle->SetHatchesLineWidth(5);
  tdrStyle->SetHatchesSpacing(0.05);

  tdrStyle->SetOptStat(0);

  tdrStyle->cd();
}
Example #25
0
void setTDRStyle() {
  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");

// For the canvas:
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasColor(kWhite);
  tdrStyle->SetCanvasDefH(600); //Height of canvas
  tdrStyle->SetCanvasDefW(600); //Width of canvas
  tdrStyle->SetCanvasDefX(0);   //POsition on screen
  tdrStyle->SetCanvasDefY(0);

// For the Pad:
  tdrStyle->SetPadBorderMode(0);
  // tdrStyle->SetPadBorderSize(Width_t size = 1);
  tdrStyle->SetPadColor(kWhite);
  tdrStyle->SetPadGridX(false);
  tdrStyle->SetPadGridY(false);
  tdrStyle->SetGridColor(0);
  tdrStyle->SetGridStyle(3);
  tdrStyle->SetGridWidth(1);

// For the frame:
  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetFrameBorderSize(1);
  tdrStyle->SetFrameFillColor(0);
  tdrStyle->SetFrameFillStyle(0);
  tdrStyle->SetFrameLineColor(1);
  tdrStyle->SetFrameLineStyle(1);
  tdrStyle->SetFrameLineWidth(1);


//For the date:
  tdrStyle->SetOptDate(0);
  // tdrStyle->SetDateX(Float_t x = 0.01);
  // tdrStyle->SetDateY(Float_t y = 0.01);

// For the statistics box:
  tdrStyle->SetOptFile(11);
  tdrStyle->SetOptStat(11111111);

// For the Global title:

  tdrStyle->SetOptTitle(0);
  tdrStyle->SetTitleFont(42);
  tdrStyle->SetTitleColor(1);
  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(10);
  tdrStyle->SetTitleFontSize(0.05);

// For the axis titles:

  tdrStyle->SetTitleColor(1, "XYZ");
  tdrStyle->SetTitleFont(42, "XYZ");
  tdrStyle->SetTitleSize(0.06, "XYZ");
  // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
  // tdrStyle->SetTitleYSize(Float_t size = 0.02);
  tdrStyle->SetTitleXOffset(0.7);
  tdrStyle->SetTitleYOffset(0.7);
  // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset

// For the axis labels:

  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelFont(42, "XYZ");
  tdrStyle->SetLabelOffset(0.007, "XYZ");
  tdrStyle->SetLabelSize(0.03, "XYZ");

// For the axis:

  tdrStyle->SetAxisColor(1, "XYZ");
  tdrStyle->SetStripDecimals(kTRUE);
  tdrStyle->SetTickLength(0.03, "XYZ");
  tdrStyle->SetNdivisions(510, "XYZ");
  tdrStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  tdrStyle->SetPadTickY(1);

  tdrStyle->cd();

}
Example #26
0
void met(){

  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");

  // For the canvas:
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasColor(kWhite);
  tdrStyle->SetCanvasDefH(600); //Height of canvas
  tdrStyle->SetCanvasDefW(600); //Width of canvas
  tdrStyle->SetCanvasDefX(0);   //POsition on screen
  tdrStyle->SetCanvasDefY(0);

  // For the Pad:
  tdrStyle->SetPadBorderMode(0);
  // tdrStyle->SetPadBorderSize(Width_t size = 1);
  tdrStyle->SetPadColor(kWhite);
  tdrStyle->SetPadGridX(true);
  tdrStyle->SetPadGridY(true);
  tdrStyle->SetGridColor(0);
  tdrStyle->SetGridStyle(3);
  tdrStyle->SetGridWidth(1);

  // For the frame:
  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetFrameBorderSize(1);
  tdrStyle->SetFrameFillColor(0);
  tdrStyle->SetFrameFillStyle(0);
  tdrStyle->SetFrameLineColor(1);
  tdrStyle->SetFrameLineStyle(1);
  tdrStyle->SetFrameLineWidth(1);

  // For the histo:
  // tdrStyle->SetHistFillColor(1);
  // tdrStyle->SetHistFillStyle(0);
  tdrStyle->SetHistLineColor(1);
  tdrStyle->SetHistLineStyle(0);
  tdrStyle->SetHistLineWidth(1);
  // tdrStyle->SetLegoInnerR(Float_t rad = 0.5);
  // tdrStyle->SetNumberContours(Int_t number = 20);

  tdrStyle->SetEndErrorSize(2);
  //  tdrStyle->SetErrorMarker(20);
  tdrStyle->SetErrorX(0.);

  tdrStyle->SetMarkerStyle(20);

  //For the fit/function:
  tdrStyle->SetOptFit(1);
  tdrStyle->SetFitFormat("5.4g");
  tdrStyle->SetFuncColor(2);
  tdrStyle->SetFuncStyle(1);
  tdrStyle->SetFuncWidth(1);

  //For the date:
  tdrStyle->SetOptDate(0);
  // tdrStyle->SetDateX(Float_t x = 0.01);
  // tdrStyle->SetDateY(Float_t y = 0.01);

  // For the statistics box:
  tdrStyle->SetOptFile(0);
  tdrStyle->SetOptStat("emr"); // To display the mean and RMS:   SetOptStat("mr");
  tdrStyle->SetStatColor(kWhite);
  tdrStyle->SetStatFont(42);
  tdrStyle->SetStatFontSize(0.025);
  tdrStyle->SetStatTextColor(1);
  tdrStyle->SetStatFormat("6.4g");
  tdrStyle->SetStatBorderSize(1);
  tdrStyle->SetStatH(0.1);
  tdrStyle->SetStatW(0.15);
  // tdrStyle->SetStatStyle(Style_t style = 1001);
  // tdrStyle->SetStatX(Float_t x = 0);
  // tdrStyle->SetStatY(Float_t y = 0);

  // Margins:
  tdrStyle->SetPadTopMargin(0.07);
  tdrStyle->SetPadBottomMargin(0.13);
  tdrStyle->SetPadLeftMargin(0.13);
  tdrStyle->SetPadRightMargin(0.05);

  // For the Global title:
  //tdrStyle->SetOptTitle(0);
  tdrStyle->SetTitleFont(35);
  tdrStyle->SetTitleColor(1);
  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(10);
  tdrStyle->SetTitleFontSize(0.045);
  // tdrStyle->SetTitleH(0); // Set the height of the title box
  // tdrStyle->SetTitleW(0); // Set the width of the title box
  tdrStyle->SetTitleX(0.15); // Set the position of the title box
  // tdrStyle->SetTitleY(0.985); // Set the position of the title box
  // tdrStyle->SetTitleStyle(Style_t style = 1001);
  tdrStyle->SetTitleBorderSize(0);

  // For the axis titles:
  tdrStyle->SetTitleColor(1, "XYZ");
  tdrStyle->SetTitleFont(42, "XYZ");
  tdrStyle->SetTitleSize(0.04, "XYZ");
  // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
  // tdrStyle->SetTitleYSize(Float_t size = 0.02);
  tdrStyle->SetTitleXOffset(1.05);
  tdrStyle->SetTitleYOffset(1.45);
  // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset

  // For the axis labels:
  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelFont(42, "XYZ");
  tdrStyle->SetLabelOffset(0.007, "XYZ");
  tdrStyle->SetLabelSize(0.03, "XYZ");

  // For the axis:
  tdrStyle->SetAxisColor(1, "XYZ");
  tdrStyle->SetStripDecimals(kTRUE);
  tdrStyle->SetTickLength(0.03, "XYZ");
  tdrStyle->SetNdivisions(510, "XYZ");
  tdrStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  tdrStyle->SetPadTickY(1);

  // Change for log plots:
  tdrStyle->SetOptLogx(0);
  tdrStyle->SetOptLogy(0);
  tdrStyle->SetOptLogz(0);

  // Postscript options:
  tdrStyle->SetPaperSize(20.,20.);
  // tdrStyle->SetLineScalePS(Float_t scale = 3);
  // tdrStyle->SetLineStyleString(Int_t i, const char* text);
  // tdrStyle->SetHeaderPS(const char* header);
  // tdrStyle->SetTitlePS(const char* pstitle);

  //tdrStyle->SetBarOffset(Float_t baroff = 0.5);
  //tdrStyle->SetBarWidth(Float_t barwidth = 0.5);
  //tdrStyle->SetPaintTextFormat(const char* format = "g");
  tdrStyle->SetPalette(1);
  //tdrStyle->SetTimeOffset(Double_t toffset);
  //tdrStyle->SetHistMinimumZero(kTRUE);



  const Int_t NRGBs = 5;
  const Int_t NCont = 255;

  Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
  Double_t red[NRGBs]   = { 0.00, 0.00, 0.87, 1.00, 0.51 };
  Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
  Double_t blue[NRGBs]  = { 0.51, 1.00, 0.12, 0.00, 0.00 };
  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
  tdrStyle->SetNumberContours(NCont);

  gROOT -> ForceStyle();

  tdrStyle->cd();
  gStyle->SetOptStat(kFALSE);

  TFile *f_sig = new TFile("../../rootFiles/higgsHistograms_susyHiggs.root","READ");
  f_sig->cd("Analyzer");  
  TH1F *h_sig_pf   = new TH1F("h_sig_pf","h_sig_pf;Events;MET [GeV]",200,0,200);
  TH1F *h_sig_gen  = new TH1F("h_sig_gen","h_sig_gen;MET [GeV]; Events",200,0,200);
  TH1F *h_sig_min  = new TH1F("h_sig_min","h_sig_min",200,0,200);
 
  AnalyzerTree->Draw("sum_genPt>>h_sig_gen","","");
  h_sig_gen->SetTitle("");
  h_sig_gen->SetLineColor(1);
  h_sig_gen->SetLineWidth(2);

  AnalyzerTree->Draw("MET>>h_sig_pf","","");
  h_sig_pf->SetLineColor(4);
  h_sig_pf->SetLineWidth(2);

  AnalyzerTree->Draw("minMET>>h_sig_min","","");
  h_sig_min->SetLineColor(2);
  h_sig_min->SetLineWidth(2);

  h_sig_gen->Draw();
  h_sig_pf->Draw("sames");
  h_sig_min->Draw("sames");

  TLegend *leg = new TLegend(0.6879195,0.7482517,0.9496644,0.9300699,NULL,"brNDC");

  leg->AddEntry(h_sig_gen,"Generated MET","l");
  leg->AddEntry(h_sig_pf,"PFMET","l");//"DM_M10_V x 10000","l");                     
  leg->AddEntry(h_sig_min,"Minimized MET","l");
  leg->SetFillColor(0);
  leg->SetShadowColor(0);
  leg->Draw();


}
Example #27
0
void LatinoStyle2()
{
  TStyle* GloStyle;
  GloStyle = gStyle;

  TStyle* LatinosStyle = new TStyle("LatinosStyle", "LatinosStyle");
  gStyle = LatinosStyle;


  //----------------------------------------------------------------------------
  // Canvas
  //----------------------------------------------------------------------------
  LatinosStyle->SetCanvasBorderMode(  0);
  LatinosStyle->SetCanvasBorderSize( 10);
  LatinosStyle->SetCanvasColor     (  0);
  LatinosStyle->SetCanvasDefH      (794);
  LatinosStyle->SetCanvasDefW      (550);
  LatinosStyle->SetCanvasDefX      ( 10);
  LatinosStyle->SetCanvasDefY      ( 10);


  //----------------------------------------------------------------------------
  // Pad
  //----------------------------------------------------------------------------
  LatinosStyle->SetPadBorderMode  (   0);
  LatinosStyle->SetPadBorderSize  (  10);
  LatinosStyle->SetPadColor       (   0);
  LatinosStyle->SetPadBottomMargin(0.20);
  LatinosStyle->SetPadTopMargin   (0.08);
  LatinosStyle->SetPadLeftMargin  (0.18);
  LatinosStyle->SetPadRightMargin (0.05);


  //----------------------------------------------------------------------------
  // Frame
  //----------------------------------------------------------------------------
  LatinosStyle->SetFrameFillStyle ( 0);
  LatinosStyle->SetFrameFillColor ( 0);
  LatinosStyle->SetFrameLineColor ( 1);
  LatinosStyle->SetFrameLineStyle ( 0);
  LatinosStyle->SetFrameLineWidth ( 2);
  LatinosStyle->SetFrameBorderMode( 0);
  LatinosStyle->SetFrameBorderSize(10);


  //----------------------------------------------------------------------------
  // Hist
  //----------------------------------------------------------------------------
  LatinosStyle->SetHistFillColor(0);
  LatinosStyle->SetHistFillStyle(1);
  LatinosStyle->SetHistLineColor(1);
  LatinosStyle->SetHistLineStyle(0);
  LatinosStyle->SetHistLineWidth(1);


  //----------------------------------------------------------------------------
  // Axis
  //----------------------------------------------------------------------------
  LatinosStyle->SetLabelFont  (   42, "xyz");
  LatinosStyle->SetLabelOffset(0.015, "xyz");
  LatinosStyle->SetLabelSize  (0.050, "xyz");
  LatinosStyle->SetNdivisions (  505, "xyz");
  LatinosStyle->SetTitleFont  (   42, "xyz");
  LatinosStyle->SetTitleSize  (0.050, "xyz");

  //  LatinosStyle->SetNdivisions ( -503, "y");

  LatinosStyle->SetTitleOffset(  1.4,   "x");
  LatinosStyle->SetTitleOffset(  1.2,   "y");
  LatinosStyle->SetPadTickX   (           1);  // Tick marks on the opposite side of the frame
  LatinosStyle->SetPadTickY   (           1);  // Tick marks on the opposite side of the frame


  //----------------------------------------------------------------------------
  // Title
  //----------------------------------------------------------------------------
  LatinosStyle->SetTitleBorderSize(    0);
  LatinosStyle->SetTitleFillColor (   10);
  LatinosStyle->SetTitleAlign     (   12);
  LatinosStyle->SetTitleFontSize  (0.045);
  LatinosStyle->SetTitleX         (0.590);
  LatinosStyle->SetTitleY         (0.830);

  LatinosStyle->SetTitleFont(42, "");


  //----------------------------------------------------------------------------
  // Stat
  //----------------------------------------------------------------------------
//   LatinosStyle->SetOptStat       (1110);
  LatinosStyle->SetOptStat       (   0);
  LatinosStyle->SetStatBorderSize(   0);
  LatinosStyle->SetStatColor     (  10);
  LatinosStyle->SetStatFont      (  42);
  LatinosStyle->SetStatX         (0.94);
  LatinosStyle->SetStatY         (0.91);

  const Int_t NRGBs = 5;
  const Int_t NCont = 255;

  Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
  Double_t red[NRGBs]   = { 0.00, 0.00, 0.87, 1.00, 0.51 };
  Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
  Double_t blue[NRGBs]  = { 0.51, 1.00, 0.12, 0.00, 0.00 };
  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
  LatinosStyle->SetNumberContours(NCont);

  return;
}
Example #28
0
TCanvas *trackSplitPlot(Int_t nFiles,TString *files,TString *names,TString xvar,TString yvar,
                     Bool_t relative = kFALSE,Bool_t logscale = kFALSE,Bool_t resolution = kFALSE,Bool_t pull = kFALSE,
                     TString saveas = "")
{
    cout << xvar << " " << yvar << endl;
    if (xvar == "" && yvar == "")
        return 0;

    PlotType type;
    if (xvar == "")      type = Histogram;
    else if (yvar == "") type = OrgHistogram;
    else if (resolution) type = Resolution;
    else if (nFiles < 1) type = ScatterPlot;
    else                 type = Profile;
    if (nFiles < 1) nFiles = 1;

    const Int_t n = nFiles;
    
    TStyle *tdrStyle = setTDRStyle();
    tdrStyle->SetOptStat(0);
    if ((type == Histogram || type == OrgHistogram) && nFiles == 1)
        tdrStyle->SetOptStat(1110);
    if (type == ScatterPlot || (type == Histogram && !pull) || xvar == "runNumber")
    {
        tdrStyle->SetCanvasDefW(678);
        tdrStyle->SetPadRightMargin(0.115);
    }

    Bool_t nHits = (xvar[0] == 'n' && xvar[1] == 'H' && xvar[2] == 'i'
                                   && xvar[3] == 't' && xvar[4] == 's');

    Int_t nBinsScatterPlotx = binsScatterPlotx;
    Int_t nBinsScatterPloty = binsScatterPloty;
    Int_t nBinsHistogram = binsHistogram;
    Int_t nBinsProfileResolution = binsProfileResolution;
    if (xvar == "runNumber")
    {
        nBinsProfileResolution = runNumberBins;
        nBinsHistogram = runNumberBins;
    }
    if (nHits)
    {
        nBinsHistogram = (int)(findMax(nFiles,files,xvar,'x') - findMin(nFiles,files,xvar,'x') + 1.1);     //in case it's .99999
        nBinsScatterPlotx = nBinsHistogram;
        nBinsProfileResolution = nBinsHistogram;
    }

    TH1 **p = new TH1*[n];
    Int_t lengths[n];

    stringstream sx,sy,srel,ssigma1,ssigma2,ssigmaorg;

    sx << xvar << "_org";
    TString xvariable = sx.str();
    TString xvariable2 = "";
    if (xvar == "runNumber") xvariable = "runNumber";
    if (nHits)
    {
        xvariable  = xvar;
        xvariable2 = xvar;
        xvariable.Append("1_spl");
        xvariable2.Append("2_spl");
    }

    sy << "Delta_" << yvar;
    TString yvariable = sy.str();

    TString relvariable = "1";
    if (relative)
    {
        srel << yvar << "_org";
        relvariable = srel.str();
    }

    TString sigma1variable = "",sigma2variable = "";
    if (pull)
    {
        ssigma1 << yvar << "1Err_spl";
        ssigma2 << yvar << "2Err_spl";
    }
    sigma1variable = ssigma1.str();
    sigma2variable = ssigma2.str();

    TString sigmaorgvariable = "";
    if (pull && relative)
        ssigmaorg << yvar << "Err_org";
    sigmaorgvariable = ssigmaorg.str();


    Double_t xmin = -1,xmax = 1,ymin = -1,ymax = 1;
    if (type == Profile || type == ScatterPlot || type == OrgHistogram || type == Resolution)
        axislimits(nFiles,files,xvar,'x',relative,pull,xmin,xmax);
    if (type == Profile || type == ScatterPlot || type == Histogram || type == Resolution)
        axislimits(nFiles,files,yvar,'y',relative,pull,ymin,ymax);

    TString meansrmss[n];

    for (Int_t i = 0; i < n; i++)
    {
        TFile *f = TFile::Open(files[i]);
        TTree *tree = (TTree*)f->Get("splitterTree");

        stringstream sid;
        sid << "p" << i;
        TString id = sid.str();

        TH1F **q = new TH1F*[nBinsProfileResolution];
        if (type == ScatterPlot)
            p[i] = new TH2F(id,"",nBinsScatterPlotx,xmin,xmax,nBinsScatterPloty,ymin,ymax);
        if (type == Histogram)
            p[i] = new TH1F(id,"",nBinsHistogram,ymin,ymax);
        if (type == OrgHistogram)
            p[i] = new TH1F(id,"",nBinsHistogram,xmin,xmax);
        if (type == Resolution || type == Profile)
        {
            p[i] = new TH1F(id,"",nBinsProfileResolution,xmin,xmax);
            for (Int_t j = 0; j < nBinsProfileResolution; j++)
            {
                stringstream sid2;
                sid2 << "q" << j;
                TString id2 = sid2.str();
                q[j] = new TH1F(id2,"",nBinsHistogram,ymin,ymax);
            }
        }
        p[i]->SetDirectory(0);

        lengths[i] = tree->GetEntries();

        if (files[i].Contains("MC") && xvar == "runNumber")
        {
            p[i]->SetLineColor(kWhite);
            p[i]->SetMarkerColor(kWhite);
            f->Close();
            continue;
        }

        Double_t x = 0, y = 0, rel = 1, sigma1 = 1, sigma2 = 1,           //if !pull, we want to divide by sqrt(2) because we want the error from 1 track
                                                  sigmaorg = 0;
        Int_t xint = 0, xint2 = 0;
        Int_t runNumber = 0;

        if (!relative && !pull && (yvar == "dz" || yvar == "dxy"))
            rel = 1e-4;                                     //it's in cm but we want it in um, so divide by 1e-4

        tree->SetBranchAddress("runNumber",&runNumber);
        if (type == Profile || type == ScatterPlot || type == Resolution || type == OrgHistogram)
        {
            if (xvar == "runNumber")
                tree->SetBranchAddress(xvariable,&xint);
            else if (nHits)
            {
                tree->SetBranchAddress(xvariable,&xint);
                tree->SetBranchAddress(xvariable2,&xint2);
            }
            else
                tree->SetBranchAddress(xvariable,&x);
        }
        if (type == Profile || type == ScatterPlot || type == Resolution || type == Histogram)
            tree->SetBranchAddress(yvariable,&y);
        if (relative && xvar != yvar)                       //if xvar == yvar, setting the branch here will undo setting it to x 2 lines earlier
            tree->SetBranchAddress(relvariable,&rel);
        if (pull)
        {
            tree->SetBranchAddress(sigma1variable,&sigma1);
            tree->SetBranchAddress(sigma2variable,&sigma2);
        }
        if (relative && pull)
            tree->SetBranchAddress(sigmaorgvariable,&sigmaorg);
   
        Int_t notincluded = 0;

        for (Int_t j = 0; j<lengths[i]; j++)
        {
            tree->GetEntry(j);
            if (xvar == "runNumber" || nHits)
                x = xint;
            if (xvar == "runNumber")
                runNumber = x;
            if (runNumber < minrun || (runNumber > maxrun && maxrun > 0)) 
            {
                notincluded++;
                continue;
            }
            if (relative && xvar == yvar)
            {
                rel = x;
            }
            Double_t error = 0;
            if (relative && pull)
                error = sqrt((sigma1/rel)*(sigma1/rel) + (sigma2/rel)*(sigma2/rel) + (sigmaorg*y/(rel*rel))*(sigmaorg*x/(rel*rel)));
            else
                error = sqrt(sigma1 * sigma1 + sigma2 * sigma2);   // = sqrt(2) if !pull, to get the error in 1 track
            y /= (rel * error);

            if (logscale)
                y = fabs(y);
            if (ymin <= y && y < ymax && xmin <= x && x < xmax)
            {
                if (type == Histogram)
                    p[i]->Fill(y);
                if (type == ScatterPlot)
                    p[i]->Fill(x,y);
                if (type == Resolution || type == Profile)
                {
                    int which = (p[i]->Fill(x,0)) - 1;
                    if (which >= 0) q[which]->Fill(y);         //get which q[j] by filling p[i] (with nothing), which returns the bin number
                }
                if (type == OrgHistogram)
                    p[i]->Fill(x);
            }

            if (nHits)
            {
                x = xint2;
                if (ymin <= y && y < ymax && xmin <= x && x < xmax)
                {
                    if (type == Histogram)
                        p[i]->Fill(y);
                    if (type == ScatterPlot)
                        p[i]->Fill(x,y);
                    if (type == Resolution || type == Profile)
                    {
                        int which = (p[i]->Fill(x,0)) - 1;
                        if (which >= 0) q[which]->Fill(y);         //get which q[j] by filling p[i] (with nothing), which returns the bin number
                    }
                    if (type == OrgHistogram)
                        p[i]->Fill(x);
                }
            }

            if (((j+1)/(int)(pow(10,(int)(log10(lengths[i]))-1)))*(int)(pow(10,(int)(log10(lengths[i]))-1)) == j + 1 || j + 1 == lengths[i])
            {
                cout << j + 1 << "/" << lengths[i] << ": "; 
                if (type == Profile || type == ScatterPlot || type == Resolution)
                    cout << x << ", " << y << endl;
                if (type == OrgHistogram)
                    cout << x << endl;
                if (type == Histogram)
                    cout << y << endl;
            }
        }
        lengths[i] -= notincluded;

        meansrmss[i] = "";
        if (type == Histogram || type == OrgHistogram)
        {
            cout << "Average = " << p[i]->GetMean() << endl;
            cout << "RMS     = " << p[i]->GetRMS()  << endl;
            stringstream meanrms;
            meanrms.precision(3);
            meanrms << "#mu=" << p[i]->GetMean() << ", #sigma=" << p[i]->GetRMS();
            meansrmss[i] = meanrms.str();
        }

        if (type == Resolution)
        {
            for (Int_t j = 0; j < nBinsProfileResolution; j++)
            {
                p[i]->SetBinContent(j+1,q[j]->GetRMS());
                p[i]->SetBinError  (j+1,q[j]->GetRMSError());
                delete q[j];
            }
        }

        if (type == Profile)
        {
            for (Int_t j = 0; j < nBinsProfileResolution; j++)
            {
                p[i]->SetBinContent(j+1,q[j]->GetMean());
                p[i]->SetBinError  (j+1,q[j]->GetMeanError());
                delete q[j];
            }
        }
        delete[] q;

        setAxisLabels(p[i],type,xvar,yvar,relative,pull);

        p[i]->SetLineColor(colors[i]);
        if (type == Resolution || type == Profile)
        {
            p[i]->SetMarkerColor(colors[i]);
            p[i]->SetMarkerStyle(20+i);
        }
        else
        {
            p[i]->SetMarkerStyle(1);
        }
        f->Close();
    }

    TCanvas *c1 = TCanvas::MakeDefCanvas();
    if (type == ScatterPlot || type == Profile || type == Resolution || type == OrgHistogram)
        c1->SetLogy((Bool_t)(logscale));
    if (type == Histogram)
        c1->SetLogx((Bool_t)(logscale));

    TH1 *maxp = p[0];
    TGraphErrors *g[n];
    TMultiGraph *list = new TMultiGraph();
    if (type == ScatterPlot)
        p[0]->Draw("COLZ");
    else if (type == Resolution || type == Profile)
    {
        for (Int_t i = 0; i < n; i++)
        {
            if (files[i].Contains("MC") && xvar == "runNumber")
                continue;
            g[i] = new TGraphErrors(p[i]);
            for (Int_t j = 0; j < g[i]->GetN(); j++)
            {
                if (g[i]->GetY()[j] == 0 && g[i]->GetEY()[j] == 0)
                {
                    g[i]->RemovePoint(j);
                    j--;
                }
            }
            list->Add(g[i]);
        }
        list->Draw("AP");
        Double_t yaxismax = list->GetYaxis()->GetXmax();
        Double_t yaxismin = list->GetYaxis()->GetXmin();
        if (yaxismin > 0)
        {
            yaxismax += yaxismin;
            yaxismin = 0;
        }
        p[0]->GetYaxis()->SetRangeUser(yaxismin,yaxismax);
        p[0]->Draw("P");
    }
    else if (type == Histogram || type == OrgHistogram)
    {
        Bool_t allthesame = true;
        for (Int_t i = 1; i < n && allthesame; i++)
        {
            if (lengths[i] != lengths[0])
                allthesame = false;
        }
        if (!allthesame && xvar != "runNumber")
            for (Int_t i = 0; i < n; i++)
            {
                p[i]->Scale(1.0/lengths[i]);
            }
        maxp = (TH1F*)p[0]->Clone("maxp");
        maxp->SetLineColor(kWhite);
        for (Int_t i = 1; i <= maxp->GetNbinsX(); i++)
        {
            for (Int_t j = 0; j < n; j++)
            {
                if (files[j].Contains("MC") && xvar == "runNumber")
                    continue;
                maxp->SetBinContent(i,TMath::Max(maxp->GetBinContent(i),p[j]->GetBinContent(i)));
            }
        }
        maxp->Draw();
        p[0]->Draw("same");
    }
    TLegend *legend = new TLegend(.6,.7,.9,.9,"","br");
    if (n == 1 && files[0].Contains("MC") && xvar == "runNumber")
    {
        placeholder(saveas,yvar == "");
        return 0;
    }
    if (n>=2)
    {
        if (!(files[0].Contains("MC") && xvar == "runNumber") && files[0] != "")
        {
            if (type == Resolution || type == Profile)
                legend->AddEntry(p[0],names[0],"pl");
            else if (type == Histogram || type == OrgHistogram)
            {
                legend->AddEntry(p[0],names[0],"l");
                legend->AddEntry((TObject*)0,meansrmss[0],"");
            }
        }
        for (Int_t i = 1; i < n; i++)
        {
            if (files[i].Contains("MC") && xvar == "runNumber")
                continue;
            if (type == Resolution || type == Profile)
            {
                p[i]->Draw("same P");
                legend->AddEntry(p[i],names[i],"pl");
            }
            else if (type == Histogram || type == OrgHistogram)
            {
                p[i]->Draw("same");
                legend->AddEntry(p[i],names[i],"l");
                legend->AddEntry((TObject*)0,meansrmss[i],"");
            }
        }

        if (legend->GetListOfPrimitives()->At(0) == 0)
        {
            delete legend;
            placeholder(saveas,yvar == "");
            return 0;
        }

        
        c1->Update();
        Double_t x1min  = .98*gPad->GetUxmin() + .02*gPad->GetUxmax();
        Double_t x2max  = .02*gPad->GetUxmin() + .98*gPad->GetUxmax();
        Double_t y1min  = .98*gPad->GetUymin() + .02*gPad->GetUymax();
        Double_t y2max  = .02*gPad->GetUymin() + .98*gPad->GetUymax();
        Double_t width  = .4*(x2max-x1min);
        Double_t height = (1./20)*legend->GetListOfPrimitives()->GetEntries()*(y2max-y1min);
        if (type == Histogram || type == OrgHistogram)
        {
            width *= 2;
            height /= 2;
            legend->SetNColumns(2);
        }
        Double_t newy2max = placeLegend(legend,width,height,x1min,y1min,x2max,y2max);
        maxp->GetYaxis()->SetRangeUser(gPad->GetUymin(),(newy2max-.02*gPad->GetUymin())/.98);
                
        legend->SetFillStyle(0);
        legend->Draw();
    }
    if (saveas != "")
    {
        saveplot(c1,saveas);
        for (int i = 0; i < n; i++)
        {
            //delete p[i];
            //delete g[i];
        }
        //delete list;
        //delete maxp;
        //delete legend;
    }
    return c1;
}
Example #29
0
void setTDRStyle() {
  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");

  // For the canvas:
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasColor(kWhite);
  tdrStyle->SetCanvasDefH(600); //Height of canvas
  tdrStyle->SetCanvasDefW(600); //Width of canvas
  tdrStyle->SetCanvasDefX(0);   //POsition on screen
  tdrStyle->SetCanvasDefY(0);

  // For the Pad:
  tdrStyle->SetPadBorderMode(0);
  // tdrStyle->SetPadBorderSize(Width_t size = 1);
  tdrStyle->SetPadColor(kWhite);
  tdrStyle->SetPadGridX(false);
  tdrStyle->SetPadGridY(false);
  tdrStyle->SetGridColor(0);
  tdrStyle->SetGridStyle(3);
  tdrStyle->SetGridWidth(1);


  // For the frame:
  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetFrameBorderSize(1);
  tdrStyle->SetFrameFillColor(0);
  tdrStyle->SetFrameFillStyle(0);
  tdrStyle->SetFrameLineColor(1);
  tdrStyle->SetFrameLineStyle(1);
  tdrStyle->SetFrameLineWidth(1);


  // For the histo:
  // tdrStyle->SetHistFillColor(1);
  // tdrStyle->SetHistFillStyle(0);
  tdrStyle->SetHistLineColor(1);
  tdrStyle->SetHistLineStyle(0);
  tdrStyle->SetHistLineWidth(1);
  // tdrStyle->SetLegoInnerR(Float_t rad = 0.5);
  // tdrStyle->SetNumberContours(Int_t number = 20);
  tdrStyle->SetEndErrorSize(2);
  //  tdrStyle->SetErrorMarker(20);
  //  tdrStyle->SetErrorX(0.);

  tdrStyle->SetMarkerStyle(20);

  //For the fit/function:
  tdrStyle->SetOptFit(1);
  tdrStyle->SetFitFormat("5.4g");
  tdrStyle->SetFuncColor(2);
  tdrStyle->SetFuncStyle(1);
  tdrStyle->SetFuncWidth(1);

  //For the date:
  tdrStyle->SetOptDate(0);
  // tdrStyle->SetDateX(Float_t x = 0.01);

  // tdrStyle->SetDateY(Float_t y = 0.01);

  // For the statistics box:
  tdrStyle->SetOptFile(0);
  tdrStyle->SetOptStat(0); // To display the mean and RMS:   SetOptStat("mr");
  tdrStyle->SetStatColor(kWhite);
  tdrStyle->SetStatFont(42);
  tdrStyle->SetStatFontSize(0.025);
  tdrStyle->SetStatTextColor(1);
  tdrStyle->SetStatFormat("6.4g");
  tdrStyle->SetStatBorderSize(1);
  tdrStyle->SetStatH(0.1);
  tdrStyle->SetStatW(0.15);
  // tdrStyle->SetStatStyle(Style_t style = 1001);
  // tdrStyle->SetStatX(Float_t x = 0);
  // tdrStyle->SetStatY(Float_t y = 0);

  // Margins:
  tdrStyle->SetPadTopMargin(0.05);
  tdrStyle->SetPadBottomMargin(0.13);
  tdrStyle->SetPadLeftMargin(0.16);
  tdrStyle->SetPadRightMargin(0.02);

  // For the Global title:

  tdrStyle->SetOptTitle(0);
  tdrStyle->SetTitleFont(42);
  tdrStyle->SetTitleColor(1);

  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(10);
  tdrStyle->SetTitleFontSize(0.05);
  // tdrStyle->SetTitleH(0); // Set the height of the title box
  // tdrStyle->SetTitleW(0); // Set the width of the title box
  // tdrStyle->SetTitleX(0); // Set the position of the title box
  // tdrStyle->SetTitleY(0.985); // Set the position of the title box
  // tdrStyle->SetTitleStyle(Style_t style = 1001);
  // tdrStyle->SetTitleBorderSize(2);

  // For the axis titles:

  tdrStyle->SetTitleColor(1, "XYZ");
  tdrStyle->SetTitleFont(42, "XYZ");
  tdrStyle->SetTitleSize(0.06, "XYZ");
  // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
  // tdrStyle->SetTitleYSize(Float_t size = 0.02);
  tdrStyle->SetTitleXOffset(0.9);
  tdrStyle->SetTitleYOffset(1.4);
  // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset



  // For the axis labels:

  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelFont(42, "XYZ");
  tdrStyle->SetTitleSize(0.06, "XYZ");
  // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
  // tdrStyle->SetTitleYSize(Float_t size = 0.02);
  tdrStyle->SetTitleXOffset(0.9);
  tdrStyle->SetTitleYOffset(1.4);
  // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset

  // For the axis labels:

  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelFont(42, "XYZ");
  tdrStyle->SetLabelOffset(0.007, "XYZ");
  tdrStyle->SetLabelSize(0.05, "XYZ");

  // For the axis:

  tdrStyle->SetAxisColor(1, "XYZ");
  tdrStyle->SetStripDecimals(kTRUE);
  tdrStyle->SetTickLength(0.03, "XYZ");
  tdrStyle->SetNdivisions(510, "XYZ");
  tdrStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  tdrStyle->SetPadTickY(1);

  // Change for log plots:
  tdrStyle->SetOptLogx(0);
  tdrStyle->SetOptLogy(0);
  tdrStyle->SetOptLogz(0);

  // Postscript options:
  tdrStyle->SetPaperSize(20.,20.);
  // tdrStyle->SetLineScalePS(Float_t scale = 3);
  // tdrStyle->SetLineStyleString(Int_t i, const char* text);
  // tdrStyle->SetHeaderPS(const char* header);
  // tdrStyle->SetTitlePS(const char* pstitle);

  // tdrStyle->SetBarOffset(Float_t baroff = 0.5);
  // tdrStyle->SetBarWidth(Float_t barwidth = 0.5);
  // tdrStyle->SetPaintTextFormat(const char* format = "g");
  // tdrStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
  // tdrStyle->SetTimeOffset(Double_t toffset);
  // tdrStyle->SetHistMinimumZero(kTRUE);

  tdrStyle->cd();

}
Example #30
0
// Create my custom FORMAL style
//********************************************************************//
void getMyStyle(void) {

    std::cout << " *** void getMyStyle(void) *** Custom  TStyle initialized!" << std::endl;
    TStyle *myStyle = new TStyle("myStyle","Style for AN09");

    // For the canvas:
    myStyle->SetCanvasBorderMode(0);
    myStyle->SetCanvasColor(kWhite);
    myStyle->SetCanvasDefH(600); //Height of canvas
    myStyle->SetCanvasDefW(600); //Width of canvas
    myStyle->SetCanvasDefX(0);   //POsition on screen
    myStyle->SetCanvasDefY(0);
    // For the Pad:
    myStyle->SetPadBorderMode(0);
    // myStyle->SetOptTitle(0); // delete histogram titles
    // myStyle->SetPadBorderSize(Width_t size = 1);
    myStyle->SetPadColor(kWhite);
    myStyle->SetPadGridX(true);
    myStyle->SetPadGridY(true);
    myStyle->SetGridColor(0);
    myStyle->SetGridStyle(3);
    myStyle->SetGridWidth(1);

    // For the frame:
    myStyle->SetFrameBorderMode(0);
    myStyle->SetFrameBorderSize(1);
    myStyle->SetFrameFillColor(0);
    myStyle->SetFrameFillStyle(0);
    myStyle->SetFrameLineColor(1);
    myStyle->SetFrameLineStyle(1);
    myStyle->SetFrameLineWidth(1);

    // For the histo:
    // myStyle->SetHistFillColor(1);
    // myStyle->SetHistFillStyle(0);
    myStyle->SetHistLineColor(1);
    myStyle->SetHistLineStyle(0);
    myStyle->SetHistLineWidth(1);
    // myStyle->SetLegoInnerR(Float_t rad = 0.5);
    // myStyle->SetNumberContours(Int_t number = 20);

    myStyle->SetEndErrorSize(2);
    //myStyle->SetErrorMarker(20);
    myStyle->SetErrorX(0.);

    myStyle->SetMarkerStyle(20);

    //For the fit/function:
    myStyle->SetOptFit(1);
    myStyle->SetFitFormat("5.4g");
    myStyle->SetFuncColor(2);
    myStyle->SetFuncStyle(1);
    myStyle->SetFuncWidth(1);

    //For the date:
    myStyle->SetOptDate(1);
    // myStyle->SetDateX(Float_t x = 0.01);
    // myStyle->SetDateY(Float_t y = 0.01);

    // For the statistics box:
    myStyle->SetOptFile(0);
    myStyle->SetOptStat("miourne"); // stats box
    myStyle->SetOptFit(1111); // fit box
    myStyle->SetStatColor(kWhite);
    myStyle->SetStatFont(42);
    myStyle->SetStatFontSize(0.025);
    myStyle->SetStatTextColor(1);
    myStyle->SetStatFormat("6.4g");
    myStyle->SetStatBorderSize(1);
    myStyle->SetStatH(0.1);
    myStyle->SetStatW(0.15);
    // myStyle->SetStatStyle(Style_t style = 1001);
    // myStyle->SetStatX(Float_t x = 0);
    // myStyle->SetStatY(Float_t y = 0);

    // Margins:
    myStyle->SetPadTopMargin(0.15);
    myStyle->SetPadBottomMargin(0.13);
    myStyle->SetPadLeftMargin(0.13);
    myStyle->SetPadRightMargin(0.15);

    // For the Global title:

    //  myStyle->SetOptTitle(0);
    myStyle->SetTitleFont(42);
    myStyle->SetTitleColor(1);
    myStyle->SetTitleTextColor(1);
    myStyle->SetTitleFillColor(10);
    myStyle->SetTitleFontSize(0.05);
    // myStyle->SetTitleH(0); // Set the height of the title box
    // myStyle->SetTitleW(0); // Set the width of the title box
    // myStyle->SetTitleX(0); // Set the position of the title box
    // myStyle->SetTitleY(0.985); // Set the position of the title box
    // myStyle->SetTitleStyle(Style_t style = 1001);
    // myStyle->SetTitleBorderSize(2);

    // For the axis titles:

    myStyle->SetTitleColor(1, "XYZ");
    myStyle->SetTitleFont(42, "XYZ");
    myStyle->SetTitleSize(0.06, "XYZ");
    // myStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
    // myStyle->SetTitleYSize(Float_t size = 0.02);
    myStyle->SetTitleXOffset(1.2);
    myStyle->SetTitleYOffset(1.2);
    myStyle->SetTitleOffset(1.2, "Y"); // Another way to set the Offset

    // For the axis labels:

    myStyle->SetLabelColor(1, "XYZ");
    myStyle->SetLabelFont(42, "XYZ");
    myStyle->SetLabelOffset(0.007, "XYZ");
    myStyle->SetLabelSize(0.05, "XYZ");

    // For the axis:
    myStyle->SetAxisColor(1, "XYZ");
    myStyle->SetStripDecimals(kTRUE);
    myStyle->SetTickLength(0.03, "XYZ");
    myStyle->SetNdivisions(510, "XYZ");
    myStyle->SetPadTickX(0);  // To get tick marks on the opposite side of the frame
    myStyle->SetPadTickY(0);

    // Change for log plots:
    myStyle->SetOptLogx(0);
    myStyle->SetOptLogy(0);
    myStyle->SetOptLogz(0);

    myStyle->SetPalette(1,0);

    // Postscript options:
    // myStyle->SetPaperSize(15.,15.);
    // myStyle->SetLineScalePS(Float_t scale = 3);
    // myStyle->SetLineStyleString(Int_t i, const char* text);
    // myStyle->SetHeaderPS(const char* header);
    // myStyle->SetTitlePS(const char* pstitle);

    // myStyle->SetBarOffset(Float_t baroff = 0.5);
    // myStyle->SetBarWidth(Float_t barwidth = 0.5);
    // myStyle->SetPaintTextFormat(const char* format = "g");
    // myStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
    // myStyle->SetTimeOffset(Double_t toffset);
    // myStyle->SetHistMinimumZero(kTRUE);

    myStyle->cd();

} //end of: void getMyStyle(void){