#include "TDirectory.h"
#include "TFile.h"
#include "TGraph.h"
#include "TGraphPolar.h"
#include "TH1F.h"
#include "TH2F.h"
#include <iostream>
Go to the source code of this file.
int test_simple_01_verify |
( |
| ) |
|
Definition at line 13 of file test_simple_01_verify.cxx.
15 TFile*
f = TFile::Open(
"tfile_output.root");
23 bool rc = gDirectory->cd(
"hist");
29 rc = gDirectory->cd(
"a");
36 gDirectory->GetObject(
"test1", h1);
38 cerr <<
"test1 not found\n";
42 gDirectory->GetObject(
"z", h1);
44 cerr <<
"z incorrectly found\n";
48 gDirectory->GetObject(
"test1", h2);
50 cerr <<
"test1 incorrectly identified as a TH2F\n";
55 rc = gDirectory->cd(
"../b");
60 gDirectory->GetObject(
"test2", h2);
62 cerr <<
"test2 not found\n";
67 rc = gDirectory->cd(
"../respondToOpenInputFile");
72 gDirectory->GetObject(
"test3", h3);
74 cerr <<
"test3 not found\n";
79 rc = gDirectory->cd(
"/hist");
83 TGraph* pgraph =
nullptr;
84 gDirectory->GetObject(
"graphAtTopLevel", pgraph);
85 if (pgraph ==
nullptr) {
86 cerr <<
"graphAtTopLevel not found\n";
89 string title = pgraph->GetTitle();
90 if (title !=
"graph at top level") {
91 cerr <<
"TGraph at top level not recovered with correct title\n";
96 rc = gDirectory->cd(
"b");
100 TGraphPolar* ppolar =
nullptr;
101 gDirectory->GetObject(
"graphInSubdirectory", ppolar);
102 if (ppolar ==
nullptr) {
103 cerr <<
"graphInSubdirectory not found\n";
106 title = ppolar->GetTitle();
107 if (title !=
"graph in subdirectory") {
108 cerr <<
"TGraph in subdirectory not recovered with correct title\n";