StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bfcread_hist_printinfo.C
1 // $Id: bfcread_hist_printinfo.C,v 2.2 2002/01/29 20:03:08 genevb Exp $
2 // $Log: bfcread_hist_printinfo.C,v $
3 // Revision 2.2 2002/01/29 20:03:08 genevb
4 // Switched default dir from QA to EventQA
5 //
6 // Revision 2.1 2000/06/23 18:04:54 kathy
7 // new macro that uses new method in StHistUtil to dump hist info (name,entries,mean,rms) to screen & file
8 //
9 //
10 //=======================================================================
11 // owner: Kathy Turner
12 //
13 // bfcread_hist_printinfo.C
14 //
15 // what it does:
16 // - reads in *.hist.root file produced from a chain
17 // (such as bfc)
18 // - prints info about each histogram found to screen & output file
19 //
20 // inputs:
21 // MainFile - *.hist.root file from bfc output
22 // fname - output text file with histogram info
23 // MakerHistDir - directory name of Maker that you want histograms
24 // from (this will be first input when you did constructor)
25 // -- see standard Maker names note below!
26 // TopDirTree - top level directory tree in your input hist file
27 // (this is 3rd argument of constructor for StTreeMaker that
28 // you probably used to write the *.hist.root file)
29 // NOTE: if you ran bfc, then the TopDirTree = bfcTree !!
30 //
31 //======================================================================
32 
33 class StChain;
34 StChain *chain;
35 
36 class StIOMaker;
37 StIOMaker *IOMk=0;
38 
39 class StHistUtil;
40 
41 //------------------------------------------------------------------------
42 
43 void bfcread_hist_printinfo(
44  const Char_t *MainFile=
45  "/star/rcf/test/dev/tfs_redhat61/Tue/year_1h/hc_standard/hc_standard.40_evts.hist.root",
46  const Char_t *fname="HistInfo.out",
47  const Char_t *MakerHistDir="EventQA",
48  const Char_t *TopDirTree="bfcTree")
49 {
50  cout << "bfcread_hist_printinfo.C, input hist file = "
51  << MainFile << endl;
52  cout << "bfcread_hist_printinfo.C, output hist info file = "
53  << fname << endl;
54  cout << "bfcread_hist_printinfo.C, directory name for hist = "
55  << MakerHistDir << endl;
56  cout << "bfcread_hist_printinfo.C, top level directory in hist file = "
57  << TopDirTree << endl;
58 
59 //
60  gSystem->Load("St_base");
61  gSystem->Load("StChain");
62  gSystem->Load("StIOMaker");
63  gSystem->Load("StarClassLibrary");
64  gSystem->Load("StUtilities");
65  gSystem->Load("StAnalysisUtilities");
66  gSystem->Load("libglobal_Tables");
67 
68 // constructor for other maker (not used in chain)
69  StHistUtil *HU = new StHistUtil;
70 
71 // read in file:
72  StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree);
73  IOMk->SetIOMode("r");
74  IOMk->SetBranch("*",0,"0"); //deactivate all branches
75  IOMk->SetBranch("histBranch",0,"r"); //activate hist Branch
76 
77 // --- each file contains only histograms (1 "event" == 1 Make call)
78  IOMk->Init();
79  IOMk->Clear();
80  IOMk->Make();
81 // - end of read
82 
83  HU->SetPntrToMaker((StMaker *)IOMk);
84 
85 // get the TList pointer to the histograms:
86  TList *dirList = 0;
87  dirList = HU->FindHists(MakerHistDir);
88 
89 // now make a copy of all histograms into my new histograms!
90  Int_t hCCount=0;
91  hCCount = HU->PrintInfoHists(dirList,fname);
92 
93  cout << "bfcread_hist_printinfo.C, # histograms found = " <<
94  hCCount << endl;
95 
96 
97 } // end of the macro!
98 
99 
100 
101 
102 
103 
104 
virtual void Clear(Option_t *opt)
User defined functions.
Definition: StIOMaker.cxx:252
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual Int_t Make()
Definition: StIOMaker.cxx:183