Help me fixing these errors, am trying to plot the 3 root files on 1 graph
but here is the error and warning am getting!!
Comparison $ root FConvo.C
------------------------------------------------------------------
| Welcome to ROOT 6.30/04 https://root.cern |
| (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for macosx64 on Jan 31 2024, 08:17:06 |
| From heads/master@tags/v6-30-04 |
| With Apple clang version 15.0.0 (clang-1500.3.9.4) |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
root [0]
Processing FConvo.C...
In file included from input_line_8:1:
/Users/Desktop/Comparison/FConvo.C:11:4: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
sprintf(fname1,"result.root");
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
In file included from input_line_8:1:
/Users/Desktop/Comparison/FConvo.C:12:4: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
sprintf(fname2,"result1.root");
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
In file included from input_line_8:1:
/Users/Desktop/Comparison/FConvo.C:13:4: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
sprintf(fname3,"result2.root");
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
In file included from input_line_8:1:
/Users/Desktop/Comparison/FConvo.C:29:4: error: use of undeclared identifier 'h1'
h1 = (TH1D*)file1->Get("ND_eDep");
^
/Users/Desktop/Comparison/FConvo.C:30:4: error: use of undeclared identifier 'h2'
h2 = (TH2D*)file2->Get("ND_eDep");
^
/Users/Desktop/Comparison/FConvo.C:31:4: error: use of undeclared identifier 'h3'
h3 = (TH2D*)file3->Get("ND_eDep");
^
/Users/Desktop/Comparison/FConvo.C:39:21: error: use of undeclared identifier 'h1'
Double_t cent= h1->GetBinCenter(k);
^
/Users/Desktop/Comparison/FConvo.C:40:21: error: use of undeclared identifier 'h1'
Int_t counts = h1->GetBinContent(k);
^
/Users/Desktop/Comparison/FConvo.C:44:30: error: use of undeclared identifier 'myRand'
Double_t var_rand=myRand->Gaus(cent,bin_sigma);
^
/Users/Desktop/Comparison/FConvo.C:55:21: error: use of undeclared identifier 'h2'
Double_t cent= h2->GetBinCenter(k);
^
/Users/Desktop/Comparison/FConvo.C:56:21: error: use of undeclared identifier 'h2'
Int_t counts = h2->GetBinContent(k);
^
/Users/Desktop/Comparison/FConvo.C:60:30: error: use of undeclared identifier 'myRand'
Double_t var_rand=myRand->Gaus(cent,bin_sigma);
^
/Users/Desktop/Comparison/FConvo.C:71:21: error: use of undeclared identifier 'h3'
Double_t cent= h3->GetBinCenter(k);
^
/Users/Desktop/Comparison/FConvo.C:72:21: error: use of undeclared identifier 'h3'
Int_t counts = h3->GetBinContent(k);
^
/Users/Desktop/Comparison/FConvo.C:76:24: error: use of undeclared identifier 'myRand'
Double_t var_rand=myRand->Gaus(cent,bin_sigma);
^
/Users/Desktop/Comparison/FConvo.C:89:16: error: use of undeclared identifier 'h1'
leg->AddEntry(h1,"Material1","L");
^
/Users/Desktop/Comparison/FConvo.C:90:16: error: use of undeclared identifier 'h2'
leg->AddEntry(h2,"Material2","L");
^
/Users/Desktop/Comparison/FConvo.C:91:16: error: use of undeclared identifier 'h2'
leg->AddEntry(h2,"Material3","L");
^
root [1]
The code is this
FConvo.C (2.1 KB)