00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00030
00031
00032
00034
00035 class StPadDisplayMaker;
00036 class StChain;
00037 StChain *chain = 0;
00038 StPadDisplayMaker *padMonitor;
00039
00040
00041 void Load(){
00042 gSystem->Load("St_base");
00043 gSystem->Load("StChain");
00044 gSystem->Load("StarClassLibrary");
00045 gSystem->Load("St_geom_Maker");
00046 gSystem->Load("StIOMaker");
00047 gSystem->Load("StPadDisplayMaker");
00048 gSystem->Load("StEventDisplayMaker");
00049 gROOT->LoadMacro("PadControlPanel.C");
00050 }
00051
00052 class StPadBrowserPanel {
00053 private:
00054 TControlBar *fBar;
00055 StPadDisplayMaker *fMaker;
00056 public:
00057 StPadBrowserPanel() { fBar=PadBrowserPanel();}
00058
00059 static TControlBar *PadBrowserPanel(TControlBar *bar=0)
00060 {
00061 if (bar) delete bar;
00062 bar = new TControlBar("vertical", "Pad Browser Control Panel");
00063
00064
00065 bar->AddButton("Add Axice","St_PolyLine3D::Axis();","Add 3D axice to the cuurent TPad view");
00066 bar->AddButton("Next Event", "StPadBrowserPanel::Make();", "Make one step");
00067 bar->AddButton("Draw Next Histogram", "StPadBrowserPanel::MakeHists(+1);", "Make one step");
00068 bar->AddButton("Draw Prev Histogram", "StPadBrowserPanel::MakeHists(-1);", "Make one step");
00069 bar->AddButton("Finish","StPadBrowserPanel::Finish();","Finish job");
00070
00071 bar->Show();
00072
00073 return bar;
00074 }
00075
00076 static void Make(){
00077 chain->Clear();
00078 if (chain->Make()>=kStEOF) printf("End of file\n");
00079 gPad->Update();
00080 }
00081
00082 static void MakeHists(Int_t direction=1,Int_t hId=0){
00083
00084 static TCanvas *histCanvas = 0;
00085 static Int_t histCounter = 0;
00086 if (!histCanvas) histCanvas = new TCanvas("Pads");
00087 histCanvas->cd();
00088 histCounter += direction;
00089 if (histCounter > 24) histCounter = 1;
00090 if (histCounter < 1) histCounter = 24;
00091 padMonitor->GetHists(hId+histCounter)->Draw("cont");
00092 }
00093
00094 static void Finish(){
00095 chain->Clear();
00096 chain->Finish();
00097 }
00098 };
00099
00100
00101 void PadBrowser(const Int_t Nevents=1,Char_t *infile=0)
00102 {
00103 Int_t NoEvents = Nevents;
00104 Char_t *iNfile = infile;
00105
00106
00107 if (!iNfile)
00108 iNfile ="/scr20/fine/datapool/st_physics_0003455_raw_0001.daq";
00109
00110
00111
00112 if (gClassTable->GetID("StPadDisplayMaker") < 0) Load();
00113
00114
00115 chain = new StChain("PadBrowser");
00116 inpMk = new StIOMaker("inputStream","r",iNfile);
00117 chain->SetInput("StDAQReader",".make/inputStream/.make/inputStream_DAQ/.const/StDAQReader");
00118 geomMaker = new St_geom_Maker();
00119 padMonitor = new StPadDisplayMaker("PadMonitor");
00120 chain->SetDebug();
00121
00122 chain->PrintInfo();
00123
00124
00125 int iInit = chain->Init();
00126 if (iInit) chain->Fatal(iInit,"on init");
00127 Int_t i=0;
00128 for (Int_t i =1; i <= NoEvents; i++){
00129 chain->Clear();
00130 if (chain->Make(i)>=kStEOF) break;
00131 gPad->Update();
00132 printf ("=========================================== Done with Event no. %d\n",i);
00133 }
00134 gSystem->Exec("date");
00135 StPadBrowserPanel *panel = new StPadBrowserPanel();
00136 }
00137