StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PadBrowser.C
1 //*-- Author : Valery Fine 22/06/99 (E-mail: fine@bnl.gov)
2 // $Id: PadBrowser.C,v 1.9 2000/01/27 20:54:09 fine Exp $
3 // $Log: PadBrowser.C,v $
4 // Revision 1.9 2000/01/27 20:54:09 fine
5 // StarClassLibrary has been added
6 //
7 // Revision 1.8 1999/12/19 03:15:42 fine
8 // StEventDisplayMker loaded
9 //
10 // Revision 1.7 1999/09/08 23:28:57 fine
11 // Histogram browser fixed
12 //
13 // Revision 1.6 1999/09/08 19:35:19 fine
14 // PAdMonitor access to DAQ via IO Maker
15 //
16 // Revision 1.5 1999/06/29 20:51:26 fine
17 // St_geom_Maker has been introduced
18 //
19 // Revision 1.4 1999/06/25 18:34:00 fine
20 // MakeDoc was commented out
21 //
22 // Revision 1.3 1999/06/24 02:13:59 fine
23 // New buttons and bug fixes
24 //
25 // Revision 1.2 1999/06/23 19:25:18 fine
26 // Wrong index fixed
27 //
28 //
30 // //
31 // Macro for running PadBrowser maker //
32 // //
34 
35 class StPadDisplayMaker;
36 class StChain;
37 StChain *chain = 0;
38 StPadDisplayMaker *padMonitor;
39 
40 //_______________________________________________________________________________________
41 void Load(){
42  gSystem->Load("St_base");
43  gSystem->Load("StChain");
44  gSystem->Load("StarClassLibrary");
45  gSystem->Load("St_geom_Maker");
46  gSystem->Load("StIOMaker");
47  gSystem->Load("StPadDisplayMaker");
48  gSystem->Load("StEventDisplayMaker");
49  gROOT->LoadMacro("PadControlPanel.C");
50 }
51 //_______________________________________________________________________________________
53  private:
54  TControlBar *fBar;
55  StPadDisplayMaker *fMaker;
56  public:
57  StPadBrowserPanel() { fBar=PadBrowserPanel();}
58  //_______________________________________________________________________________________
59  static TControlBar *PadBrowserPanel(TControlBar *bar=0)
60  {
61  if (bar) delete bar;
62  bar = new TControlBar("vertical", "Pad Browser Control Panel");
63 
64  // bar->AddButton("Init", "StPadBrowserPanel::Init();", "Load share library and initialize the maker");
65  bar->AddButton("Add Axice","St_PolyLine3D::Axis();","Add 3D axice to the cuurent TPad view");
66  bar->AddButton("Next Event", "StPadBrowserPanel::Make();", "Make one step");
67  bar->AddButton("Draw Next Histogram", "StPadBrowserPanel::MakeHists(+1);", "Make one step");
68  bar->AddButton("Draw Prev Histogram", "StPadBrowserPanel::MakeHists(-1);", "Make one step");
69  bar->AddButton("Finish","StPadBrowserPanel::Finish();","Finish job");
70 
71  bar->Show();
72 
73  return bar;
74  }
75  //_______________________________________________________________________________________
76  static void Make(){
77  chain->Clear();
78  if (chain->Make()>=kStEOF) printf("End of file\n");
79  gPad->Update();
80  }
81  //_______________________________________________________________________________________
82  static void MakeHists(Int_t direction=1,Int_t hId=0){
83  // Display 2D histograms for given sector
84  static TCanvas *histCanvas = 0;
85  static Int_t histCounter = 0;
86  if (!histCanvas) histCanvas = new TCanvas("Pads");
87  histCanvas->cd();
88  histCounter += direction;
89  if (histCounter > 24) histCounter = 1;
90  if (histCounter < 1) histCounter = 24;
91  padMonitor->GetHists(hId+histCounter)->Draw("cont");
92  }
93  //_______________________________________________________________________________________
94  static void Finish(){
95  chain->Clear();
96  chain->Finish();
97  }
98 };
99 
100 //_______________________________________________________________________________________
101 void PadBrowser(const Int_t Nevents=1,Char_t *infile=0)
102 {
103  Int_t NoEvents = Nevents;
104  Char_t *iNfile = infile;
105  // define input file
106  // daq data
107  if (!iNfile)
108  iNfile ="/scr20/fine/datapool/st_physics_0003455_raw_0001.daq";
109 // iNfile ="/star/datapool/1/daq/st_physics_0003455_raw_0001.daq";
110 // iNfile ="/star/tpctest/taper1.R0000000033";
111  // Dynamically link some shared libs
112  if (gClassTable->GetID("StPadDisplayMaker") < 0) Load();
113 
114  // Create the main chain object
115  chain = new StChain("PadBrowser");
116  inpMk = new StIOMaker("inputStream","r",iNfile);
117  chain->SetInput("StDAQReader",".make/inputStream/.make/inputStream_DAQ/.const/StDAQReader");
118  geomMaker = new St_geom_Maker();
119  padMonitor = new StPadDisplayMaker("PadMonitor");
120  chain->SetDebug();
121 // chain->MakeDoc();
122  chain->PrintInfo();
123 
124  // Init the chain and all its makers
125  int iInit = chain->Init();
126  if (iInit) chain->Fatal(iInit,"on init");
127  Int_t i=0;
128  for (Int_t i =1; i <= NoEvents; i++){
129  chain->Clear();
130  if (chain->Make(i)>=kStEOF) break;
131  gPad->Update();
132  printf ("=========================================== Done with Event no. %d\n",i);
133  }
134  gSystem->Exec("date");
135  StPadBrowserPanel *panel = new StPadBrowserPanel();
136 }
137 
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
Definition: Stypes.h:43
virtual Int_t Make()
Definition: StChain.cxx:110