THMtest Class Reference

#include <THMtest.h>

List of all members.

Public Member Functions

void Test1 ()
void Test1_1 ()
void Test2 (const char *filename)
void Test3 (const char *filename)

Detailed Description

Definition at line 4 of file THMtest.h.


Member Function Documentation

void THMtest::Test1 (  ) 

Definition at line 13 of file THMtest.cxx.

References HistMan::Adopt(), HistMan::Book(), HistMan::Fill1d(), Munits::g, HistMan::Get(), and n.

00013                     {
00014 
00015     HistMan hist("mypackage/mymodule/myalgorithm");
00016     
00017     TH1D* small = hist.Book<TH1D>("small","A few entries",100,-10,10);
00018     cout << "small hist at " << (void*)small << endl;
00019 
00020     hist.Book<TH1D>("big","Lots of entries",100,-10,10);
00021     
00022     hist.Fill1d("small",42);     
00023     hist.Fill1d("small",6,9);
00024     
00025     TH1D* big = hist.Get<TH1D>("big");
00026     assert(big);
00027     for (int n=0; n<100000; ++n) {
00028         double g = gRandom->Gaus();
00029         big->Fill(g);
00030     }
00031     
00032     TGraph* graph = new TGraph();
00033     graph->SetName("graph");
00034     for (int ind=0; ind<1000; ++ind) 
00035         graph->SetPoint(ind,ind,gRandom->Landau());
00036 
00037     hist.Adopt("",graph);
00038 
00039     TObject* g = hist.Get<TObject>("graph");
00040     cerr << "TGraph at 0x" << (void*)g << endl;
00041 
00042     // "hist" goes out of scope
00043 }

void THMtest::Test1_1 (  ) 

Definition at line 45 of file THMtest.cxx.

References HistMan::Get().

00046 {
00047     HistMan hm("mypackage/mymodule/myalgorithm");
00048     TH1D* hist = hm.Get<TH1D>("small");
00049     cout << "small hist at " << (void*)hist << endl;
00050 }

void THMtest::Test2 ( const char *  filename  ) 

Definition at line 52 of file THMtest.cxx.

References HistMan::Book(), HistMan::Fill1d(), Munits::g, HistMan::Get(), n, and HistMan::WriteOut().

00052                                         {
00053 
00054     cerr << "Creating HistMan(\"\")\n";
00055     HistMan hist("");
00056     
00057     cerr << "Booking\n";
00058     hist.Book<TH1D>("small2","A few entries",100,-10,10);
00059     hist.Book<TH1D>("big2","Lots of entries",100,-10,10);
00060     
00061     hist.Fill1d("small2",42);     
00062     hist.Fill1d("small2",6,9);
00063     
00064     TH1D* big = hist.Get<TH1D>("big2");
00065     assert(big);
00066     for (int n=0; n<100000; ++n) {
00067         double g = gRandom->Gaus();
00068         big->Fill(g);
00069     }
00070     
00071 #if 0
00072     TFile file(filename,"RECREATE");
00073     hist.WriteOut(file);
00074     file.Close();
00075 #else
00076     hist.WriteOut(filename);
00077 #endif    
00078     // Both "file" and "hist" go out of scope
00079 };

void THMtest::Test3 ( const char *  filename  ) 

Definition at line 81 of file THMtest.cxx.

References HistMan::Get().

00082 {
00083     TFile f(filename);
00084     HistMan hm(f);
00085     TH1D* h= hm.Get<TH1D>("mypackage/mymodule/myalgorithm/small");
00086     cerr << "small hist at: " << (void*)h << endl;
00087 }


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1