Calling a private constructor of class 'TFile'

Hello,

I am trying to use root to display a series of Histograms on a cent OS virtual machine.
I am supposed to call “root analysis.C” and this analysis.C file calls an output.root file that I think it may contain the data for the histograms.

After calling “root analysis.C” this appears:

 ------------------------------------------------------------
  | Welcome to ROOT 6.14/04                http://root.cern.ch |
  |                               (c) 1995-2018, The ROOT Team |
  | Built for linuxx8664gcc                                    |
  | From tags/v6-14-04@v6-14-04, Aug 23 2018, 17:00:44         |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

root [0] 
Processing analysis.C...
/home/oocampo/Documentos/G4_examples_test/extended/medical/dna/pdb4dna/./analysis.C:30:13: error: calling a private constructor of class 'TFile'
  TFile f = TFile("pdb4dna_output.root");
            ^
/home/oocampo/Documentos/programas/root_builddir/include/TFile.h:156:4: note: declared private here
   TFile(const TFile &);            //Files cannot be copied
   ^
/home/oocampo/Documentos/G4_examples_test/extended/medical/dna/pdb4dna/./analysis.C:54:8: error: member reference type 'TH1D *' is a pointer; did you mean to use '->'?
  hist1.GetStats(pdbStats);
  ~~~~~^
       ->
/home/oocampo/Documentos/G4_examples_test/extended/medical/dna/pdb4dna/./analysis.C:57:8: error: member reference type 'TH1D *' is a pointer; did you mean to use '->'?
  hist2.GetStats(pdbStats);
  ~~~~~^
       ->
/home/oocampo/Documentos/G4_examples_test/extended/medical/dna/pdb4dna/./analysis.C:60:8: error: member reference type 'TH1D *' is a pointer; did you mean to use '->'?
  hist3.GetStats(pdbStats);
  ~~~~~^
       ->

I am trying to display the histograms for a Geant4 example called pdb4dna.

Thanks a lot for your help.

TFile f("pdb4dna_output.root");
// ... or ...
TFile *f = TFile::Open("pdb4dna_output.root");
// ... and for each histogram pointer ...
hist123->GetStats(pdbStats);

BTW. When you post “source code” or “output” here, do remember to enclose them into two lines which contain just three characters ``` (see how your post has been edited above).

Thank you so much, it solved the problem.

Also thanks a lot for the info on using this ```.

Cheers!