Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-8007

Z-axis title of cloned TH2D not correctly updated

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.06/00
    • Fix Version/s: None
    • Component/s: Core Libraries
    • Labels:
      None
    • Environment:

      Arch Linux x86_64 GCC 5.3.0

      Description

      When running a piece of code like this one

          c = new TCanvas("VertexLowerTrd_Final_EffectiveArea", "VertexLowerTrd_Final_EffectiveArea", 1600, 900);
          c->cd();
          c->SetRightMargin(0.12);
          histosVertexSelectionLowerTrd.back()->Draw("colz");
          histosVertexSelectionLowerTrd.back()->SetTitle("total effective area");
          gPad->SetLogx(1);
          c->SaveAs(".root");
          c->SaveAs(".pdf");
          c->SaveAs(".png");
       
          c = new TCanvas("VertexLowerTrd_Efficiency", "VertexLowerTrd_Efficiency", 1600, 900);
          c->cd();
          c->SetRightMargin(0.12);
          TH2D* hVertexLowerTrdEfficiency = static_cast<TH2D*>(histosVertexSelectionLowerTrd.back()->Clone("hVertexLowerTrdEfficiency"));
          hVertexLowerTrdEfficiency->Divide(histosVertexPreselection.front());
          hVertexLowerTrdEfficiency->GetZaxis()->SetTitle("efficiency");
          hVertexLowerTrdEfficiency->SetTitle("cut efficiency");
          hVertexLowerTrdEfficiency->Draw("colz");
          gPad->SetLogx(1);
          c->SaveAs(".root");
          c->SaveAs(".pdf");
          c->SaveAs(".png");

      I find that that the second histogram does not have the correct z axis title, it appears that the title is inherited from the histogram it was cloned from and the 'SetTitle' on the Z-axis does not have any effect.

      Interactively, when clicking into the histogram, at some point the axis title will refresh and it's ok afterwards.

      This probably means that I can get this code to work with some gPad->Update(), gPad->Modified() calls, but this used to work with ROOT 5.34, so it looks like a regression.

        Attachments

          Activity

            People

            • Assignee:
              couet Olivier Couet
              Reporter:
              bbeische Bastian Beischer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Actual End: