StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bfcread_hist_overlay.C
1 // $Id: bfcread_hist_overlay.C,v 1.7 2006/08/15 21:42:41 jeromel Exp $
2 // $Log: bfcread_hist_overlay.C,v $
3 // Revision 1.7 2006/08/15 21:42:41 jeromel
4 // Fix rhic -> rhic.bnl.gov
5 //
6 // Revision 1.6 2002/01/29 20:03:08 genevb
7 // Switched default dir from QA to EventQA
8 //
9 // Revision 1.5 2000/07/26 19:53:45 lansdell
10 // made changes for creating new QA histograms
11 //
12 // Revision 1.4 2000/04/12 15:06:53 kathy
13 // changed all macros that read DSTs to load Tables from libraries: gen,sim,global,dst instead of ALL Tables (previously loaded St_Tables); currently, if you are using DEV to read a DST in NEW,PRO, you must comment out the loading of libtpc_Tables because of a mismatch with tpt_track table
14 //
15 // Revision 1.3 2000/03/20 17:32:55 kathy
16 // setbranches in all macros so that they will work with softlinks - for StIOMaker
17 //
18 // Revision 1.2 2000/02/14 20:30:41 kathy
19 // removing unneeded macros; updating documentation in bfcread macros
20 //
21 // Revision 1.1 2000/01/31 18:48:41 kathy
22 // new macro to show how to use the Overlay methods that Curtis wrote - just by themselves
23 //
24 //======================================================================
25 // owner: Kathy Turner / Curtis Lansdell
26 // what it does: see below
27 //=======================================================================
28 // bfcread_hist_overlay.C
29 //
30 // what it does: reads the *.hist.root file produced from a chain
31 // (such as bfc) and then uses the Overlay* methods
32 // from StHistUtil class to overlay 2 histograms
33 // (this does a 1dim and 2dim example)
34 //
35 // inputs: MainFile - *.hist.root file from bfc output
36 // MakerHistDir - directory name of Maker that you want histograms
37 // from (this will be first input when you did constructor)
38 // -- see standard Maker names note below!
39 // TopDirTree - top level directory tree in your input hist file
40 // (this is 3rd argument of constructor for StTreeMaker that
41 // you probably used to write the *.hist.root file)
42 // NOTE: if you ran bfc, then the TopDirTree = bfcTree !!
43 // PageTitle - title at top of each page - if it's "", then it's
44 // set to MainFile by default
45 //
46 //
47 // Documentation on StHistUtil class is at:
48 // http://duvall.star.bnl.gov/STARAFS/comp/pkg/dev/StRoot/StAnalysisUtilities/doc/
49 //
50 //======================================================================
51 
52 class StChain;
53 StChain *chain;
54 
55 class StIOMaker;
56 StIOMaker *IOMk=0;
57 
58 //------------------------------------------------------------------------
59 
60 void bfcread_hist_overlay(
61  const Char_t *MainFile=
62  "/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root",
63  const Char_t *MakerHistDir="EventQA",
64  const Char_t *TopDirTree="bfcTree",
65  const Char_t *PageTitle="")
66 {
67 
68  cout << "bfcread_hist_overlay.C, input hist file = "
69  << MainFile << endl;
70  cout << "bfcread_hist_overlay.C, directory name for hist = "
71  << MakerHistDir << endl;
72  cout << "bfcread_hist_overlay.C, top level directory in hist file = "
73  << TopDirTree << endl;
74  cout << "bfcread_hist_overlay.C, hist page title " <<
75  PageTitle << endl;
76 
77 //
78  gSystem->Load("St_base");
79  gSystem->Load("StChain");
80  gSystem->Load("StIOMaker");
81  gSystem->Load("StarClassLibrary");
82  gSystem->Load("StUtilities");
83  gSystem->Load("StAnalysisUtilities");
84 
85 
86 // setup chain with IOMaker - can read in .dst.root, .dst.xdf files
87  StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree);
88  IOMk->SetDebug();
89  IOMk->SetIOMode("r");
90  IOMk->SetBranch("*",0,"0"); //deactivate all branches
91  IOMk->SetBranch("histBranch",0,"r"); //activate dst Branch
92 
93 
94 // constructor for other maker (not used in chain)
95  StHistUtil *HU = new StHistUtil;
96 
97 // now must set pointer to StMaker so HistUtil can find histograms
98 // with StHistUtil methods
99 // -- input any maker pointer but must cast as type StMaker
100  HU->SetPntrToMaker((StMaker *)IOMk);
101 
102 // ONLY use StIOMaker in chain
103 // --- now execute chain member functions - 1 event (histograms) only
104  IOMk->Init();
105  IOMk->Clear();
106  IOMk->Make();
107 
108  cout <<" bfcread_hist_overlay.C, have read histograms" << endl;
109 
110  if (PageTitle=="") PageTitle=MainFile;
111  HU->SetGlobalTitle(PageTitle);
112 
113 // 1Dim. overlay
114  Int_t result = HU->Overlay1D(MakerHistDir,
115  "TabQaGtrkRT","TabQaPtrkRT");
116  if (result == kStErr)
117  cout << " !!! There was an error in Overlay1D !!!" << endl;
118 
119 // 2Dim. overlay
120  result = HU->Overlay2D(MakerHistDir,
121  "TabQaGtrkLengthVEtaT","TabQaPtrkLengthVEtaT");
122  if (result == kStErr)
123  cout << " !!! There was an error in Overlay2D !!!" << endl;
124 
125 
126  cout <<" bfcread_hist_overlay.C, end of macro" << endl;
127 
128 }
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
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
Definition: Stypes.h:44