Example #1
0
void
avtContourPlot::SetAtts(const AttributeGroup *a)
{
    needsRecalculation =
        atts.ChangesRequireRecalculation(*(const ContourAttributes*)a);
    atts = *(const ContourAttributes*)a;

    if (atts.GetContourMethod() == ContourAttributes::Level)
    {
        numLevels = atts.GetContourNLevels();
    }
    else if (atts.GetContourMethod() == ContourAttributes::Value)
    {
        numLevels = (int)atts.GetContourValue().size();
    }
    else 
    {
        numLevels = (int)atts.GetContourPercent().size();
    }

    SetColors();
    SetLineWidth(atts.GetLineWidth());
    SetLineStyle(atts.GetLineStyle());
    SetLegend(atts.GetLegendFlag());
    if (atts.GetWireframe())
    {
        behavior->SetAntialiasedRenderOrder(ABSOLUTELY_LAST);
        levelsMapper->SetSpecularIsInappropriate(true);
    }
    else 
    {
        behavior->SetAntialiasedRenderOrder(DOES_NOT_MATTER);
        levelsMapper->SetSpecularIsInappropriate(false);
    }
}
Example #2
0
void drawLKT(TString& type, TString& ytitle, TString& xtitle, TString& head, TString &leg1, TString& leg2, TString& leg3, TString & leg4){

   TCanvas *c = new TCanvas(Form("%s",type.Data()), Form("%s",type.Data()) ,5,49,400,400);
   SetStyleCanvas(c);

   TGraphErrors *grae1 = new TGraphErrors();
   TGraphErrors *grae2 = new TGraphErrors();
   TGraphErrors *grae3 = new TGraphErrors();
   TGraphErrors *grae4 = new TGraphErrors();

   if( type.Contains("cEffLKTNCal")){
     SetEffLKTNCal(grae1, grae2, grae3, grae4);
   }

   SetStyleGraphErrors(grae1, 2, 20, 0, 0.81, ytitle, xtitle, 0.8, 1.02);
   SetStyleGraphErrors(grae2, 1, 21, 0, 0.81, ytitle, xtitle, 0.8, 1.02);
   SetStyleGraphErrors(grae3, 3, 22, 0, 0.81, ytitle, xtitle, 0.8, 1.02);
   SetStyleGraphErrors(grae4, 4, 23, 0, 0.81, ytitle, xtitle, 0.8, 1.02);

   grae1->Draw("AP");
   grae2->Draw("PSame");
   grae3->Draw("PSame");
   grae4->Draw("PSame");

   SetLegend(grae1, grae2, grae3, grae4, head, leg1, leg2, leg3, leg4,"PL","PL","PL","PL", 0.6, 0.58, 0.9, 0.81);
   SetLabel(0.6,0.88,36);
   c->Print(Form("%s.eps",type.Data()));
}
Example #3
0
void drawLKT(TString& type, TString& ytitle, TString& xtitle, TString& head, TString &leg1, TString& leg2){
   TCanvas *c = new TCanvas(Form("%s",type.Data()), Form("%s",type.Data()) ,5,49,400,400);
   SetStyleCanvas(c);

   TGraphErrors *grae1 = new TGraphErrors();
   TGraphErrors *grae2 = new TGraphErrors();

   if( type.Contains("cEffLKTrel") ){
     EffLKTIsoData(grae1);
     EffLKTIsoMC(grae2);
   }else if( type.Contains("cEffLKTtrk")){
     EffLKTTrkIsoData(grae1);
     EffLKTTrkIsoMC(grae2);
   }else if( type.Contains("cEffLKTPTrel")){
     SetEffLKTPt(grae2, grae1);
   }else if( type.Contains("cEffLKTPTtrk")){
     SetEffLKTTrkPt(grae2, grae1);
   }

   SetStyleGraphErrors(grae1, 1, 20, 0, 0.81, ytitle, xtitle, 0.8, 1.02);
   SetStyleGraphErrors(grae2, 2, 21, 0, 0.81, ytitle, xtitle, 0.8, 1.02);
   
   grae2->Draw("AP");
   grae1->Draw("PSame");
   
   SetLegend(grae1, grae2, head, leg1, leg2);
   SetLabel(0.6,0.6,36);
   c->Print(Form("%s.eps",type.Data()));
}  
Example #4
0
void drawROC(TString& type, TString& ytitle, TString& xtitle, TString& head, TString &leg1, TString& leg2, TString& leg3, TString & leg4){
  TCanvas *c = new TCanvas(Form("%s",type.Data()), Form("%s",type.Data()) ,5,49,400,400);
  SetStyleCanvas(c);

  TGraphAsymmErrors *grae1ROCdetrel = new TGraphAsymmErrors();
  TGraphAsymmErrors *grae1ROCdettrk = new TGraphAsymmErrors();
  TGraphAsymmErrors *grae1ROCpf = new TGraphAsymmErrors();
  TGraphErrors *grae1ROCLKT = new TGraphErrors();
  
  ROCDetectorRelIsoData(grae1ROCdetrel);
  ROCDetectorTrkIsoData(grae1ROCdettrk);
  ROCParticleIsoData(grae1ROCpf);

  TGraphErrors *graeTbkgData = new TGraphErrors();
  TGraphErrors *graeTsigData = new TGraphErrors();
  EffLKTIsoData(graeTsigData);
  SetDataQCDEffLKT(graeTbkgData);
  grae1ROCLKT = getROC(graeTsigData, graeTbkgData);

  //ROCLKTIsoData(grae1ROCLKT);
 
  //limit trk ROC to 10 points 
  grae1ROCdettrk = getModifiedROC(grae1ROCdettrk, 10);
 
  TGraphAsymmErrors *temp = new TGraphAsymmErrors();
  temp=getTemp(1, 14);
  SetStyleGraphErrors(temp, 2, 23, 0, 0.0,  ytitle, xtitle, 0.77, 1.02);

  SetStyleGraphErrors(grae1ROCdetrel, 2, 23, 0, 0.8,  ytitle, xtitle, 0.8, 1.1);
  SetStyleGraphErrors(grae1ROCdettrk, 3, 22, 0, 0.8, ytitle, xtitle, 0.8, 1.1);
  SetStyleGraphErrors(grae1ROCpf, 4, 20, 0, 0.8, ytitle, xtitle, 0.8, 1.1);
  SetStyleGraphErrors(grae1ROCLKT, 6, 20, 0, 0.8, ytitle, xtitle, 0.8, 1.1);

  //draw error band *****
  grae1ROCdetrel->SetFillColor(2);
  grae1ROCdetrel->SetFillStyle(3001);

  grae1ROCdettrk->SetFillColor(3);
  grae1ROCdettrk->SetFillStyle(3001);

  grae1ROCpf->SetFillColor(4);
  grae1ROCpf->SetFillStyle(3001);
  //end draw error band *****

  temp->Draw("APC");
  grae1ROCdetrel->Draw("3CPSame");
  grae1ROCdettrk->Draw("3CPSame");
  grae1ROCpf->Draw("3CPSame");
  grae1ROCLKT->Draw("PSame");

  SetLegend(grae1ROCpf, grae1ROCdetrel, grae1ROCdettrk, grae1ROCLKT, "Data", leg1, leg2, leg3, leg4, "PL","PL","PL","P",0.6, 0.20, 0.9,0.50);
  SetLabel(0.19,0.88,36);

  c->Print(Form("%s.eps",type.Data()));
}
Example #5
0
void drawLKT(TString& type, TString& ytitle, TString& xtitle, TString& head, TString &leg1, TString& leg2, TString& leg3, double miny = 0.85, double maxy = 1.02){

   TCanvas *c = new TCanvas(Form("%s",type.Data()), Form("%s",type.Data()) ,5,49,400,400);
   SetStyleCanvas(c);

   TGraphErrors *grae1 = new TGraphErrors();
   TGraphErrors *grae2 = new TGraphErrors();
   TGraphErrors *grae3 = new TGraphErrors();

   if( type.Contains("cEffLKTETA")){
     SetEffLKTETA(grae1, grae2, grae3);
     clearXErrorBar(grae1);
     clearXErrorBar(grae2);
     clearXErrorBar(grae3);
   }else if (type.Contains("cEffLKTNCal")){
     SetEffLKTNCal(grae1, grae2, grae3);
   }

   SetStyleGraphErrors(grae1, 2, 20, 0, 0.81, ytitle, xtitle, miny, maxy);
   SetStyleGraphErrors(grae2, 1, 21, 0, 0.81, ytitle, xtitle, miny, maxy);
   SetStyleGraphErrors(grae3, 4, 22, 0, 0.81, ytitle, xtitle, miny, maxy);

   grae1->Draw("AP");
   grae2->Draw("PSame");
   grae3->Draw("PSame");

   if( type.Contains("cEffLKTETA")){
     SetLegend(grae1, grae2, grae3, head, leg1, leg2, leg3,"P","P","P", 0.6,0.20,0.9,0.40);
     SetLabel(0.6,0.48,36);
   }else if( type.Contains("cEffLKTNCal")){
     SetLegend(grae1, grae2, grae3, head, leg1, leg2, leg3,"PL","PL","PL", 0.6,0.58,0.9,0.81);
     SetLabel(0.6,0.88,36);
   }

   c->Print(Form("%s.eps",type.Data()));
}
Example #6
0
void
avtLabelPlot::SetAtts(const AttributeGroup *a)
{
    const LabelAttributes *newAtts = (const LabelAttributes *)a;

    // Set the label plot attributes into the renderer.
    renderer->SetAtts(newAtts);

    // See if any attributes that require the plot to be regenerated were
    // changed and copy the state object.
    needsRecalculation = atts.ChangesRequireRecalculation(*newAtts);
    atts = *newAtts;

    // Set whether the legend is on or off.
    SetLegend(atts.GetLegendFlag());
}
Example #7
0
// Returns the group number added.  Also, makes sure that all the series have
// this many elements.
int MyGraph::AppendGroup(const CString& sLabel)
{
	VALIDATE;

	// Add the group.
	int nGroup((int)m_saLegendLabels.GetSize());
	SetLegend(nGroup, sLabel);

	// Make sure that all series have this element.
	POSITION pos(m_olMyGraphSeries.GetHeadPosition());

	while (pos) {

		MyGraphSeries* pSeries = m_olMyGraphSeries.GetNext(pos);
		ASSERT_VALID(pSeries);

		if (nGroup >= pSeries->m_dwaValues.GetSize()) {
			pSeries->m_dwaValues.SetAtGrow(nGroup, 0);
		}
	}

	return nGroup;
}
Example #8
0
void
avtWellBorePlot::SetAtts(const AttributeGroup *a)
{
    const WellBoreAttributes *newAtts = (const WellBoreAttributes *)a;

    needsRecalculation = atts.ChangesRequireRecalculation(*newAtts);

    atts = *newAtts;

    if (WellBoreFilter != NULL)
        WellBoreFilter->SetAttributes(*newAtts);

    if (newAtts->GetNWellBores() == 0)
        return;

    SetColors();

    SetLegend(atts.GetLegendFlag());
    SetLineWidth(atts.GetWellLineWidth());
    SetLineStyle(atts.GetWellLineStyle());

    decoMapper->SetScale(atts.GetWellNameScale());
    decoMapper->SetLabelVisibility(true);
}
void
avtPseudocolorPlot::SetAtts(const AttributeGroup *a)
{
    const PseudocolorAttributes *newAtts = (const PseudocolorAttributes *)a;

    // See if the colors will need to be updated.
    bool updateColors = (!colorsInitialized) ||
      (atts.GetColorTableName() != newAtts->GetColorTableName()) ||
      (atts.GetInvertColorTable() != newAtts->GetInvertColorTable()) ||
      (atts.GetOpacityType() != newAtts->GetOpacityType()) ||
      (atts.GetOpacityType() == PseudocolorAttributes::Ramp &&
       atts.GetOpacity() != newAtts->GetOpacity());

    // See if any attributes that require the plot to be regenerated were
    // changed and copy the state object.
    needsRecalculation = atts.ChangesRequireRecalculation(*newAtts);
    atts = *newAtts;

    // Update the plot's colors if needed.
    if(updateColors || atts.GetColorTableName() == "Default")
    {
        colorsInitialized = true;
        SetColorTable(atts.GetColorTableName().c_str());
    }
    else
      SetOpacityFromAtts();

    SetLighting(atts.GetLightingFlag());
    SetLegend(atts.GetLegendFlag());

    SetScaling(atts.GetScaling(), atts.GetSkewFactor());
    SetLimitsMode(atts.GetLimitsMode());

    glyphMapper->SetLineWidth(Int2LineWidth(atts.GetLineWidth()));
    glyphMapper->SetLineStyle(Int2LineStyle(atts.GetLineStyle()));
    glyphMapper->SetScale(atts.GetPointSize());

    // ARS - FIX ME  - FIX ME  - FIX ME  - FIX ME  - FIX ME 
    if( atts.GetOpacityType() == PseudocolorAttributes::VariableRange &&
        atts.GetOpacityVariable() != "" &&
        atts.GetOpacityVariable() != "\0")
    {   
      // glyphMapper->SetVariableOpacity(atts.GetOpacity());
      // if( atts.GetOpacityVarMinFlag() )
      //     glyphMapper->SetVariableMinOpacity(atts.GetOpacityVarMin());
      // if( atts.GetOpacityVarMaxFlag() )
      //     glyphMapper->SetVariableMaxOpacity(atts.GetOpacityVarMax());
        if (atts.GetOpacityVariable() == "default")
        { 
//            if (varname != NULL)
//                glyphMapper->ScaleOpacityByVar(varname);
        } 
        else
        { 
//            glyphMapper->ScaleOpacityByVar(atts.GetOpacityVariable());
        } 
    }
    else 
    {
//        glyphMapper->OpacityScalingOff();
    }

    // ARS - FIX ME  - FIX ME  - FIX ME  - FIX ME  - FIX ME 
    if( //(topoDim == 1 || (topoDim > 1 && atts.GetRenderWireframe())) &&
        atts.GetLineType() == PseudocolorAttributes::Tube && 
        atts.GetTubeRadiusVarEnabled() == true  &&
        atts.GetTubeRadiusVar() != "" &&
        atts.GetTubeRadiusVar() != "\0" )
    {
        if (atts.GetTubeRadiusVar() == "default")
        { 
//            if (varname != NULL)
//                glyphMapper->ScaleTubesByVar(varname);
        } 
        else
        { 
//            glyphMapper->ScaleTubesByVar(atts.GetTubeRadiusVar());
        } 
    }
    else 
    {
//        glyphMapper->TubeScalingOff();
    }

    if( //(topoDim == 0 || (topoDim > 0 && atts.GetRenderPoints())) &&
        atts.GetPointType() != PseudocolorAttributes::Point &&
        atts.GetPointType() != PseudocolorAttributes::Sphere &&
        atts.GetPointSizeVarEnabled() &&
        atts.GetPointSizeVar() != "" &&
        atts.GetPointSizeVar() != "\0" )
    {
        if (atts.GetPointSizeVar() == "default")
        { 
            if (varname != NULL)
                glyphMapper->ScaleByVar(varname);
        }
        else
        { 
            glyphMapper->ScaleByVar(atts.GetPointSizeVar());
        } 
    }
    else 
    {
        glyphMapper->DataScalingOff();
    }

    if (atts.GetPointType() == PseudocolorAttributes::Box)
        glyphMapper->SetGlyphType(avtPointGlypher::Box);
    else if (atts.GetPointType() == PseudocolorAttributes::Axis)
        glyphMapper->SetGlyphType(avtPointGlypher::Axis);
    else if (atts.GetPointType() == PseudocolorAttributes::Icosahedron)
        glyphMapper->SetGlyphType(avtPointGlypher::Icosahedron);
    else if (atts.GetPointType() == PseudocolorAttributes::Octahedron)
        glyphMapper->SetGlyphType(avtPointGlypher::Octahedron);
    else if (atts.GetPointType() == PseudocolorAttributes::Tetrahedron)
        glyphMapper->SetGlyphType(avtPointGlypher::Tetrahedron);
    else if (atts.GetPointType() == PseudocolorAttributes::SphereGeometry)
        glyphMapper->SetGlyphType(avtPointGlypher::SphereGeometry);
    else if (atts.GetPointType() == PseudocolorAttributes::Point)
        glyphMapper->SetGlyphType(avtPointGlypher::Point);
    else if (atts.GetPointType() == PseudocolorAttributes::Sphere)
        glyphMapper->SetGlyphType(avtPointGlypher::Sphere);

    SetPointGlyphSize();

    if (varname != NULL)
    {
        glyphMapper->ColorByScalarOn(std::string(varname));
    }
}
Example #10
0
void draw(TString& type, TString& ytitle, TString& xtitle, TString& head,  double min, double max, TString &leg1, TString& leg2, TString &leg3 = ""){
   TCanvas *c = new TCanvas(Form("%s",type.Data()), Form("%s",type.Data()) ,5,49,400,400);
   SetStyleCanvas(c);

   TGraphAsymmErrors *grae1data = new TGraphAsymmErrors();
   TGraphAsymmErrors *grae1mc = new TGraphAsymmErrors();
   TGraphAsymmErrors *grae2data = new TGraphAsymmErrors();
   TGraphAsymmErrors *grae2mc = new TGraphAsymmErrors();
   TGraphAsymmErrors *grae1sf = new TGraphAsymmErrors();
   TGraphAsymmErrors *grae2sf = new TGraphAsymmErrors();

   TGraphErrors *grae1LKTdata = new TGraphErrors();
   TGraphErrors *grae1LKTmc = new TGraphErrors();
   TGraphErrors *grae1LKTsf = new TGraphErrors();

   int datacolor1 = 1;
   int datacolor2 = 1;

   //ISO
   if( type.Contains("cEffPFBaseISO") ){
     EffParticleIsoData(grae1data);
     EffParticleIsoMC(grae1mc);
     grae1sf = getSF(grae1data, grae1mc);
   }else if ( type.Contains("cEffDETBaseISOrel")){
     EffDetectorRelIsoData(grae1data);
     EffDetectorRelIsoMC(grae1mc);
     EffLKTIsoData(grae1LKTdata);
     EffLKTIsoMC(grae1LKTmc);
     grae1LKTmc->RemovePoint(0);
     grae1LKTdata->RemovePoint(0);
     grae1sf = getSF(grae1data, grae1mc);
     grae1LKTsf = getSF(grae1LKTdata, grae1LKTmc);
   }else if ( type.Contains("cEffDETBaseISOtrk")){
     EffDetectorTrkIsoData(grae1data);
     EffDetectorTrkIsoMC(grae1mc);
     grae1data->RemovePoint(0);
     grae1mc->RemovePoint(0);
     EffLKTTrkIsoData(grae1LKTdata);
     EffLKTTrkIsoMC(grae1LKTmc);
     grae1sf = getSF(grae1data, grae1mc);
     grae1LKTsf = getSF(grae1LKTdata, grae1LKTmc);
   }

  //PT
   if( type.Contains("cEffPFBasePT") ){
     datacolor1 = 2;
     datacolor2 = 4;
     SetEffPFPt(grae1data, grae1mc);
     SetEffPFPt3(grae2data, grae2mc);
     grae1sf = getSF(grae1data, grae1mc);
     grae2sf = getSF(grae2data, grae2mc);
   }else if( type.Contains("cEffDETBasePTrel") ){
     datacolor1 = 2;
     datacolor2 = 4;
     SetEffDetPtRel10(grae1data, grae1mc);
     SetEffDetPtRel15(grae2data, grae2mc);
     SetEffLKTPt(grae1LKTmc, grae1LKTdata);
     grae1sf = getSF(grae1data, grae1mc);
     grae2sf = getSF(grae2data, grae2mc);
     grae1LKTsf = getSF(grae1LKTdata, grae1LKTmc);
   }else if( type.Contains("cEffDETBasePTtrk") ){
     datacolor1 = 2;
     datacolor2 = 4;
     SetEffDetPtTrk05(grae1data, grae1mc);
     SetEffDetPtTrk10(grae2data, grae2mc);
     SetEffLKTTrkPt(grae1LKTmc, grae1LKTdata);
     grae1sf = getSF(grae1data, grae1mc);
     grae2sf = getSF(grae2data, grae2mc);
     grae1LKTsf = getSF(grae1LKTdata, grae1LKTmc);
   }

   //ROC
   if( type.Contains("cROCPFBaseIso")){
     ROCParticleIsoData(grae1data);
     ROCParticleIsoMC(grae1mc);
   }else if ( type.Contains("cROCDETBaseIsorel")){
     ROCDetectorRelIsoData(grae1data);
     ROCDetectorRelIsoMC(grae1mc);
     //data LKT
     //ROCLKTIsoData(grae1LKTdata);
     TGraphErrors *graeTbkgData = new TGraphErrors();
     TGraphErrors *graeTsigData = new TGraphErrors();
     EffLKTIsoData(graeTsigData);
     SetDataQCDEffLKT(graeTbkgData);
     grae1LKTdata = getROC(graeTsigData, graeTbkgData);
     //mc LKT
     TGraphErrors *graeTbkg = new TGraphErrors();
     TGraphErrors *graeTsig = new TGraphErrors();
     EffLKTIsoMC(graeTsig);
     SetMCQCDEffLKT(graeTbkg);
     grae1LKTmc = getROC(graeTsig, graeTbkg);
   }else if ( type.Contains("cROCDETBaseIsotrk")){
     ROCDetectorTrkIsoData(grae1data);
     ROCDetectorTrkIsoMC(grae1mc);
   }

   SetStyleGraphErrors(grae1data, datacolor1, 20, 0, 0.9, ytitle, xtitle, min, max);
   SetStyleGraphErrors(grae2data, datacolor2, 20, 0, 0.9, ytitle, xtitle, min, max);
   SetStyleGraphErrors(grae1mc, 2, 21, 0, 0.9, ytitle, xtitle, min, max);
   SetStyleGraphErrors(grae1LKTdata, 4, 24, 0, 0.9, ytitle, xtitle, min, max);
   SetStyleGraphErrors(grae1LKTmc, 6, 20, 0, 0.9, ytitle, xtitle, min, max);

   TGraphAsymmErrors *temp = new TGraphAsymmErrors();
   temp = getTemp(1,27);

   //ISO draw
   if( type.Contains("cEffPFBaseISO") || type.Contains("cEffDETBaseISO") ){
     SetStyleGraphErrors(temp, 2, 23, 0, 0.0,  ytitle, xtitle, min, max);
     temp->Draw("APC");
     if( type.Contains("cEffPFBaseISO") ){
       grae1data->Draw("PCSame");
       grae1mc->Draw("PCSame");
       SetLegend(grae1data, grae1mc, head, leg1, leg2, "PL", "PL");
     }else if ( type.Contains("cEffDETBaseISO") ) {
       grae1data->Draw("PCSame");
       grae1mc->Draw("PCSame");
       grae1LKTdata->Draw("PSame");
       grae1LKTmc->Draw("PSame");
       clearXErrorBar(grae1LKTdata);
       clearXErrorBar(grae1LKTmc);
       SetLegend(grae1data, grae1mc, grae1LKTdata, grae1LKTmc, head, leg1, leg2, "LKT Data", "LKT MC", "PL","PL","P","P",0.6, 0.20, 0.9,0.50);
     }
   }

   //PT draw
   if( type.Contains("cEffPFBasePT") ){
     grae1data->Draw("AP");
     grae2data->Draw("PSame");
     SetLegend(grae1data, grae2data, head, leg1, leg2, "PL", "PL");
   }else if( type.Contains("cEffDETBasePT") ){
     grae1data->Draw("APSame");
     grae2data->Draw("PSame");
     grae1LKTdata->Draw("PSame");
     SetLegend(grae1data, grae2data, grae1LKTdata, head, leg1, leg2, leg3, "PL", "PL", "P");
   }

   //ROC draw
   if( type.Contains("ROC") ){
     SetStyleGraphErrors(temp, 2, 23, 0, 0.0,  ytitle, xtitle, min, max);
     if( type.Contains("cROCPFBaseIso") || type.Contains("cROCDETBaseIsotrk") ){
       grae1data->Draw("APC");
       grae1mc->Draw("PCSame");
       SetLegend(grae1data, grae1mc, head, leg1, leg2, "PL", "PL");
     }else if ( type.Contains("cROCDETBaseIsorel") ) {
       grae1data->Draw("APC");
       grae1mc->Draw("PCSame");
       grae1LKTdata->Draw("PSame");
       grae1LKTmc->Draw("PSame");
       clearXErrorBar(grae1LKTdata);
       clearXErrorBar(grae1LKTmc);
       SetLegend(grae1data, grae1mc, grae1LKTdata, grae1LKTmc, head, leg1, leg2, "LKT Data", "LKT MC", "PL","PL","P","P",0.6, 0.20, 0.9,0.50);
     }
   }
   SetLabel(0.6,0.6,36);
   c->Print(Form("%s.eps",type.Data()));

   //SF for pt
   if (type.Contains("cEffPFBasePT") || type.Contains("cEffDETBasePT") ){ 
     TCanvas *c_sf = new TCanvas(Form("%sSF",type.Data()), Form("%s",type.Data()) ,5,49,400,400);
     SetStyleCanvas(c_sf);

     min = 0.75;
     max = 1.2;
     SetStyleGraphErrors(grae1sf, 2, 20, 0, 0.9, "Data/MC", xtitle, min, max);
     SetStyleGraphErrors(grae2sf, 4, 20, 0, 0.9, "Data/MC", xtitle, min, max);
     SetStyleGraphErrors(grae1LKTsf, 4, 24, 0, 0.9, "Data/MC", xtitle, min, max);

     if( type.Contains("cEffPFBasePT") ){
       grae1sf->Draw("AP");
       grae2sf->Draw("PSame");
       SetLegend(grae1sf, grae2sf, head, leg1, leg2, "PL", "PL");
     }else if( type.Contains("cEffDETBasePT") ){
       grae1sf->Draw("APSame");
       grae2sf->Draw("PSame");
       grae1LKTsf->Draw("PSame");
       SetLegend(grae1sf, grae2sf, grae1LKTsf, head, leg1, leg2, leg3, "PL", "PL", "P");
     }
     SetLabel(0.6,0.88,36);
     c_sf->Print(Form("%sSF.eps",type.Data()));
   }

   //SF for efficiency
   if ( type.Contains("cEffPFBaseISO") || type.Contains("cEffDETBaseISO") ){
     TCanvas *c_sf = new TCanvas(Form("%sSF",type.Data()), Form("%s",type.Data()) ,5,49,400,400);
     SetStyleCanvas(c_sf);
     min = 0.93;
     max = 1.07;
     SetStyleGraphErrors(grae1sf, 2, 20, 0, 0.9, "Data/MC", xtitle, min, max);
     SetStyleGraphErrors(grae1LKTsf, 4, 24, 0, 0.9, "Data/MC", xtitle, min, max);

     SetStyleGraphErrors(temp, 2, 23, 0, 0.0,  "Data/MC", xtitle, min, max);
     temp->Draw("AP");

     if( type.Contains("cEffPFBaseISO") ){
       grae1sf->Draw("PSame");
       SetLegend(grae1sf, head, "T&P",  "PL");
     }else if( type.Contains("cEffDETBaseISO") ){
       grae1sf->Draw("PSame");
       grae1LKTsf->Draw("PSame");
       SetLegend(grae1sf, grae1LKTsf, head, "T&P", "LKT", "PL", "P");
     }
     SetLabel(0.6,0.88,36);
     c_sf->Print(Form("%sSF.eps",type.Data()));
   }
}
Example #11
0
//using namespace std;
void btagefficiency(int ii, int jj)
{
    gROOT->ProcessLine(".L tdrstyle.C");
    defaultStyle();
    TFile* f1 = new TFile("/afs/cern.ch/work/y/youngjo/public/For8Tev/v20130208_V00-00-06/vallot_TTbarFullLepMGDecays.root");
	
    TTree* treeMuMu = (TTree*)f1->Get("MuMu/tree");
    TTree* treeElEl = (TTree*)f1->Get("ElEl/tree");
    TTree* treeMuEl = (TTree*)f1->Get("MuEl/tree");
	
    float binspt[] = {20,30,40,50,60,70,80,100,120,160,210,260,320,400,450};
    int nBinpt = sizeof(binspt)/sizeof(float) - 1;
    float binseta[] = {0.,0.4,0.8,1.2,1.6,2.0,2.4};
    int nBineta = sizeof(binseta)/sizeof(float) - 1;

    TCut precut_em = "ZMass > 12 && lep1_relIso03 < 0.15 && lep2_relIso03 < 0.15 && PairSign < 0 && nJet30 >= 4";
    TCut precut = precut_em + "abs(ZMass - 91.2) > 15 && MET > 30"; 
    TCut bcut =  "abs(jets_flavor) == 5";
    TCut ccut =  "abs(jets_flavor) == 4";
    TCut lcut =  "abs(jets_flavor) < 4";

    TCut etacut1 = "abs(jets_eta) <= 0.8";
    TCut etacut2 = "abs(jets_eta) > 0.8 && abs(jets_eta) <=1.6";
    TCut etacut3 = "abs(jets_eta) > 1.6";

    TCut etacutl1 = "abs(jets_eta) <= 0.5";
    TCut etacutl2 = "abs(jets_eta) > 0.5 && abs(jets_eta) <=1.0";
    TCut etacutl3 = "abs(jets_eta) > 1.0 && abs(jets_eta) <=1.5";
    TCut etacutl4 = "abs(jets_eta) > 1.5";


    TCut csvl =  "jets_bDiscriminatorCSV > 0.244";
    TCut csvm =  "jets_bDiscriminatorCSV > 0.679";
    TCut csvt =  "jets_bDiscriminatorCSV > 0.898";


    float binsDR[] = {0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.2,3.5,4};
    int nBinDR = sizeof(binsDR)/sizeof(float) - 1;
    TString DR_ = "TMath::Sqrt( abs(jets_eta[csvd_jetid[2]]-jets_eta[csvd_jetid[3]])*abs(jets_eta[csvd_jetid[2]]-jets_eta[csvd_jetid[3]])+abs(TVector2::Phi_mpi_pi(jets_phi[csvd_jetid[2]]-jets_phi[csvd_jetid[3]]))*abs(TVector2::Phi_mpi_pi(jets_phi[csvd_jetid[2]]-jets_phi[csvd_jetid[3]])) )";  

    float binsCSV[] = {0.0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.0};
    int nBinCSV = sizeof(binsCSV)/sizeof(float) - 1;
    

 if(ii ==4)
 {
    TH1F* dist_b_csvd = dist(treeElEl, treeMuMu, treeMuEl, "jets_bDiscriminatorCSV", nBinCSV, binsCSV, precut, precut_em, bcut, "B flavor","b_csvd",2,"discriminator (CSV)"); 
    TH1F* dist_c_csvd = dist(treeElEl, treeMuMu, treeMuEl, "jets_bDiscriminatorCSV", nBinCSV, binsCSV, precut, precut_em, ccut, "C flavor","c_csvd",4,"discriminator (CSV)");
    TH1F* dist_l_csvd = dist(treeElEl, treeMuMu, treeMuEl, "jets_bDiscriminatorCSV", nBinCSV, binsCSV, precut, precut_em, lcut, "LF flavor","l_csvd",3,"discriminator (CSV)");

    TCanvas * c_b_csvd = new TCanvas("c_b_csvd","c_b_csvd",500,500);
    double ymax = dist_l_csvd->GetMaximum(); 
    if(ymax< dist_c_csvd->GetMaximum()) ymax=dist_c_csvd->GetMaximum();
    if(ymax< dist_b_csvd->GetMaximum()) ymax=dist_b_csvd->GetMaximum();   

    ymax=ymax*1.5;
    dist_l_csvd->SetMaximum(ymax);   
 
    dist_l_csvd->Draw("");
    dist_c_csvd->Draw("same");
    dist_b_csvd->Draw("same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(dist_b_csvd,"b-flavor","L");
    l->AddEntry(dist_c_csvd,"c-flavor","L");
    l->AddEntry(dist_l_csvd,"l-flavor","L");
    SetLegend(l);
    c_b_csvd->Print("compare_b_csvd.png");
    c_b_csvd->Print("compare_b_csvd.eps");
 }
 else if(ii ==3)
 {
    TH1F* eff_b_dr_CSVL = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, bcut, csvl, "b_dr_CSVL","CSVL",2,"#Delta R"); 
    TH1F* eff_c_dr_CSVL = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, ccut, csvl, "c_dr_CSVL","CSVL",4,"#Delta R");
    TH1F* eff_l_dr_CSVL = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, lcut, csvl, "l_dr_CSVL","CSVL",5,"#Delta R");

    TH1F* eff_b_dr_CSVM = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, bcut, csvm, "b_dr_CSVM","CSVM",2,"#Delta R"); 
    TH1F* eff_b_dr_CSVT = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, bcut, csvt, "b_dr_CSVT","CSVT",2,"#Delta R"); 

    TH1F* eff_c_dr_CSVM = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, ccut, csvm, "c_dr_CSVM","CSVM",4,"#Delta R");
    TH1F* eff_c_dr_CSVT = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, ccut, csvt, "c_dr_CSVT","CSVT",4,"#Delta R");

    TH1F* eff_l_dr_CSVM = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, lcut, csvm, "l_dr_CSVM","CSVM",5,"#Delta R");
    TH1F* eff_l_dr_CSVT = eff(treeElEl, treeMuMu, treeMuEl, DR_.Data(), nBinDR, binsDR, precut, precut_em, lcut, csvt, "l_dr_CSVT","CSVT",5,"#Delta R");

    TCanvas * c_b_dr_CSVL = new TCanvas("c_b_dr_CSVL","c_b_dr_CSVL",500,500);
    eff_b_dr_CSVL->Draw("e3");
    eff_c_dr_CSVL->Draw("e3 same");
    eff_l_dr_CSVL->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_dr_CSVL,"b-flavor","F");
    l->AddEntry(eff_c_dr_CSVL,"c-flavor","F");
    l->AddEntry(eff_l_dr_CSVL,"l-flavor","F");
    SetLegend(l);
    c_b_dr_CSVL->Print("compare_b_dr_CSVL.png");
    c_b_dr_CSVL->Print("compare_b_dr_CSVL.eps");


    TCanvas * c_b_dr_CSVM = new TCanvas("c_b_dr_CSVM","c_b_dr_CSVM",500,500);
    eff_b_dr_CSVM->Draw("e3");
    eff_c_dr_CSVM->Draw("e3 same");
    eff_l_dr_CSVM->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_dr_CSVM,"b-flavor","F");
    l->AddEntry(eff_c_dr_CSVM,"c-flavor","F");
    l->AddEntry(eff_l_dr_CSVM,"l-flavor","F");
    SetLegend(l);
    c_b_dr_CSVM->Print("compare_b_dr_CSVM.png");
    c_b_dr_CSVM->Print("compare_b_dr_CSVM.eps");

    TCanvas * c_b_dr_CSVT = new TCanvas("c_b_dr_CSVT","c_b_dr_CSVT",500,500);
    eff_b_dr_CSVT->Draw("e3");
    eff_c_dr_CSVT->Draw("e3 same");
    eff_l_dr_CSVT->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_dr_CSVT,"b-flavor","F");
    l->AddEntry(eff_c_dr_CSVT,"c-flavor","F");
    l->AddEntry(eff_l_dr_CSVT,"l-flavor","F");
    SetLegend(l);
    c_b_dr_CSVT->Print("compare_b_dr_CSVT.png");
    c_b_dr_CSVT->Print("compare_b_dr_CSVT.eps");

 }
 else if(ii ==0)
 {

    TH1F* eff_b_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, bcut, csvl, "b_pt_CSVL","CSVL",2,"p_{T}(GeV/c)"); 
    TH1F* eff_c_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, ccut, csvl, "c_pt_CSVL","CSVL",4,"p_{T}(GeV/c)");
    TH1F* eff_l_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut, csvl, "l_pt_CSVL","CSVL",5,"p_{T}(GeV/c)");

    TH1F* eff_b_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, bcut, csvm, "b_pt_CSVM","CSVM",2,"p_{T}(GeV/c)"); 
    TH1F* eff_b_pt_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, bcut, csvt, "b_pt_CSVT","CSVT",2,"p_{T}(GeV/c)"); 

    TH1F* eff_c_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, ccut, csvm, "c_pt_CSVM","CSVM",4,"p_{T}(GeV/c)");
    TH1F* eff_c_pt_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, ccut, csvt, "c_pt_CSVT","CSVT",4,"p_{T}(GeV/c)");

    TH1F* eff_l_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut, csvm, "l_pt_CSVM","CSVM",5,"p_{T}(GeV/c)");
    TH1F* eff_l_pt_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut, csvt, "l_pt_CSVT","CSVT",5,"p_{T}(GeV/c)");

    TCanvas * c_b_pt_CSVL = new TCanvas("c_b_pt_CSVL","c_b_pt_CSVL",500,500);
    eff_b_pt_CSVL->Draw("e3");
    eff_c_pt_CSVL->Draw("e3 same");
    eff_l_pt_CSVL->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_pt_CSVL,"b-flavor","F");
    l->AddEntry(eff_c_pt_CSVL,"c-flavor","F");
    l->AddEntry(eff_l_pt_CSVL,"l-flavor","F");
    SetLegend(l);
    c_b_pt_CSVL->Print("compare_b_pt_CSVL.png");
    c_b_pt_CSVL->Print("compare_b_pt_CSVL.eps");


    TCanvas * c_b_pt_CSVM = new TCanvas("c_b_pt_CSVM","c_b_pt_CSVM",500,500);
    eff_b_pt_CSVM->Draw("e3");
    eff_c_pt_CSVM->Draw("e3 same");
    eff_l_pt_CSVM->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_pt_CSVM,"b-flavor","F");
    l->AddEntry(eff_c_pt_CSVM,"c-flavor","F");
    l->AddEntry(eff_l_pt_CSVM,"l-flavor","F");
    SetLegend(l);
    c_b_pt_CSVM->Print("compare_b_pt_CSVM.png");
    c_b_pt_CSVM->Print("compare_b_pt_CSVM.eps");

    TCanvas * c_b_pt_CSVT = new TCanvas("c_b_pt_CSVT","c_b_pt_CSVT",500,500);
    eff_b_pt_CSVT->Draw("e3");
    eff_c_pt_CSVT->Draw("e3 same");
    eff_l_pt_CSVT->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_pt_CSVT,"b-flavor","F");
    l->AddEntry(eff_c_pt_CSVT,"c-flavor","F");
    l->AddEntry(eff_l_pt_CSVT,"l-flavor","F");
    SetLegend(l);
    c_b_pt_CSVT->Print("compare_b_pt_CSVT.png");
    c_b_pt_CSVT->Print("compare_b_pt_CSVT.eps");


 }
 else if(ii==2)
 {
    if(jj==0)
    {
        TH1F* eff_l1_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacutl1, csvl, "l1_pt_CSVL","CSVL",2,"p_{T}(GeV/c)"); 
        TH1F* eff_l2_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacutl2, csvl, "l2_pt_CSVL","CSVL",3,"p_{T}(GeV/c)");
        TH1F* eff_l3_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacutl3, csvl, "l3_pt_CSVL","CSVL",4,"p_{T}(GeV/c)");
        TH1F* eff_l4_pt_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacutl4, csvl, "l4_pt_CSVL","CSVL",5,"p_{T}(GeV/c)");
        
        TCanvas * c_l3_pt_CSVL = new TCanvas("c_b_pt_CSVL","c_b_pt_CSVL",500,500);
        eff_l1_pt_CSVL->SetMaximum(0.4);
        eff_l1_pt_CSVL->Draw("e3");
        eff_l2_pt_CSVL->Draw("e3 same");
        eff_l3_pt_CSVL->Draw("e3 same");
        eff_l4_pt_CSVL->Draw("e3 same");
        
        TLegend *l = new TLegend(0.42,0.76,0.89,0.87);
        l->AddEntry(eff_l1_pt_CSVL,"l-flavor  #eta #leq 0.5","F");
        l->AddEntry(eff_l2_pt_CSVL,"l-flavor 0.5 < #eta #leq 1.0","F");
        l->AddEntry(eff_l3_pt_CSVL,"l-flavor 1.0 < #eta #leq 1.5","F");
        l->AddEntry(eff_l4_pt_CSVL,"l-flavor 1.5 < #eta","F");
        SetLegend(l);
        c_l3_pt_CSVL->Print("compare_l4_pt_CSVL.png");
        c_l3_pt_CSVL->Print("compare_l4_pt_CSVL.eps");
    }
    else if(jj==1)
    {
        TH1F* eff_l1_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacut1, csvm, "l1_pt_CSVM","CSVM",2,"p_{T}(GeV/c)"); 
        TH1F* eff_l2_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacut2, csvm, "l2_pt_CSVM","CSVM",4,"p_{T}(GeV/c)");
        TH1F* eff_l3_pt_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_pt", nBinpt, binspt, precut, precut_em, lcut+etacut3, csvm, "l3_pt_CSVM","CSVM",5,"p_{T}(GeV/c)");
        
        TCanvas * c_l3_pt_CSVM = new TCanvas("c_b_pt_CSVM","c_b_pt_CSVM",500,500);
        eff_l1_pt_CSVM->SetMaximum(0.1);
        eff_l1_pt_CSVM->Draw("e3");
        eff_l2_pt_CSVM->Draw("e3 same");
        eff_l3_pt_CSVM->Draw("e3 same");
        
        TLegend *l = new TLegend(0.42,0.76,0.89,0.87);
        l->AddEntry(eff_l1_pt_CSVM,"l-flavor #eta #leq 0.8","F");
        l->AddEntry(eff_l2_pt_CSVM,"l-flavor 0.8 < #eta #leq 1.6","F");
        l->AddEntry(eff_l3_pt_CSVM,"l-flavor 1.6 < #eta","F");
        SetLegend(l);
        c_l3_pt_CSVM->Print("compare_l3_pt_CSVM.png");
        c_l3_pt_CSVM->Print("compare_l3_pt_CSVM.eps");
    }
 }
 else if(ii==1)
 {
    TH1F* eff_b_eta_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, bcut, csvl, "b_eta_CSVL","CSVL",2, "#eta"); 
    TH1F* eff_c_eta_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, ccut, csvl, "c_eta_CSVL","CSVL",4, "#eta");
    TH1F* eff_l_eta_CSVL = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, lcut, csvl, "l_eta_CSVL","CSVL",5, "#eta");

    TH1F* eff_b_eta_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, bcut, csvm, "b_eta_CSVM","CSVM",2, "#eta"); 
    TH1F* eff_b_eta_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, bcut, csvt, "b_eta_CSVT","CSVT",2, "#eta"); 

    TH1F* eff_c_eta_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, ccut, csvm, "c_eta_CSVM","CSVM",4, "#eta");
    TH1F* eff_c_eta_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, ccut, csvt, "c_eta_CSVT","CSVT",4, "#eta");

    TH1F* eff_l_eta_CSVM = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, lcut, csvm, "l_eta_CSVM","CSVM",5, "#eta");
    TH1F* eff_l_eta_CSVT = eff(treeElEl, treeMuMu, treeMuEl, "jets_eta", nBineta, binseta, precut, precut_em, lcut, csvt, "l_eta_CSVT","CSVT",5, "#eta");

    TCanvas * c_b_eta_CSVL = new TCanvas("c_b_eta_CSVL","c_b_eta_CSVL",500,500);
    eff_b_eta_CSVL->Draw("e3");
    eff_c_eta_CSVL->Draw("e3 same");
    eff_l_eta_CSVL->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_eta_CSVL,"b-flavor","F");
    l->AddEntry(eff_c_eta_CSVL,"c-flavor","F");
    l->AddEntry(eff_l_eta_CSVL,"l-flavor","F");
    SetLegend(l);
    c_b_eta_CSVL->Print("compare_b_eta_CSVL.png");
    c_b_eta_CSVL->Print("compare_b_eta_CSVL.eps");


    TCanvas * c_b_eta_CSVM = new TCanvas("c_b_eta_CSVM","c_b_eta_CSVM",500,500);
    eff_b_eta_CSVM->Draw("e3");
    eff_c_eta_CSVM->Draw("e3 same");
    eff_l_eta_CSVM->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_eta_CSVM,"b-flavor","F");
    l->AddEntry(eff_c_eta_CSVM,"c-flavor","F");
    l->AddEntry(eff_l_eta_CSVM,"l-flavor","F");
    SetLegend(l);
    c_b_eta_CSVM->Print("compare_b_eta_CSVM.png");
    c_b_eta_CSVM->Print("compare_b_eta_CSVM.eps");

    TCanvas * c_b_eta_CSVT = new TCanvas("c_b_eta_CSVT","c_b_eta_CSVT",500,500);
    eff_b_eta_CSVT->Draw("e3");
    eff_c_eta_CSVT->Draw("e3 same");
    eff_l_eta_CSVT->Draw("e3 same");

    TLegend *l = new TLegend(0.68,0.76,0.89,0.87);
    l->AddEntry(eff_b_eta_CSVT,"b-flavor","F");
    l->AddEntry(eff_c_eta_CSVT,"c-flavor","F");
    l->AddEntry(eff_l_eta_CSVT,"l-flavor","F");
    SetLegend(l);
    c_b_eta_CSVT->Print("compare_b_eta_CSVT.png");
    c_b_eta_CSVT->Print("compare_b_eta_CSVT.eps");
  }

}
Example #12
0
void merge(){
	TFile* fMuMu = new TFile("resultMuMuntag3.root");
	TFile* fElEl = new TFile("resultElElntag3.root");
	TFile* fMuEl = new TFile("resultMuElntag3.root");
	
    gROOT->ProcessLine(".L ../tdrstyle.C");
    defaultStyle();
	
	TH1F* h_jet1_ttbb_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet1_ttbb_ntag3_MuMu"); 
	TH1F* h_jet2_ttbb_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet2_ttbb_ntag3_MuMu"); 
	TH1F* h_jet3_ttbb_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet3_ttbb_ntag3_MuMu"); 
	TH1F* h_jet4_ttbb_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet4_ttbb_ntag3_MuMu"); 
	TH1F* h_jet1_ttbb_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet1_ttbb_ntag3_ElEl"); 
	TH1F* h_jet2_ttbb_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet2_ttbb_ntag3_ElEl"); 
	TH1F* h_jet3_ttbb_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet3_ttbb_ntag3_ElEl"); 
	TH1F* h_jet4_ttbb_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet4_ttbb_ntag3_ElEl"); 
	TH1F* h_jet1_ttbb_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet1_ttbb_ntag3_MuEl"); 
	TH1F* h_jet2_ttbb_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet2_ttbb_ntag3_MuEl"); 
	TH1F* h_jet3_ttbb_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet3_ttbb_ntag3_MuEl"); 
	TH1F* h_jet4_ttbb_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet4_ttbb_ntag3_MuEl");
	
	TH1F* h_jet1_ttjj_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet1_ttjj_ntag3_MuMu"); 
	TH1F* h_jet2_ttjj_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet2_ttjj_ntag3_MuMu"); 
	TH1F* h_jet3_ttjj_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet3_ttjj_ntag3_MuMu"); 
	TH1F* h_jet4_ttjj_ntag3_MuMu = (TH1F*)fMuMu->Get("h_jet4_ttjj_ntag3_MuMu"); 
	TH1F* h_jet1_ttjj_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet1_ttjj_ntag3_ElEl"); 
	TH1F* h_jet2_ttjj_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet2_ttjj_ntag3_ElEl"); 
	TH1F* h_jet3_ttjj_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet3_ttjj_ntag3_ElEl"); 
	TH1F* h_jet4_ttjj_ntag3_ElEl = (TH1F*)fElEl->Get("h_jet4_ttjj_ntag3_ElEl"); 
	TH1F* h_jet1_ttjj_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet1_ttjj_ntag3_MuEl"); 
	TH1F* h_jet2_ttjj_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet2_ttjj_ntag3_MuEl"); 
	TH1F* h_jet3_ttjj_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet3_ttjj_ntag3_MuEl"); 
	TH1F* h_jet4_ttjj_ntag3_MuEl = (TH1F*)fMuEl->Get("h_jet4_ttjj_ntag3_MuEl");
	
	TCanvas* can1 = new TCanvas("can1","leading jet",1200,1200);
	TCanvas* can2 = new TCanvas("can2","second leading jet",1200,1200);
	TCanvas* can3 = new TCanvas("can3","third leading jet",1200,1200);
	TCanvas* can4 = new TCanvas("can4","fourth leading jet",1200,1200);
	
	can1->cd();
	h_jet1_ttbb_ntag3_MuMu->Add(h_jet1_ttbb_ntag3_ElEl);
	h_jet1_ttbb_ntag3_MuMu->Add(h_jet1_ttbb_ntag3_MuEl);
	h_jet1_ttbb_ntag3_MuMu->Scale(1.0/(h_jet1_ttbb_ntag3_MuMu->Integral()+h_jet1_ttbb_ntag3_ElEl->Integral()+h_jet1_ttbb_ntag3_MuEl->Integral()));
	h_jet1_ttjj_ntag3_MuMu->Add(h_jet1_ttjj_ntag3_ElEl);
	h_jet1_ttjj_ntag3_MuMu->Add(h_jet1_ttjj_ntag3_MuEl);
	h_jet1_ttjj_ntag3_MuMu->Scale(1.0/(h_jet1_ttjj_ntag3_MuMu->Integral()+h_jet1_ttjj_ntag3_ElEl->Integral()+h_jet1_ttjj_ntag3_MuEl->Integral()));
	h_jet1_ttbb_ntag3_MuMu->Draw();
	h_jet1_ttjj_ntag3_MuMu->Draw("same");
	h_jet1_ttbb_ntag3_MuMu->SetTitle("leading jet pt distibution");
	h_jet1_ttbb_ntag3_MuMu->SetStats(0);
	h_jet1_ttbb_ntag3_MuMu->SetMaximum(0.3);
	h_jet1_ttbb_ntag3_MuMu->GetXaxis()->SetTitle("Jet p_{T} (GeV)");
	h_jet1_ttbb_ntag3_MuMu->GetYaxis()->SetTitle("Normalized Entries");
  	SetLegend(h_jet1_ttbb_ntag3_MuMu, h_jet1_ttjj_ntag3_MuMu);
	can2->cd();
	h_jet2_ttbb_ntag3_MuMu->Add(h_jet2_ttbb_ntag3_ElEl);
	h_jet2_ttbb_ntag3_MuMu->Add(h_jet2_ttbb_ntag3_MuEl);
	h_jet2_ttbb_ntag3_MuMu->Scale(1.0/(h_jet2_ttbb_ntag3_MuMu->Integral()+h_jet2_ttbb_ntag3_ElEl->Integral()+h_jet2_ttbb_ntag3_MuEl->Integral()));
	h_jet2_ttjj_ntag3_MuMu->Add(h_jet2_ttjj_ntag3_ElEl);
	h_jet2_ttjj_ntag3_MuMu->Add(h_jet2_ttjj_ntag3_MuEl);
	h_jet2_ttjj_ntag3_MuMu->Scale(1.0/(h_jet2_ttjj_ntag3_MuMu->Integral()+h_jet2_ttjj_ntag3_ElEl->Integral()+h_jet2_ttjj_ntag3_MuEl->Integral()));
	h_jet2_ttbb_ntag3_MuMu->Draw();
	h_jet2_ttjj_ntag3_MuMu->Draw("same");
	h_jet2_ttbb_ntag3_MuMu->SetStats(0);
	h_jet2_ttbb_ntag3_MuMu->SetMaximum(0.3);
	h_jet2_ttbb_ntag3_MuMu->SetTitle("second leading jet pt distibution");
	h_jet2_ttbb_ntag3_MuMu->GetXaxis()->SetTitle("Jet p_{T} (GeV)");
	h_jet2_ttbb_ntag3_MuMu->GetYaxis()->SetTitle("Normalized Entries");
  	SetLegend(h_jet2_ttbb_ntag3_MuMu, h_jet2_ttjj_ntag3_MuMu);
	can3->cd();
	h_jet3_ttbb_ntag3_MuMu->Add(h_jet3_ttbb_ntag3_ElEl);
	h_jet3_ttbb_ntag3_MuMu->Add(h_jet3_ttbb_ntag3_MuEl);
	h_jet3_ttbb_ntag3_MuMu->Scale(1.0/(h_jet3_ttbb_ntag3_MuMu->Integral()+h_jet3_ttbb_ntag3_ElEl->Integral()+h_jet3_ttbb_ntag3_MuEl->Integral()));
	h_jet3_ttjj_ntag3_MuMu->Add(h_jet3_ttjj_ntag3_ElEl);
	h_jet3_ttjj_ntag3_MuMu->Add(h_jet3_ttjj_ntag3_MuEl);
	h_jet3_ttjj_ntag3_MuMu->Scale(1.0/(h_jet3_ttjj_ntag3_MuMu->Integral()+h_jet3_ttjj_ntag3_ElEl->Integral()+h_jet3_ttjj_ntag3_MuEl->Integral()));
	h_jet3_ttbb_ntag3_MuMu->Draw();
	h_jet3_ttjj_ntag3_MuMu->Draw("same");
	h_jet3_ttbb_ntag3_MuMu->SetStats(0);
	h_jet3_ttbb_ntag3_MuMu->SetMaximum(0.3);
	h_jet3_ttbb_ntag3_MuMu->SetTitle("third leading jet pt distibution");
	h_jet3_ttbb_ntag3_MuMu->GetXaxis()->SetTitle("Jet p_{T} (GeV)");
	h_jet3_ttbb_ntag3_MuMu->GetYaxis()->SetTitle("Normalized Entries");
  	SetLegend(h_jet3_ttbb_ntag3_MuMu, h_jet3_ttjj_ntag3_MuMu);
	can4->cd();
	h_jet4_ttbb_ntag3_MuMu->Add(h_jet4_ttbb_ntag3_ElEl);
	h_jet4_ttbb_ntag3_MuMu->Add(h_jet4_ttbb_ntag3_MuEl);
	h_jet4_ttbb_ntag3_MuMu->Scale(1.0/(h_jet4_ttbb_ntag3_MuMu->Integral()+h_jet4_ttbb_ntag3_ElEl->Integral()+h_jet4_ttbb_ntag3_MuEl->Integral()));
	h_jet4_ttjj_ntag3_MuMu->Add(h_jet4_ttjj_ntag3_ElEl);
	h_jet4_ttjj_ntag3_MuMu->Add(h_jet4_ttjj_ntag3_MuEl);
	h_jet4_ttjj_ntag3_MuMu->Scale(1.0/(h_jet4_ttjj_ntag3_MuMu->Integral()+h_jet4_ttjj_ntag3_ElEl->Integral()+h_jet4_ttjj_ntag3_MuEl->Integral()));
	h_jet4_ttbb_ntag3_MuMu->Draw();
	h_jet4_ttjj_ntag3_MuMu->Draw("same");
	h_jet4_ttbb_ntag3_MuMu->SetStats(0);
	h_jet4_ttbb_ntag3_MuMu->SetMaximum(0.3);
	h_jet4_ttbb_ntag3_MuMu->SetTitle("fourth leading jet pt distibution");
	h_jet4_ttbb_ntag3_MuMu->GetXaxis()->SetTitle("Jet p_{T} (GeV)");
	h_jet4_ttbb_ntag3_MuMu->GetYaxis()->SetTitle("Normalized Entries");
  	SetLegend(h_jet4_ttbb_ntag3_MuMu, h_jet4_ttjj_ntag3_MuMu);
	
}