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

TF1: Error when reading two functions with the same formula

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 6.14/00, 6.14/04
    • Fix Version/s: 6.16/00, 6.14/06
    • Component/s: Math Libraries
    • Labels:
      None
    • Environment:

      Arch Linux x86_64
      GCC 8.1.1

      Description

      When reading two TF1s with the same formula, say '[0]*x + [1]' from a ROOT file the following error message is printed:

      input_line_68:2:10: error: redefinition of 'TFormula____id76870135910997656'
      Double_t TFormula____id76870135910997656(Double_t *x,Double_t *p){ return p[0]+p[1]*x[0] ; }
               ^
      input_line_62:2:10: note: previous definition is here
      Double_t TFormula____id76870135910997656(Double_t *x,Double_t *p){ return p[0]+p[1]*x[0] ; }
      

      This bug can be reproduced with the two ROOT scripts attached (first run write.C, then read.C).

      int write() {
       
        TF1* f1 = new TF1("f1", "[0] + [1]*x", 0, 1);
        TF1* f2 = new TF1("f2", "[0] + [1]*x", 0, 1);
        TFile* f = TFile::Open("test.root", "RECREATE");
        f1->Write();
        f2->Write();
        f->Close();
       
        return 0;
      }
      

      int read() {
       
        TFile* f = TFile::Open("test.root", "READ");
        TF1* f1 = dynamic_cast<TF1*>(f->Get("f1"));
        TF1* f2 = dynamic_cast<TF1*>(f->Get("f2"));
       
        new TCanvas;
        f1->Draw();
        new TCanvas;
        f2->Draw();
       
        return 0;
      }
      

        Attachments

        1. read.C
          0.2 kB
        2. write.C
          0.2 kB

          Activity

            People

            Assignee:
            moneta Lorenzo Moneta
            Reporter:
            bbeische Bastian Beischer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Actual End: