HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoMonitorGui.cxx
Go to the documentation of this file.
1 #include "HarpoMonitorGui.h"
2 
3 #include <TPad.h>
4 #include <TF1.h>
5 #include <TH1.h>
6 #include <TH2.h>
7 #include <THStack.h>
8 #include <TLine.h>
9 #include <TCanvas.h>
10 #include <TRootEmbeddedCanvas.h>
11 #include <TGFrame.h>
12 #include <TGComboBox.h>
13 #include <TGButton.h>
14 #include <TGLabel.h>
15 #include <TGText.h>
16 #include <TGButtonGroup.h>
17 #include <TGNumberEntry.h>
18 #include <TGListBox.h>
19 #include <TObjArray.h>
20 #include <TLegend.h>
21 #include <TClonesArray.h>
22 #include <TSystemDirectory.h>
23 #include <TSystem.h>
24 #include <TStyle.h>
25 #include <TChain.h>
26 #include <TProfile.h>
27 #include <TGraph.h>
28 #include <TGaxis.h>
29 #include <TLatex.h>
30 #include <TMath.h>
31 
32 #include <TGTab.h>
33 #include <TApplication.h>
34 
35 #include "TThread.h"
36 #include "TMethodCall.h"
37 #include "TMapFile.h"
38 #include "TKey.h"
39 #include "TList.h"
40 
41 #include <math.h>
42 #include "HarpoAnalyseMonitorNew.h"
43 
44 
45 #include <iostream>
46 using namespace std;
47 #include <fstream>
48 #include <iomanip>
49 #include <sstream>
50 
51 
52 
54 
55 
63 };
64 
65 void *handle1(void *)
66 {
67 
68  Int_t sleep = 0;
69  while(1){
70  TThread::Lock();
71  //cout << "Lock" << endl;
72  Int_t delay = gHarpoGui->GetDelay();
73  if(gHarpoGui->fAutoRefresh && sleep>delay){
75  sleep = 0;
76  }
77  //cout << "Unlock" << endl;
78  TThread::UnLock();
79  gSystem->Sleep(1000); // sleep for 0.1 seconds
80  sleep += 1000;
81  }
82  return 0;
83 
84 }
85 
86 
87 HarpoMonitorGui::HarpoMonitorGui(const TGWindow *p, UInt_t w, UInt_t h, UInt_t opt)
88  : TGMainFrame(p, w, h, opt)
89 {
90 
91 
92  gHarpoGui = this;
93 
94 // TGTextButton* fDisplay;
95 // TGTextButton* fDisplayBox;
96 // TGTextButton* fSave;
97 
98  sprintf(rundir,"outputs/");
99 
100  // display = 0;
101 
102  ecTabEvent = 0;
103  ecTabCumul = 0;
104  ecTabTrigger = 0;
105  ecTabPmm2 = 0;
106  ecTabTT = 0;
107  ecSideSummary = 0;
108  cTabEvent = 0;
109  cTabCumul = 0;
110  cTabTrigger = 0;
111  cTabPmm2 = 0;
112  cTabTT = 0;
113  cSideSummary = 0;
114 
115  fFrameMain = 0;
116  fChooseRun = 0;
117  fChooseEvent = 0;
118  fChooseNEvents = 0;
119  fDisplayEvent = 0;
120  fNextEvent = 0;
121  fDisplay = 0;
122  fDisplayBox = 0;
123  fSave = 0;
124  // fCheckNoise = 0;
125  fCheckClusters = 0;
126  fLog = 0;
127 
128  fTmin = 0; fTmax = 1000;
129 
130 
131  nPadPlanes = 1;
132 
133  fRunNumber = 0;
134  fPerpendicular = kFALSE;
135 
136  fAutoRefresh = kTRUE;
138 
139  for(Int_t n = 0; n< 100; n++)
140  padHelpArray[n] = 0;
141  // signalHelp = 0;
142  hist2d = 0;
143  noiseHist = 0;
144 
145  noisemax = 5;
146 
147 
148  UInt_t xsize1 = 200;
149  UInt_t xsize2 = 800;
150  UInt_t mainx = xsize1 + xsize2;
151  UInt_t mainy = 700;
152 
153  gStyle->SetFrameBorderMode(1);
154  gStyle->SetFrameBorderSize(1);
155  gStyle->SetOptStat(0);
156  // TGLayoutHints* fLayout1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5);
157  // TGLayoutHints* fLayout12 = new TGLayoutHints(kLHintsLeft,5,5,5,5);
158  // TGLayoutHints* fLayout2 = new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5);
159  // // TGLayoutHints* fLayout3 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX,5,5,5,5);
160  // TGLayoutHints* fLayout3 = new TGLayoutHints(kLHintsBottom ,5,5,5,5);
161  // this->SetLayoutBroken(kTRUE);
162 
163  TGVerticalFrame* f1 = new TGVerticalFrame(this,xsize1,mainy,kVerticalFrame);
164  TGVerticalFrame* f2 = new TGVerticalFrame(this,xsize2,mainy,kVerticalFrame);
165  this->AddFrame(f1,new TGLayoutHints(kLHintsLeft | kLHintsExpandY,5,5,5,5));
166  this->AddFrame(f2,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
167  TGVerticalFrame* f20 = new TGVerticalFrame(f2,xsize2,mainy,kVerticalFrame);
168  f2->AddFrame(f20,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
169  TGHorizontalFrame* f21 = new TGHorizontalFrame(f2,xsize2,80,kHorizontalFrame);
170  f2->AddFrame(f21,new TGLayoutHints(kLHintsBottom ,5,5,5,5));
171 
172  BuildButtonsFrame(f1);
173  BuildDisplayFrame(f20);
174  BuildInfoFrame(f21);
175 
176  // Open the memory mapped file "hsimple.map" in "READ" (default) mode.
177  // for(Int_t i = 0; i<5; i++){
178  mfile = TMapFile::Create("/tmp/harpo.map");
179  // std::cout << mfile->cd() << std::endl;
180  // if(mfile->cd()) break;
181  // gSystem->Sleep(1000);
182  // }
183  if(!mfile->cd()){
184  Warning("Constructor","Could not open data file");
185  return;
186  }
187 
188  // Print status of mapped file and list its contents
189  mfile->Print();
190  if(gHarpoDebug>0)
191  mfile->ls();
192  mfile->Close();
193 
194 
195  // Open the memory mapped file "hsimple.map" in "READ" (default) mode.
196  // for(Int_t i = 0; i<5; i++){
197  mfilePmm2 = TMapFile::Create("/tmp/harpoPmm2.map");
198  // std::cout << mfilePmm2->cd() << std::endl;
199  // if(mfilePmm2->cd()) break;
200  // gSystem->Sleep(1000);
201  // }
202  if(!mfilePmm2->cd()){
203  Warning("Constructor","Could not open Pmm2 file");
204  }
205 
206  // Print status of mapped file and list its contents
207  mfilePmm2->Print();
208  if(gHarpoDebug>0)
209  mfilePmm2->ls();
210  mfilePmm2->Close();
211 
212 
213  MapSubwindows();
214  MapWindow();
215  SetWindowName("HARPO Monitor");
216  MoveResize(0,0,mainx,mainy);
217 
218  Layout();
219 
220  fAutoScale = kFALSE;
221 
222 
223  StartThread();
224 
225  SetStyle();
226 
227 }
228 
229 
230 
232 {
233  // Got close message for this MainFrame. Terminate the application
234  // or returns from the TApplication event loop (depending on the
235  // argument specified in TApplication::Run()).
236 
237  Save();
238 
239  gApplication->Terminate(0);
240 
241 
242 }
243 
244 
245 
246 void HarpoMonitorGui::BuildDisplayFrame(TGVerticalFrame* f20)
247 {
248 
249  UInt_t xsize2 = f20->GetWidth();
250  UInt_t mainy = f20->GetHeight();
251 
252  fEventLabel = new TGLabel(f20,"FEMINOS: NO DATA");
253  fEventLabel->SetHeight(40);
254  f20->AddFrame(fEventLabel,new TGLayoutHints(kLHintsExpandX,5,5,5,5));
255 
256  fEventPmm2Label = new TGLabel(f20,"PMM2: NO DATA");
257  fEventPmm2Label->SetHeight(40);
258  f20->AddFrame(fEventPmm2Label,new TGLayoutHints(kLHintsExpandX,5,5,5,5));
259 
260  TGTab* fTab = new TGTab(f20, xsize2, mainy);
261 
262  TGCompositeFrame *tf = fTab->AddTab("Current Event");
263  ecTabEvent = new TRootEmbeddedCanvas("ecTabEvent",tf,xsize2,mainy);
264  tf->AddFrame(ecTabEvent,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
265 
266  tf = fTab->AddTab("Cumulated data");
267  ecTabCumul = new TRootEmbeddedCanvas("ecTabCumul",tf,xsize2,mainy);
268  tf->AddFrame(ecTabCumul,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
269 
270  tf = fTab->AddTab("Trigger data");
271  ecTabTrigger = new TRootEmbeddedCanvas("ecTabTrigger",tf,xsize2,mainy);
272  tf->AddFrame(ecTabTrigger,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
273 
274  tf = fTab->AddTab("PMm2 data");
275  ecTabPmm2 = new TRootEmbeddedCanvas("ecTabPmm2",tf,xsize2,mainy);
276  tf->AddFrame(ecTabPmm2,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
277 
278  tf = fTab->AddTab("Traversing tracks");
279  ecTabTT = new TRootEmbeddedCanvas("ecTabTT",tf,xsize2,mainy);
280  tf->AddFrame(ecTabTT,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
281 
282 
283  f20->AddFrame(fTab,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
284 
285 }
286 
287 void HarpoMonitorGui::BuildInfoFrame(TGHorizontalFrame* f21)
288 {
289 
290  UInt_t xsize2 = f21->GetWidth();
291  UInt_t ysize = f21->GetHeight();
292  TGVerticalFrame* f211 = new TGVerticalFrame(f21,xsize2/4,ysize,kVerticalFrame);
293  TGVerticalFrame* f212 = new TGVerticalFrame(f21,xsize2/4,ysize,kVerticalFrame);
294  TGVerticalFrame* f213 = new TGVerticalFrame(f21,xsize2/4,ysize,kVerticalFrame);
295  TGVerticalFrame* f214 = new TGVerticalFrame(f21,xsize2/4,ysize,kVerticalFrame);
296  TGLayoutHints* fLayout3 = new TGLayoutHints(kLHintsBottom ,5,5,5,5);
297  f21->AddFrame(f211,fLayout3);
298  f21->AddFrame(f212,fLayout3);
299  f21->AddFrame(f213,new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,5,5,5,5));
300  f21->AddFrame(f214,fLayout3);
301 
302 }
303 
304 void HarpoMonitorGui::BuildButtonsFrame(TGVerticalFrame* f1)
305 {
306 
307  UInt_t xsize1 = f1->GetWidth();
308  UInt_t ysize = 20;
309  TGLayoutHints* fLayout1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5);
310  // TGLayoutHints* fLayout12 = new TGLayoutHints(kLHintsLeft,5,5,5,5);
311  TGLayoutHints* fLayout2 = new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5);
312  // TGLayoutHints* fLayout3 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX,5,5,5,5);
313  //TGLayoutHints* fLayout3 = new TGLayoutHints(kLHintsBottom ,5,5,5,5);
314 
315  TGHorizontalFrame* autorefreshFrame = new TGHorizontalFrame(f1,xsize1,ysize,kHorizontalFrame);
316  TGLabel* fDelayLabel = new TGLabel(f1, "Delay [s]");
317  fChooseDelay = new TGNumberEntry(autorefreshFrame);
318  fChooseDelay->Resize(xsize1 -20 ,ysize);
319  fAutoRefreshButton = new TGTextButton(autorefreshFrame, "Freeze", M_AUTOREFRESH);
320  fAutoRefreshButton->Resize(20, ysize);
321  fAutoRefreshButton->Associate(this);
322  // fChooseDir->Select(1);
323  autorefreshFrame->AddFrame(fAutoRefreshButton,fLayout2);
324  autorefreshFrame->AddFrame(fDelayLabel,fLayout2);//new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,5,5,5,5));
325  autorefreshFrame->AddFrame(fChooseDelay,fLayout2);
326  fChooseDelay->SetNumber(2);
327 
328 
329  fDisplayEvent = new TGTextButton(f1,"Display Current Event",M_DISPLAY_EVENT);
330  fDisplayEvent->Associate(this);
331 
332  fNextEvent = new TGTextButton(f1,"Next Event",M_NEXT_EVENT);
333  fNextEvent->Associate(this);
334  fNextEvent->SetState(kButtonDisabled,kFALSE);
335 
336  fPrevEvent = new TGTextButton(f1,"Previous Event",M_PREV_EVENT);
337  fPrevEvent->Associate(this);
338  fPrevEvent->SetState(kButtonDisabled,kFALSE);
339 
340  fSaveButton = new TGTextButton(f1,"Save Plots",M_SAVE);
341  fSaveButton->Associate(this);
342  // fSaveButton->SetState(kButtonDisabled,kTRUE);
343 
344 
345  ecSideSummary = new TRootEmbeddedCanvas("ecSideSummary",f1,xsize1,300);
346 
347 
348  // fLog = new TGListBox(f1);
349  // fLog->Resize(xsize1,300);
350 
351  f1->AddFrame(autorefreshFrame,fLayout2);
352  f1->AddFrame(fDisplayEvent,fLayout2);
353  f1->AddFrame(fNextEvent,fLayout2);
354  f1->AddFrame(fPrevEvent,fLayout2);
355  f1->AddFrame(fSaveButton,fLayout2);
356  f1->AddFrame(ecSideSummary,fLayout1);
357  // f1->AddFrame(fLog,fLayout1);
358 }
359 
360 
361 
362 
363 
364 
365 
366 void HarpoMonitorGui::SetListOfRuns(TGComboBox* box, const char* dirname)
367 {
368  cout << "Get List of files in " << dirname << endl;
369 
370  const char* pwd = gSystem->ExpandPathName("$PWD");
371  TSystemDirectory* sysdir = new TSystemDirectory("data_dir",dirname);
372  TList* listoffiles = sysdir->GetListOfFiles();
373  listoffiles->Sort();
374 
375  box->RemoveAll();
376 
377  cout << "Nfiles = " << listoffiles->GetEntries() << endl;
378  for(Int_t Nfile = 0; Nfile<listoffiles->GetEntries(); Nfile++){
379 
380  Int_t runnumber;
381  // Char_t buffer[126];
382  const char* filename = listoffiles->At(Nfile)->GetName();
383  if(sscanf(filename,"reduced-%d",&runnumber)){
384  box->AddEntry(filename, Nfile);
385  }
386  }
387 
388  sysdir->Delete();
389  TSystemDirectory* startdir = new TSystemDirectory("startdir",pwd);
390  startdir->GetListOfFiles();
391  return;
392 
393 }
394 
395 
396 
397 
399 {
400 
401  printf("Starting Thread 0\n");
402  fThread1 = new TThread("t0", handle1, (void*) 0);
403  fThread1->Run();
404 
405 }
406 
407 
408 
410 {
411 
412  return kTRUE;
413 
414 }
415 
417 {
418 
419 // Open the memory mapped file "hsimple.map" in "READ" (default) mode.
420  mfile = TMapFile::Create("/tmp/harpo.map","READ",50000000);
421  if(!mfile->cd()){
422  Warning("DisplayEvent","Could not open data file");
423  return;
424  }
425 
426  // if(!mfile->cd()){
427  // return;
428  // }
429  if(!mfile->Get("hX")){
430  return;
431  }
432 
433  TH1F* hTmin_X = 0; hTmin_X = (TH1F*)mfile->Get("hTmin_X",hTmin_X);
434  TH1F* hTmin_Y = 0; hTmin_Y = (TH1F*)mfile->Get("hTmin_Y",hTmin_Y);
435  TH1F* hTmax_X = 0; hTmax_X = (TH1F*)mfile->Get("hTmax_X",hTmax_X);
436  TH1F* hTmax_Y = 0; hTmax_Y = (TH1F*)mfile->Get("hTmax_Y",hTmax_Y);
437 
438  TH1F* hTdrift_TT_X = 0; hTdrift_TT_X = (TH1F*)mfile->Get("hTdrift_TT_X",hTdrift_TT_X);
439  TH1F* hTdrift_TT_Y = 0; hTdrift_TT_Y = (TH1F*)mfile->Get("hTdrift_TT_Y",hTdrift_TT_Y);
440  TH1F* hQvsT_TT_X = 0; hQvsT_TT_X = (TH1F*)mfile->Get("hQvsT_TT_X",hQvsT_TT_X);
441  TH1F* hQvsT_TT_Y = 0; hQvsT_TT_Y = (TH1F*)mfile->Get("hQvsT_TT_Y",hQvsT_TT_Y);
442  TH2F* hQvsT_TT2D_X = 0; hQvsT_TT2D_X = (TH2F*)mfile->Get("hQvsT_TT2D_X",hQvsT_TT2D_X);
443  TH2F* hQvsT_TT2D_Y = 0; hQvsT_TT2D_Y = (TH2F*)mfile->Get("hQvsT_TT2D_Y",hQvsT_TT2D_Y);
444  TGraphErrors* gQtotTT_X = 0; gQtotTT_X = (TGraphErrors*)mfile->Get("gQtotTT_X",gQtotTT_X);
445  TGraphErrors* gQtotTT_Y = 0; gQtotTT_Y = (TGraphErrors*)mfile->Get("gQtotTT_Y",gQtotTT_Y);
446 
447 
448  TH1F* hT_X = 0; hT_X = (TH1F*)mfile->Get("hT_X",hT_X);
449  TH1F* hT_Y = 0; hT_Y = (TH1F*)mfile->Get("hT_Y",hT_Y);
450  TH1F* hCh_X = 0; hCh_X = (TH1F*)mfile->Get("hCh_X",hCh_X);
451  TH1F* hCh_Y = 0; hCh_Y = (TH1F*)mfile->Get("hCh_Y",hCh_Y);
452  TH1F* hQ_X = 0; hQ_X = (TH1F*)mfile->Get("hQ_X",hQ_X);
453  TH1F* hQ_Y = 0; hQ_Y = (TH1F*)mfile->Get("hQ_Y",hQ_Y);
454  TH1F* hQev_X = 0; hQev_X = (TH1F*)mfile->Get("hQev_X",hQev_X);
455  TH1F* hQev_Y = 0; hQev_Y = (TH1F*)mfile->Get("hQev_Y",hQev_Y);
456  TH1F* hQtotT_X = 0; hQtotT_X = (TH1F*)mfile->Get("hQtotT_X",hQtotT_X);
457  TH1F* hQtotT_Y = 0; hQtotT_Y = (TH1F*)mfile->Get("hQtotT_Y",hQtotT_Y);
458  TH1F* hQtot_X = 0; hQtot_X = (TH1F*)mfile->Get("hQtot_X",hQtot_X);
459  TH1F* hQtot_Y = 0; hQtot_Y = (TH1F*)mfile->Get("hQtot_Y",hQtot_Y);
460  TH1F* hTZs_X = 0; hTZs_X = (TH1F*)mfile->Get("hTZs_X",hTZs_X);
461  TH1F* hTZs_Y = 0; hTZs_Y = (TH1F*)mfile->Get("hTZs_Y",hTZs_Y);
462  TH1F* hChZs_X = 0; hChZs_X = (TH1F*)mfile->Get("hChZs_X",hChZs_X);
463  TH1F* hChZs_Y = 0; hChZs_Y = (TH1F*)mfile->Get("hChZs_Y",hChZs_Y);
464  TH1F* hQZs_X = 0; hQZs_X = (TH1F*)mfile->Get("hQZs_X",hQZs_X);
465  TH1F* hQZs_Y = 0; hQZs_Y = (TH1F*)mfile->Get("hQZs_Y",hQZs_Y);
466  TH1F* hQevZs_X = 0; hQevZs_X = (TH1F*)mfile->Get("hQevZs_X",hQevZs_X);
467  TH1F* hQevZs_Y = 0; hQevZs_Y = (TH1F*)mfile->Get("hQevZs_Y",hQevZs_Y);
468  TH1F* hQtotTZs_X = 0; hQtotTZs_X = (TH1F*)mfile->Get("hQtotTZs_X",hQtotTZs_X);
469  TH1F* hQtotTZs_Y = 0; hQtotTZs_Y = (TH1F*)mfile->Get("hQtotTZs_Y",hQtotTZs_Y);
470  TH1F* hQtotZs_X = 0; hQtotZs_X = (TH1F*)mfile->Get("hQtotZs_X",hQtotZs_X);
471  TH1F* hQtotZs_Y = 0; hQtotZs_Y = (TH1F*)mfile->Get("hQtotZs_Y",hQtotZs_Y);
472  TH1F* hInfo = 0; hInfo = (TH1F*)mfile->Get("hInfo",hInfo);
473  TH1F* hPmm2 = 0; hPmm2 = (TH1F*)mfile->Get("hPmm2",hPmm2);
474  TH1F* hTev_X = 0; hTev_X = (TH1F*)mfile->Get("hTev_X",hTev_X);
475  TH1F* hTev_Y = 0; hTev_Y = (TH1F*)mfile->Get("hTev_Y",hTev_Y);
476  TH1F* hTevZs_X = 0; hTevZs_X = (TH1F*)mfile->Get("hTevZs_X",hTevZs_X);
477  TH1F* hTevZs_Y = 0; hTevZs_Y = (TH1F*)mfile->Get("hTevZs_Y",hTevZs_Y);
478  TH1F* hQtotTev_X = 0; hQtotTev_X = (TH1F*)mfile->Get("hQtotTev_X",hQtotTev_X);
479  TH1F* hQtotTev_Y = 0; hQtotTev_Y = (TH1F*)mfile->Get("hQtotTev_Y",hQtotTev_Y);
480  TH1F* hQtotTevZs_X = 0; hQtotTevZs_X = (TH1F*)mfile->Get("hQtotTevZs_X",hQtotTevZs_X);
481  TH1F* hQtotTevZs_Y = 0; hQtotTevZs_Y = (TH1F*)mfile->Get("hQtotTevZs_Y",hQtotTevZs_Y);
482  TH2F* hX = 0; hX = (TH2F*)mfile->Get("hX",hX);
483  TH2F* hXZs = 0; hXZs = (TH2F*)mfile->Get("hXZs",hXZs);
484  TH2F* hY = 0; hY = (TH2F*)mfile->Get("hY",hY);
485  TH2F* hYZs = 0; hYZs = (TH2F*)mfile->Get("hYZs",hYZs);
486  TH2F* hCumul_X = 0; hCumul_X = (TH2F*)mfile->Get("hCumul_X",hCumul_X);
487  TH2F* hCumul_Y = 0; hCumul_Y = (TH2F*)mfile->Get("hCumul_Y",hCumul_Y);
488  // TH1F* hTriggerCreated = 0; hTriggerCreated = (TH1F*)mfile->Get("hTriggerCreated",hTriggerCreated);
489  // TH1F* hTriggerTraversing = 0; hTriggerTraversing = (TH1F*)mfile->Get("hTriggerTraversing",hTriggerTraversing);
490  // TH1F* hTriggerEmpty = 0; hTriggerEmpty = (TH1F*)mfile->Get("hTriggerEmpty",hTriggerEmpty);
491  // TH1F* hTriggerSaturated = 0; hTriggerSaturated = (TH1F*)mfile->Get("hTriggerSaturated",hTriggerSaturated);
492  // TH1F* hTriggerOther = 0; hTriggerOther = (TH1F*)mfile->Get("hTriggerOther",hTriggerOther);
493  TH1F* hPmm2Size = 0; hPmm2Size = (TH1F*)mfile->Get("hPmm2Size",hPmm2Size);
494  TH1F* hPmm2Missed = 0; hPmm2Missed = (TH1F*)mfile->Get("hPmm2Missed",hPmm2Missed);
495  TH1F* hPmm2Triggered = 0; hPmm2Triggered = (TH1F*)mfile->Get("hPmm2Triggered",hPmm2Triggered);
496  TH2F* hPmm2Spectrum2D = 0; hPmm2Spectrum2D = (TH2F*)mfile->Get("hPmm2Spectrum2D",hPmm2Spectrum2D);
497  TH2F* hPmm2Coincidence = 0; hPmm2Coincidence = (TH2F*)mfile->Get("hPmm2Coincidence",hPmm2Coincidence);
498  // TGraphErrors* gRateCreated = 0; gRateCreated = (TGraphErrors*)mfile->Get("gRateCreated_1",gRateCreated);
499  // TGraphErrors* gRateTraversing = 0; gRateTraversing = (TGraphErrors*)mfile->Get("gRateTraversing_1",gRateTraversing);
500  // TGraphErrors* gRateEmpty = 0; gRateEmpty = (TGraphErrors*)mfile->Get("gRateEmpty_1",gRateEmpty);
501  // TGraphErrors* gRateSaturated = 0; gRateSaturated = (TGraphErrors*)mfile->Get("gRateSaturated_1",gRateSaturated);
502  // TGraphErrors* gRateOther = 0; gRateOther = (TGraphErrors*)mfile->Get("gRateOther_1",gRateOther);
503 
504  TGraph* gXTmin = 0; gXTmin = (TGraph*)mfile->Get("gXTmin",gXTmin);
505  TGraph* gYTmin = 0; gYTmin = (TGraph*)mfile->Get("gYTmin",gYTmin);
506  gXTmin->SetMarkerStyle(7);
507  if(gXTmin->GetN()>500)
508  gXTmin->SetMarkerStyle(6);
509  if(gXTmin->GetN()>2500)
510  gXTmin->SetMarkerStyle(1);
511  gYTmin->SetMarkerStyle(7);
512  if(gYTmin->GetN()>500)
513  gYTmin->SetMarkerStyle(6);
514  if(gYTmin->GetN()>2500)
515  gYTmin->SetMarkerStyle(1);
516 
517  const Int_t kNtrackTypes = 5;
518  const char* trackTypeNames[kNtrackTypes] = {"Empty","Traversing","Created","Saturated","Other"};
519  TH1F* hTrigger[kNtrackTypes];
520  TGraphErrors* gRate[kNtrackTypes];
521  for(Int_t i = 0; i<kNtrackTypes; i++){
522  hTrigger[i] = 0; hTrigger[i] = (TH1F*)mfile->Get(Form("hTrigger%s",trackTypeNames[i]),hTrigger[i]);
523  //Info("process","%s %d",trackTypeNames[i],hTrigger[i]);
524  gRate[i] = 0; gRate[i] = (TGraphErrors*)mfile->Get(Form("gRate%s_1",trackTypeNames[i]),gRate[i]);
525  }
526  TH1F* hTriggerCorrection = 0; hTriggerCorrection = (TH1F*)mfile->Get("hTriggerCorrection",hTriggerCorrection);
527  // TGraphErrors* gRateTotal = 0; gRateTotal = (TGraphErrors*)mfile->Get("gRateTotal_1",gRateTotal);
528  const Int_t kNtriggerTypes = 16;
529  TGraphErrors* gRateTotal[kNtriggerTypes+1];
530  TH1F* hDeadTime[kNtriggerTypes+1];
531  Int_t triggerColors[kNtriggerTypes+1] = {kBlack,kGray,kWhite,kRed,kBlue,kGreen,kMagenta,kWhite,kRed,kBlue,kGreen,kMagenta,kCyan,kOrange,kWhite,kBlack,kWhite};
532  const char* triggerNames[kNtriggerTypes+1] = {"Unknown",
533  "Traversing Z",
534  "------",
535  "Gamma",
536  "No Mesh",
537  "Inv Mesh",
538  "No Up",
539  "------",
540  "Gamma, L",
541  "No Mesh, L",
542  "Inv Mesh, L",
543  "No Up, L",
544  "No PM, L",
545  "No L",
546  "------",
547  "Cosmic",
548  ""};
549 
550  for(Int_t i = 0; i<kNtriggerTypes+1; i++){
551  gRateTotal[i] = 0; gRateTotal[i] = (TGraphErrors*)mfile->Get(Form("gRateTotal_%d",i),gRateTotal[i]);
552  gRateTotal[i]->SetLineColor(triggerColors[i]);
553  gRateTotal[i]->SetMarkerColor(triggerColors[i]);
554  if(i == 2 || i == 7)
555  gRateTotal[i]->SetMarkerStyle(7);
556  hDeadTime[i] = 0; hDeadTime[i] = (TH1F*)mfile->Get(Form("hDeadTime_%d",i),hDeadTime[i]);
557  hDeadTime[i]->SetLineColor(triggerColors[i]);
558  }
559 
560 
561 
562  Int_t runNo = hInfo->GetBinContent(1);
563  fRunNumber = runNo;
564  Int_t nEvent = hInfo->GetBinContent(2);
565  fEventNumber = nEvent;
566  Int_t skipEvents = hInfo->GetBinContent(6);
567  Int_t firstEvent = hInfo->GetBinContent(7);
568  Double_t timeStamp = hInfo->GetBinContent(3)/1e8; // in seconds
569  Int_t triggerType = hInfo->GetBinContent(8);
570  if(gHarpoDebug>0)
571  Info("DisplayEvent","Run %d, Event %d",runNo,nEvent);
572 
573  mfile->Close();
574 
575  // SetCanvases();
576 
577  if(!cTabEvent){
578  cTabEvent = ecTabEvent->GetCanvas();
579  cTabEvent->SetName("cTabEvent");
580  cTabEvent->Divide(2);
581  }// else
582  // c1->Clear();
583 
584 
585  //Double_t x1 = 0, y1 = 0, x2 = 0, y2 = 0;
586 
587  TLatex* latex = new TLatex();
588  latex->SetTextFont(132);
589  latex->SetTextAlign(12);
590  latex->SetTextSize(0.1);
591 
592  if(!fAutoScale){
593  hX->GetZaxis()->SetRangeUser(0,4096);
594  hY->GetZaxis()->SetRangeUser(0,4096);
595  hXZs->GetZaxis()->SetRangeUser(0,4096);
596  hYZs->GetZaxis()->SetRangeUser(0,4096);
597  }
598  // cTabEvent->cd(1);
599  // hCumul_X->DrawCopy("colz");
600  // cTabEvent->cd(2);
601  // hCumul_Y->DrawCopy("colz");
602  // cTabEvent->cd(1);
603  // hXZs->DrawCopy("colz");
604  // cTabEvent->cd(2);
605  // hYZs->DrawCopy("colz");
606  MakeNice2dHisto(hXZs,cTabEvent->GetPad(1),1);
607  latex->DrawLatex(30,260,Form("evt %d",nEvent));
608  latex->DrawLatex(30,240,triggerNames[triggerType+1]);
609 
610  TLine* line = new TLine();
611  line->SetLineWidth(2);
612  line->SetLineStyle(2);
613  line->DrawLine(0,194,511,194);
614  line->DrawLine(0,94,511,94);
615  line->SetLineWidth(1);
616  line->SetLineStyle(3);
617  line->DrawLine(0,259,511,259);
618  line->DrawLine(0,226,511,226);
619  line->DrawLine(0,160.5,511,160.5);
620  line->DrawLine(0,127.5,511,127.5);
621  line->DrawLine(0,61.5,511,61.5);
622  line->DrawLine(0,28.5,511,28.5);
623 
624  MakeNice2dHisto(hYZs,cTabEvent->GetPad(2),1);
625  latex->DrawLatex(30,260,Form("evt %d",nEvent));
626  latex->DrawLatex(30,240,triggerNames[triggerType+1]);
627  line->SetLineWidth(2);
628  line->SetLineStyle(2);
629  line->DrawLine(0,194,511,194);
630  line->DrawLine(0,94,511,94);
631 
632 
633 
634  // cTabEvent->cd(5);
635  // cTabEvent->GetPad(5)->SetLogy();
636  // hQev_X->DrawCopy("");
637  // hQev_Y->DrawCopy("same");
638  // hQevZs_X->DrawCopy("same");
639  // hQevZs_Y->DrawCopy("same");
640  // cTabEvent->cd(6);
641  // // hChZs_X->DrawCopy("");
642  // // hChZs_Y->DrawCopy("same");
643  // hTmin_X->DrawCopy("");
644  // hTmin_Y->DrawCopy("same");
645  // hTmax_X->DrawCopy("same");
646  // hTmax_Y->DrawCopy("same");
647 
648  // cTabEvent->cd(1);
649  // latex->DrawLatex(20,280,"X direction");
650  // cTabEvent->cd(2);
651  // latex->DrawLatex(20,280,"Y direction");
652 
653  TBox* boxX[8];
654  TBox* boxY[8];
655  for(Int_t i = 0; i<8; i++){
656  boxX[i] = new TBox();
657  boxY[i] = new TBox();
658  }
659 
660  for(int ch = 0; ch<16; ch++){
661  Double_t q = hPmm2->GetBinContent(ch+1);
662  //Info("DisplayEvent","Q = %g",q);
663  if(q==-1) continue;
664  Int_t color = 0;
665  if(q==0) color = kBlack;
666  else
667  color = 51 + q*49./800.;
668 
669  switch(ch){
670  case 1:
671  boxX[2]->SetFillColor(color);
672  break;
673  case 2:
674  boxX[3]->SetFillColor(color);
675  break;
676  case 3:
677  boxX[1]->SetFillColor(color);
678  boxY[1]->SetFillColor(color);
679  break;
680  case 4:
681  boxX[0]->SetFillColor(color);
682  boxY[0]->SetFillColor(color);
683  break;
684  case 5:
685  boxX[5]->SetFillColor(color);
686  boxY[5]->SetFillColor(color);
687  break;
688  case 6:
689  boxX[4]->SetFillColor(color);
690  boxY[4]->SetFillColor(color);
691  break;
692  case 7:
693  boxY[6]->SetFillColor(color);
694  break;
695  case 8:
696  boxY[7]->SetFillColor(color);
697  break;
698  case 9:
699  boxX[6]->SetFillColor(color);
700  break;
701  case 10:
702  boxX[7]->SetFillColor(color);
703  break;
704  case 11:
705  boxY[2]->SetFillColor(color);
706  break;
707  case 12:
708  boxY[3]->SetFillColor(color);
709  break;
710  }
711  }
712 
713  cTabEvent->cd(1);
714  boxX[0]->DrawBox(1,50,11,150);
715  boxX[1]->DrawBox(1,154,11,254);
716  boxX[2]->DrawBox(60,290,250,300);
717  boxX[3]->DrawBox(260,290,450,300);
718  boxX[4]->DrawBox(500,50,510,150);
719  boxX[5]->DrawBox(500,154,510,254);
720  boxX[6]->DrawBox(60,4,250,14);
721  boxX[7]->DrawBox(260,4,450,14);
722  cTabEvent->cd(2);
723  boxY[0]->DrawBox(1,50,11,150);
724  boxY[1]->DrawBox(1,154,11,254);
725  boxY[2]->DrawBox(60,290,250,300);
726  boxY[3]->DrawBox(260,290,450,300);
727  boxY[4]->DrawBox(500,50,510,150);
728  boxY[5]->DrawBox(500,154,510,254);
729  boxY[6]->DrawBox(60,4,250,14);
730  boxY[7]->DrawBox(260,4,450,14);
731  // cTabEvent->cd(3);
732  // boxX[0]->DrawBox(1,50,11,150);
733  // boxX[1]->DrawBox(1,154,11,254);
734  // boxX[2]->DrawBox(60,290,250,300);
735  // boxX[3]->DrawBox(260,290,450,300);
736  // boxX[4]->DrawBox(500,50,510,150);
737  // boxX[5]->DrawBox(500,154,510,254);
738  // boxX[6]->DrawBox(60,4,250,14);
739  // boxX[7]->DrawBox(260,4,450,14);
740  // cTabEvent->cd(4);
741  // boxY[0]->DrawBox(1,50,11,150);
742  // boxY[1]->DrawBox(1,154,11,254);
743  // boxY[2]->DrawBox(60,290,250,300);
744  // boxY[3]->DrawBox(260,290,450,300);
745  // boxY[4]->DrawBox(500,50,510,150);
746  // boxY[5]->DrawBox(500,154,510,254);
747  // boxY[6]->DrawBox(60,4,250,14);
748  // boxY[7]->DrawBox(260,4,450,14);
749 
750 
751  if(!cTabCumul){
752  cTabCumul = ecTabCumul->GetCanvas();
753  cTabCumul->SetName("cTabCumul");
754  cTabCumul->Divide(2,3);
755  }// else
756  // cTabCumul->Clear();
757 
758 
759  cTabCumul->cd(1);
760  MakeNice2dHisto(hCumul_X,cTabCumul->GetPad(1));
761  gXTmin->Draw("Psame");
762  // hCumul_X->DrawCopy("colz");
763  cTabCumul->cd(2);
764  MakeNice2dHisto(hCumul_Y,cTabCumul->GetPad(2));
765  // hCumul_Y->DrawCopy("colz");
766  gYTmin->Draw("Psame");
767 
768  //Double_t ymax = 0;
769  cTabCumul->cd(3);
770  hQ_X->GetXaxis()->SetRangeUser(10,4096);
771  MakeNice1dHisto(hQ_X,cTabCumul->GetPad(3));
772  // hQ_X->DrawCopy();
773  hQ_Y->DrawCopy("same");
774  cTabCumul->GetPad(3)->SetLogx();
775  cTabCumul->GetPad(3)->SetLogy();
776  cTabCumul->cd(4);
777  // cTabCumul->GetPad(4)->SetLogx();
778  cTabCumul->GetPad(4)->SetLogy();
779  MakeNice1dHisto(hTmin_X,cTabCumul->GetPad(4));
780  // hTmin_X->DrawCopy("");
781  hTmin_Y->DrawCopy("same");
782  // if(hQtotT_X->GetMaximum()>ymax) ymax = hQtotT_X->GetMaximum();
783  // if(hQtotT_Y->GetMaximum()>ymax) ymax = hQtotT_Y->GetMaximum();
784  // if(hQtotTZs_X->GetMaximum()>ymax) ymax = hQtotTZs_X->GetMaximum();
785  // if(hQtotTZs_Y->GetMaximum()>ymax) ymax = hQtotTZs_Y->GetMaximum();
786  // hQtotT_X->SetMaximum(ymax);
787  // hQtotT_X->DrawCopy();
788  // hQtotT_Y->DrawCopy("same");
789  // hQtotTZs_X->DrawCopy("same");
790  // hQtotTZs_Y->DrawCopy("same");
791 
792  cTabCumul->cd(5);
793  MakeNice1dHisto(hCh_X,cTabCumul->GetPad(5));
794  // hCh_X->DrawCopy();
795  hCh_Y->DrawCopy("same");
796  hChZs_X->DrawCopy("same");
797  hChZs_Y->DrawCopy("same");
798  cTabCumul->cd(6);
799  cTabCumul->GetPad(6)->SetLogx();
800  cTabCumul->GetPad(6)->SetLogy();
801  hQtotZs_X->SetLineStyle(1);
802  hQtotZs_Y->SetLineStyle(1);
803  MakeNice1dHisto(hQtotZs_X,cTabCumul->GetPad(6));
804  MakeNice1dHisto(hQtotZs_Y,cTabCumul->GetPad(6),"same");
805  // hQtot_X->DrawCopy();
806  // hQtot_Y->DrawCopy("same");
807  // hQtotZs_X->DrawCopy("same");
808  // hQtotZs_Y->DrawCopy("same");
809 
810 
811 
812  // cTabEvent->cd(5);
813  // hTZs_X->DrawCopy("same");
814  // hTZs_Y->DrawCopy("same");
815  // cTabEvent->cd(6);
816  // hChZs_X->DrawCopy("");
817  // hChZs_Y->DrawCopy("same");
818  if(!cTabTrigger){
819  cTabTrigger = ecTabTrigger->GetCanvas();
820  cTabTrigger->SetName("cTabTrigger");
821  cTabTrigger->Divide(2,2);
822  }// else
823  cTabTrigger->cd(1);
824  THStack* hTriggerStack = new THStack("hTriggerStack",";");
825  THStack* hTriggerStack2 = new THStack("hTriggerStack",";");
826 
827  Int_t color[5] = {kGreen, kBlue, kYellow, kMagenta, kRed};
828  TLegend* lTrigger = new TLegend(0.6,0.6,0.9,0.9);
829  for(Int_t i = 0; i<kNtrackTypes; i++){
830  hTrigger[i]->SetFillColor(color[i]);
831  hTrigger[i]->Scale(skipEvents*1./timeStamp);
832  gRate[i]->SetMarkerColor(color[i]);
833  gRate[i]->SetLineColor(color[i]);
834  gRate[i]->SetFillColor(color[i]-10);
835  for(Int_t k = 0; k<16;k++)
836  hTrigger[i]->GetXaxis()->SetBinLabel(k+1,triggerNames[k]);
837 
838  hTrigger[i]->GetXaxis()->SetTitle("");
839  hTrigger[i]->GetYaxis()->SetTitle("Measured rate [Hz]");
840  hTrigger[i]->GetXaxis()->LabelsOption("v");
841  hTriggerStack->Add(hTrigger[i]);
842  lTrigger->AddEntry(hTrigger[i],trackTypeNames[i],"F");
843  }
844  // gRateTotal->SetFillColor(kGray);
845  if(hTriggerStack->GetMaximum()>0)
846  hTrigger[0]->SetMaximum(1.1*hTriggerStack->GetMaximum());
847  MakeNice1dHisto(hTrigger[0],cTabTrigger->GetPad(1));
848  cTabTrigger->GetPad(1)->SetBottomMargin(0.16);
849  hTriggerStack->Draw("same");
850  lTrigger->Draw();
851  for(Int_t k = 0; k<16;k++)
852  hTriggerCorrection->GetXaxis()->SetBinLabel(k+1,triggerNames[k]);
853  Double_t totalRate[kNtriggerTypes+1];
854  for(Int_t k = 0; k<kNtriggerTypes+1;k++)
855  totalRate[k] = 0;
856  for(Int_t i = 0; i<kNtrackTypes; i++){
857  hTrigger[i]->GetYaxis()->SetTitle("Actual rate [Hz]");
858  hTrigger[i]->Multiply(hTriggerCorrection);
859  hTriggerStack2->Add(hTrigger[i]);
860  for(Int_t k = 0; k<kNtriggerTypes+1;k++)
861  totalRate[k] += hTrigger[i]->GetBinContent(k+1);
862  }
863  latex->DrawLatex(0,50,Form("Created: %.0fHz",hTrigger[2]->GetBinContent(9)));
864  latex->DrawLatex(0,42,Form("Empty: %.0fHz",hTrigger[0]->GetBinContent(9)));
865  latex->DrawLatex(0,34,Form("TTz: %.0fHz",hTrigger[1]->GetBinContent(9)));
866 
867  if(hTriggerStack2->GetMaximum()>0)
868  hTrigger[0]->SetMaximum(1.1*hTriggerStack2->GetMaximum());
869  MakeNice1dHisto(hTrigger[0],cTabTrigger->GetPad(3));
870  cTabTrigger->GetPad(3)->SetBottomMargin(0.16);
871  hTriggerStack2->Draw("same");
872  lTrigger->Draw();
873 
874  Double_t maxDeadTime = 0;
875  for(Int_t i = 0; i<kNtriggerTypes; i++){
876  Double_t tmp = hDeadTime[i]->GetMaximum();
877  if(tmp>maxDeadTime) maxDeadTime = tmp;
878  }
879  hDeadTime[0]->SetMaximum(maxDeadTime);
880  hDeadTime[0]->GetXaxis()->SetRangeUser(0,100);
881  MakeNice1dHisto(hDeadTime[0],cTabTrigger->GetPad(4));
882  cTabTrigger->GetPad(4)->SetLogy();
883  TF1* fExp = new TF1("fExp","expo",0,500);
884 
885 
886  TLegend* lDT = new TLegend(0.6,0.6,0.98,0.91);
887  for(Int_t i = 0; i<kNtriggerTypes; i++){
888  hDeadTime[i]->Draw("same");
889  if(skipEvents>1) continue;
890  if(hDeadTime[i]->GetEntries()<50) continue;
891  hDeadTime[i]->Fit(fExp,"q0","",0,50);
892  fExp->SetLineColor(triggerColors[i]);
893  fExp->DrawCopy("same");
894  lDT->AddEntry(hDeadTime[i],Form("%s: %.0fHz/%.0fHz",triggerNames[i],-1000.*fExp->GetParameter(1),totalRate[i]));
895  // latex->DrawLatex(xlatexDT,ylatexDT,triggerNames[i]);
896  // ylatexDT *= 0.8;
897  }
898  lDT->Draw();
899 
900  if(!cTabPmm2){
901  cTabPmm2 = ecTabPmm2->GetCanvas();
902  cTabPmm2->SetName("cTabPmm2");
903  cTabPmm2->Divide(2,2);
904  }
905  hPmm2Size->SetMinimum(0.1);
906  if(timeStamp)
907  hPmm2Size->Scale(skipEvents*1./timeStamp);
908  hPmm2Size->SetTitle("PM signal rate;PM channel; rate [Hz]");
909  TLegend* lSizePmm2 = new TLegend(0.6,0.6,0.9,0.9);
910  if(hPmm2Size->GetEntries()){
911  MakeNice1dHisto(hPmm2Size,cTabPmm2->GetPad(1));
912  lSizePmm2->AddEntry(hPmm2Size,"Triggered signals","L");
913  }
914  if(hPmm2Size->GetEntries())
915  cTabPmm2->GetPad(1)->SetLogy();
916 
917  MakeNice2dHisto(hPmm2Spectrum2D,cTabPmm2->GetPad(3));
918  if(hPmm2Spectrum2D->GetEntries())
919  cTabPmm2->GetPad(3)->SetLogz();
920  // cTabPmm2->GetPad(4)->SetLogz();
921  // MakeNice2dHisto(hPmm2Coincidence,cTabPmm2->GetPad(4));
922 
923 
924 
925 
926  if(!cTabTT){
927  cTabTT = ecTabTT->GetCanvas();
928  cTabTT->SetName("cTabTT");
929  cTabTT->Divide(2,2);
930  }
931  Int_t nTT = 0;
932  const Int_t TRIG_TT = 0;
933  for(Int_t i = 0; i<kNtrackTypes; i++)
934  nTT += hTrigger[i]->GetBinContent(2+TRIG_TT);
935  //Info("process","nTT = %d",nTT);
936  //Info("","scale: %g",hInfo->GetBinContent(9));
937  if(hInfo->GetBinContent(9)){
938  // hQvsT_TT_X->Scale(skipEvents*1./timeStamp/nTT);
939  // hQvsT_TT_Y->Scale(skipEvents*1./timeStamp/nTT);
940  // hQvsT_TT_X->Scale(skipEvents*hTriggerCorrection->GetBinContent(2+TRIG_TT)/timeStamp/nTT);
941  // hQvsT_TT_Y->Scale(skipEvents*hTriggerCorrection->GetBinContent(2+TRIG_TT)/timeStamp/nTT);
942  hQvsT_TT_X->Scale(1./hInfo->GetBinContent(9));
943  hQvsT_TT_Y->Scale(1./hInfo->GetBinContent(9));
944  }
945  MakeNice2dHisto(hQvsT_TT2D_X,cTabTT->GetPad(1));
946  hQvsT_TT_X->SetLineColor(kBlack);
947  hQvsT_TT_X->SetLineWidth(3);
948  hQvsT_TT_X->DrawCopy("same");
949  MakeNice2dHisto(hQvsT_TT2D_Y,cTabTT->GetPad(2));
950  hQvsT_TT_Y->SetLineColor(kBlack);
951  hQvsT_TT_Y->SetLineWidth(3);
952  hQvsT_TT_Y->DrawCopy("same");
953 
954  MakeNice1dHisto(hTdrift_TT_X,cTabTT->GetPad(3));
955  MakeNice1dHisto(hTdrift_TT_Y,cTabTT->GetPad(3),"same");
956 
957  Double_t maxQ = 0;
958  for(Int_t i = 0; i<gQtotTT_X->GetN();i++){
959  Double_t x,y;
960  gQtotTT_X->GetPoint(i,x,y);
961  if(y>maxQ) maxQ = y;
962  gQtotTT_Y->GetPoint(i,x,y);
963  if(y>maxQ) maxQ = y;
964  }
965  Double_t tstmp = timeStamp;
966  if(tstmp<=0) tstmp = 1;
967  TH1F* hTimeDummy = new TH1F("hTimeDummy","Trigger Rate;time [s];rate [Hz]",1000,0,tstmp);
968  hTimeDummy->GetXaxis()->SetTimeDisplay(0);
969  hTimeDummy->GetXaxis()->SetTimeFormat("%H:%M:%S");
970  hTimeDummy->GetXaxis()->SetTimeOffset(0);
971  hTimeDummy->GetXaxis()->SetNdivisions(1210,kTRUE);
972  hTimeDummy->SetMaximum(1.1*maxQ);
973  hTimeDummy->SetMinimum(0);
974  hTimeDummy->SetTitle("Gain vs Time;time [s]; total charge/event [ADC]");
975  // cTabTT->GetPad(4)->SetLogy();
976  MakeNice1dHisto(hTimeDummy,cTabTT->GetPad(4));
977  gQtotTT_X->SetMarkerColor(kBlue);
978  gQtotTT_X->SetLineColor(kBlue);
979  gQtotTT_Y->SetMarkerColor(kRed);
980  gQtotTT_Y->SetLineColor(kRed);
981  if(gQtotTT_X->GetN())
982  gQtotTT_X->Draw("Lsame");
983  if(gQtotTT_Y->GetN())
984  gQtotTT_Y->Draw("Lsame");
985 
986  if(!cSideSummary){
987  cSideSummary = ecSideSummary->GetCanvas();
988  cSideSummary->SetName("cSideSummary");
989  cSideSummary->Divide(2,5);
990  }
991  MakeNice2dHisto(hXZs,cSideSummary->GetPad(1));
992  MakeNice2dHisto(hYZs,cSideSummary->GetPad(2));
993  MakeNice2dHisto(hCumul_X,cSideSummary->GetPad(3));
994  MakeNice2dHisto(hCumul_Y,cSideSummary->GetPad(4));
995  cSideSummary->cd(5);
996  MakeNice1dHisto(hCh_X,cSideSummary->GetPad(5));
997  hCh_Y->DrawCopy("same");
998  hChZs_X->DrawCopy("same");
999  hChZs_Y->DrawCopy("same");
1000  cSideSummary->cd(6);
1001  cSideSummary->GetPad(6)->SetLogx();
1002  cSideSummary->GetPad(6)->SetLogy();
1003  MakeNice1dHisto(hQtotZs_X,cSideSummary->GetPad(6));
1004  MakeNice1dHisto(hQtotZs_X,cSideSummary->GetPad(6),"same");
1005  // hQtot_Y->DrawCopy("same");
1006  // hQtotZs_X->DrawCopy("same");
1007  // hQtotZs_Y->DrawCopy("same");
1008  cSideSummary->cd(7);
1009  hTriggerStack->Draw();
1010  // MakeNice1dHisto(hPmm2Efficiency,cSideSummary->GetPad(9));
1011  // MakeNice2dHisto(hPmm2Coincidence,cSideSummary->GetPad(10));
1012  // cSideSummary->GetPad(10)->SetLogz();
1013 
1014 
1015  Double_t timeMax = timeStamp;
1016  Double_t maxRate = 2e-5;
1017  for(Int_t k = 0; k<kNtriggerTypes; k++){
1018  for(Int_t i = 0; i<gRateTotal[k]->GetN();i++){
1019  Double_t x,y;
1020  gRateTotal[k]->GetPoint(i,x,y);
1021  if(y>maxRate) maxRate = y;
1022  }
1023  }
1024  TGraphErrors* gRatePmm2Tot = 0;
1025  mfilePmm2 = TMapFile::Create("/tmp/harpoPmm2.map","READ",10000000);
1026  if(mfilePmm2->cd()){
1027  TH1F* fHistTriggered = 0; fHistTriggered = (TH1F*)mfilePmm2->Get("fHistTriggered",fHistTriggered);
1028  TH1F* fHistMissed = 0; fHistMissed = (TH1F*)mfilePmm2->Get("fHistMissed",fHistMissed);
1029  TH2F* fHistCoincidence = 0; fHistCoincidence = (TH2F*)mfilePmm2->Get("fHistCoincidence",fHistCoincidence);
1030  TH2F* fHistCoincidenceNorm = 0; fHistCoincidenceNorm = (TH2F*)mfilePmm2->Get("fHistCoincidenceNorm",fHistCoincidenceNorm);
1031  TH1F* fHistSize = 0; fHistSize = (TH1F*)mfilePmm2->Get("fHistSize",fHistSize);
1032  TH1F* fHistSizeTrig = 0; fHistSizeTrig = (TH1F*)mfilePmm2->Get("fHistSizeTrig",fHistSizeTrig);
1033  TH1F* fHistInfo = 0; fHistInfo = (TH1F*)mfilePmm2->Get("fHistInfo",fHistInfo);
1034  TH1F* fHistRatePmm2 = 0; fHistRatePmm2 = (TH1F*)mfilePmm2->Get("fHistRatePmm2",fHistRatePmm2);
1035  TH1F* fHistRatePmm2Tot = 0; fHistRatePmm2Tot = (TH1F*)mfilePmm2->Get("fHistRatePmm2Tot",fHistRatePmm2Tot);
1036  TGraphErrors* gRatePmm2[16];
1037  for(Int_t i = 0; i<16; i++){
1038  gRatePmm2[i] = 0;
1039  gRatePmm2[i] = (TGraphErrors*)mfilePmm2->Get(Form("gRatePmm2_%d",i),gRatePmm2[i]);
1040  }
1041  gRatePmm2Tot = (TGraphErrors*)mfilePmm2->Get("gRatePmm2Tot",gRatePmm2Tot);
1042 
1043  mfilePmm2->Close();
1044 
1045  // // TH1D* fHistRate = fHistCoincidence->ProjectionX("fHistRate");
1046  // Double_t N3 = hPmm2Size->GetBinContent(4);
1047  // Double_t N4 = hPmm2Size->GetBinContent(5);
1048  // Double_t N5 = hPmm2Size->GetBinContent(6);
1049  // Double_t y = 0.5*hPmm2Size->GetMaximum();
1050  // Double_t x = 6.5;
1051  // // Double_t dy = 0.1*hPmm2Size->GetMaximum();
1052  // Double_t dy = TMath::Power(0.5/hPmm2Size->GetMaximum()/timeStamp,0.1);
1053  // latex->SetTextSize(0.07);
1054  // latex->DrawLatex(x,y,Form("N_{4}/(N_{3}+N_{4}) = %.2g",N4/(N3+N4)));
1055  // y *= dy;
1056  // latex->DrawLatex(x,y,Form("N_{3}/(N_{3}+N_{4}) = %.2g",N3/(N3+N4)));
1057  // y *= dy;
1058  // latex->DrawLatex(x,y,Form("N_{5}/(N_{5}+N_{4}) = %.2g",N5/(N5+N4)));
1059 
1060  // TH1F* hPmm2Efficiency = (TH1F*)hPmm2Triggered->Clone();
1061  // hPmm2Efficiency->SetTitle("PM efficiency;Channel;Efficiency [%]");
1062  // hPmm2Efficiency->Add(hPmm2Missed,-1);
1063  // hPmm2Efficiency->Divide(hPmm2Triggered);
1064  // hPmm2Efficiency->Scale(100);
1065  // hPmm2Efficiency->SetMinimum(0);
1066  // hPmm2Efficiency->SetMaximum(100);
1067  // MakeNice1dHisto(hPmm2Efficiency,cTabPmm2->GetPad(2));
1068  // latex->SetTextSize(0.07);
1069  // Double_t meanEfficiency = 0, nsig = 0;
1070  // for(Int_t i = 1; i<=12; i++){
1071  // if(hPmm2Efficiency->GetBinContent(i)>0){
1072  // meanEfficiency += hPmm2Efficiency->GetBinContent(i);
1073  // nsig += 1;
1074  // }
1075  // }
1076  // meanEfficiency /= nsig;
1077  // latex->DrawLatex(3,50,Form("<Efficiency> = %.1f %%",meanEfficiency));
1078 
1079 
1080 
1081  Int_t runNoPmm2 = fHistInfo->GetBinContent(1);
1082  Int_t nEventPmm2 = fHistInfo->GetBinContent(2);
1083  Double_t timeStampPmm2 = fHistInfo->GetBinContent(3)/1e8; // in seconds
1084  fEventPmm2Label->SetText(Form("PMM2: Run %d, Event %d, %gs",runNoPmm2,nEventPmm2,timeStampPmm2));
1085 
1086 
1087  fHistCoincidenceNorm->Scale(1./fHistCoincidenceNorm->GetMaximum());
1088  for(int ch1 = 0; ch1<16; ch1++){
1089  for(int ch2 = 0; ch2<16; ch2++){
1090  if(fHistCoincidenceNorm->GetBinContent(ch1+1,ch2+1) == 0)
1091  fHistCoincidenceNorm->SetBinContent(ch1+1,ch2+1,1);
1092  }
1093  }
1094  fHistCoincidence->Divide(fHistCoincidenceNorm);
1095  // fHistCoincidence->Draw("colz");
1096  cTabPmm2->GetPad(4)->SetLogz();
1097  MakeNice2dHisto(fHistCoincidence,cTabPmm2->GetPad(4));
1098  cSideSummary->GetPad(10)->SetLogz();
1099  MakeNice2dHisto(fHistCoincidence,cSideSummary->GetPad(10));
1100 
1101 
1102 
1103  TH1F* fHistEfficiency = (TH1F*)fHistTriggered->Clone();
1104  fHistEfficiency->SetTitle("PM efficiency;Channel;Efficiency [%]");
1105  fHistEfficiency->Add(fHistMissed,-1);
1106  fHistEfficiency->Divide(fHistTriggered);
1107  fHistEfficiency->Scale(100);
1108  fHistEfficiency->SetMinimum(0);
1109  fHistEfficiency->SetMaximum(100);
1110  MakeNice1dHisto(fHistEfficiency,cTabPmm2->GetPad(2));
1111  Double_t scaletmp = 80./fHistRatePmm2Tot->GetMaximum();
1112  fHistRatePmm2Tot->Scale(scaletmp); // Nevents -> arbitrary
1113  fHistRatePmm2Tot->SetLineColor(kRed);
1114  fHistRatePmm2->SetLineColor(kRed+2);
1115  fHistRatePmm2->SetLineStyle(2);
1116  fHistRatePmm2->Scale(timeStampPmm2); // Hz -> Nevents
1117  fHistRatePmm2->Scale(scaletmp); // Nevents -> arbitrary
1118  // draw an axis on the right side
1119  Double_t maxAxis = 1;
1120  if(scaletmp*timeStampPmm2>0)
1121  maxAxis = 100./scaletmp/timeStampPmm2;
1122  TGaxis *axis = new TGaxis(16,0,
1123  16,100,
1124  0,maxAxis,510,"+L");
1125  axis->SetLineColor(kRed);
1126  axis->SetTextColor(kRed);
1127  axis->SetLabelColor(kRed);
1128  axis->SetTitle("Rate [Hz]");
1129  axis->SetTitleSize(0.07);
1130  axis->SetTitleOffset(0.7);
1131  axis->SetTitleFont(132);
1132  axis->SetLabelFont(132);
1133  axis->SetLabelSize(0.06);
1134  axis->Draw();
1135  MakeNice1dHisto(fHistRatePmm2Tot,cTabPmm2->GetPad(2),"same");
1136  MakeNice1dHisto(fHistRatePmm2,cTabPmm2->GetPad(2),"same");
1137  cTabPmm2->GetPad(2)->SetRightMargin(0.12);
1138  latex->SetTextSize(0.07);
1139  Double_t meanEfficiency = 0, nsig = 0;
1140  for(Int_t i = 1; i<=12; i++){
1141  if(fHistEfficiency->GetBinContent(i)>0){
1142  meanEfficiency += fHistEfficiency->GetBinContent(i);
1143  nsig += 1;
1144  }
1145  }
1146  if(nsig)
1147  meanEfficiency /= nsig;
1148  latex->DrawLatex(3,50,Form("<Efficiency> = %.1f %%",meanEfficiency));
1149 
1150 
1151  MakeNice1dHisto(fHistEfficiency,cSideSummary->GetPad(9));
1152  axis->Draw();
1153  MakeNice1dHisto(fHistRatePmm2Tot,cSideSummary->GetPad(9),"same");
1154  MakeNice1dHisto(fHistRatePmm2,cSideSummary->GetPad(9),"same");
1155  cSideSummary->GetPad(9)->SetRightMargin(0.12);
1156 
1157 
1158 
1159 
1160  fHistSize->Scale(1./timeStampPmm2);
1161  fHistSize->SetLineColor(kRed);
1162  lSizePmm2->AddEntry(fHistSize,"All signals","L");
1163  MakeNice1dHisto(fHistSize,cTabPmm2->GetPad(1),"same");
1164  // fHistSize->GetYaxis()->SetRangeUser(1e-2,1.1*fHistSize->GetMaximum());
1165  fHistSize->GetYaxis()->SetRangeUser(1e-2,1e4);
1166 
1167 
1168  if(timeStampPmm2>timeMax) timeMax = timeStampPmm2;
1169  for(Int_t i = 0; i<gRatePmm2Tot->GetN();i++){
1170  Double_t x,y;
1171  gRatePmm2Tot->GetPoint(i,x,y);
1172  if(y>maxRate) maxRate = y;
1173  }
1174 
1175  }else{
1176  if(gHarpoDebug>0)
1177  Warning("Constructor","Could not open Pmm2 file");
1178  }
1179 
1180 
1181  cTabPmm2->cd(1);
1182  lSizePmm2->Draw();
1183 
1184 
1185  cTabTrigger->cd(2);
1186  if(timeMax<=0) timeMax = 1;
1187  TH1F* hTimeMaxDummy = new TH1F("hTimeMaxDummy","Trigger Rate;time [s];rate [Hz]",1000,-timeMax/3,timeMax);
1188  hTimeMaxDummy->GetXaxis()->SetTimeDisplay(0);
1189  hTimeMaxDummy->GetXaxis()->SetTimeFormat("%H:%M:%S");
1190  hTimeMaxDummy->GetXaxis()->SetTimeOffset(0);
1191  hTimeMaxDummy->GetXaxis()->SetNdivisions(1210,kTRUE);
1192 
1193  hTimeMaxDummy->SetMaximum(2*maxRate);
1194  hTimeMaxDummy->SetMinimum(5e-2);
1195  cTabTrigger->GetPad(2)->SetLogy();
1196  MakeNice1dHisto(hTimeMaxDummy,cTabTrigger->GetPad(2));
1197  // TLegend* lTrigger2 = new TLegend(0.12,0.6,0.45,0.91);
1198  TLegend* lTrigger2 = new TLegend(0.12,0.12,0.33,0.91);
1199  Int_t nGraphs = 0;
1200  for(Int_t k = 0; k<kNtriggerTypes+1; k++){
1201  if(gRateTotal[k]->GetN()){
1202  gRateTotal[k]->Draw("LPsame");
1203  nGraphs++;
1204  }
1205  }
1206  if(gRatePmm2Tot){
1207  gRatePmm2Tot->SetMarkerStyle(29);
1208  gRatePmm2Tot->Draw("LPsame");
1209  lTrigger2->AddEntry(gRatePmm2Tot,"PMs","LP");
1210  nGraphs++;
1211  }
1212  Int_t reindex[kNtriggerTypes+1] = {9,4,1,10,11,12,8,13,5,6,3,0,2,7,14,15,16};
1213  for(Int_t i = 0; i<kNtriggerTypes+1; i++){
1214  Int_t k = reindex[i];
1215  if(gRateTotal[k]->GetN()){
1216  lTrigger2->AddEntry(gRateTotal[k],triggerNames[k],"LP");
1217  }
1218  }
1219  lTrigger2->SetY1NDC(0.91-nGraphs*0.06);
1220  lTrigger2->Draw();
1221 
1222  // cTabTrigger->GetPad(4)->SetLogy();
1223  // MakeNice1dHisto(hTimeMaxDummy,cTabTrigger->GetPad(4));
1224  // TLegend* lTrigger3 = new TLegend(0.12,0.6,0.45,0.91);
1225  // Int_t nGraphs = 0;
1226  // for(Int_t k = 0; k<kNtrackTypes; k++){
1227  // if(gRate[k]->GetN()){
1228  // gRate[k]->Draw("LPsame");
1229  // lTrigger3->AddEntry(gRateTotal[k],triggerNames[k],"LP");
1230  // }
1231  // }
1232 
1233  cSideSummary->GetPad(8)->SetLogy();
1234  MakeNice1dHisto(hTimeMaxDummy,cSideSummary->GetPad(8));
1235  for(Int_t k = 0; k<kNtriggerTypes+1; k++){
1236  if(gRateTotal[k]->GetN()){
1237  gRateTotal[k]->Draw("LPsame");
1238  //lTrigger2->AddEntry(gRateTotal[k],triggerNames[k],"LP");
1239  //nGraphs++;
1240  }
1241  }
1242  if(gRatePmm2Tot){
1243  gRatePmm2Tot->Draw("LPsame");
1244  //lTrigger2->AddEntry(gRatePmm2Tot,"PMs","LP");
1245  //nGraphs++;
1246  }
1247 
1248 
1249 
1250 
1251 
1252 
1253 
1254  cTabEvent->Update();
1255  cTabCumul->Update();
1256  cTabTrigger->Update();
1257  cTabPmm2->Update();
1258  cTabTT->Update();
1259  cSideSummary->Update();
1260  stringstream titlestr;
1261  titlestr << "Feminos: Run " << runNo;
1262  titlestr << ", Event " << nEvent;
1263  titlestr << " (" << fixed << setprecision(2) << timeStamp << "s)";
1264  if(firstEvent>0)
1265  titlestr << ", from " << firstEvent;
1266  if(skipEvents>1)
1267  titlestr << ", downscaled " << skipEvents;
1268  fEventLabel->SetText(titlestr.str().data());
1269  // fEventLabel->SetText(Form("Feminos: Run %d, Event %d, %gs",runNo,nEvent,timeStamp));
1270 
1271 
1272  hTmin_X->Delete();
1273  hTmin_Y->Delete();
1274  hTmax_X->Delete();
1275  hTmax_Y->Delete();
1276  hT_X->Delete();
1277  hT_Y->Delete();
1278  hCh_X->Delete();
1279  hCh_Y->Delete();
1280  hQ_X->Delete();
1281  hQ_Y->Delete();
1282  hQev_X->Delete();
1283  hQev_Y->Delete();
1284  hTZs_X->Delete();
1285  hTZs_Y->Delete();
1286  hChZs_X->Delete();
1287  hChZs_Y->Delete();
1288  hQZs_X->Delete();
1289  hQZs_Y->Delete();
1290  hQevZs_X->Delete();
1291  hQevZs_Y->Delete();
1292  hQtotT_X->Delete();
1293  hQtotT_Y->Delete();
1294  hQtot_X->Delete();
1295  hQtot_Y->Delete();
1296  hQtotTZs_X->Delete();
1297  hQtotTZs_Y->Delete();
1298  hQtotZs_X->Delete();
1299  hQtotZs_Y->Delete();
1300  hInfo->Delete();
1301  hPmm2->Delete();
1302  hTev_X->Delete();
1303  hTev_Y->Delete();
1304  hTevZs_X->Delete();
1305  hTevZs_Y->Delete();
1306  hQtotTev_X->Delete();
1307  hQtotTev_Y->Delete();
1308  hQtotTevZs_X->Delete();
1309  hQtotTevZs_Y->Delete();
1310  hX->Delete();
1311  hXZs->Delete();
1312  hY->Delete();
1313  hYZs->Delete();
1314  hCumul_X->Delete();
1315  hCumul_Y->Delete();
1316 
1317 
1318 
1319  return;
1320 }
1321 
1322 
1324 {
1325  Int_t Event = Int_t(fChooseEvent->GetNumber());
1326  fChooseEvent->SetNumber(Event+1);
1327  DisplayEvent();
1328 
1329  return;
1330 
1331 }
1332 
1333 
1335 {
1336 
1337  Int_t Event = Int_t(fChooseEvent->GetNumber());
1338  fChooseEvent->SetNumber(Event-1);
1339  DisplayEvent();
1340  return;
1341 
1342 }
1343 
1344 
1346 {
1347 
1348  DisplayEvent(0);
1349  return;
1350 }
1351 
1352 
1354 
1355  Bool_t AutoRefreshTmp = fAutoRefresh;
1356  fAutoRefresh = false;
1357  fSaveButton->SetState(kButtonDisabled,kFALSE);
1358  gSystem->Sleep(500); // sleep for 0.1 seconds
1359 
1360  char outputfile[512];
1361  char outputfileroot[512];
1362  char outputfileopen[512];
1363  char outputfileclose[512];
1364  const char* dir = gSystem->ExpandPathName("$HARPO_ANA_DIR/monitor");
1365  //const char* dir = "$HARPO_ANA_DIR/monitor";
1366  if(gSystem->AccessPathName(dir)){
1367  Warning("Save","Directory %s does not exist. Saving in local directory",dir);
1368  sprintf(outputfile,"online_run%d_evt%d.pdf",fRunNumber,fEventNumber);
1369  sprintf(outputfileroot,"online_run%d_evt%d.root",fRunNumber,fEventNumber);
1370  sprintf(outputfileopen,"online_run%d_evt%d.pdf[",fRunNumber,fEventNumber);
1371  sprintf(outputfileclose,"online_run%d_evt%d.pdf]",fRunNumber,fEventNumber);
1372  }else{
1373  sprintf(outputfile,"%s/online_run%d_evt%d.pdf",dir,fRunNumber,fEventNumber);
1374  sprintf(outputfileroot,"%s/online_run%d_evt%d.root",dir,fRunNumber,fEventNumber);
1375  sprintf(outputfileopen,"%s/online_run%d_evt%d.pdf[",dir,fRunNumber,fEventNumber);
1376  sprintf(outputfileclose,"%s/online_run%d_evt%d.pdf]",dir,fRunNumber,fEventNumber);
1377  }
1378 
1379 
1380  cTabEvent->SaveAs(outputfileopen);
1381  cTabEvent->SaveAs(outputfile);
1382  cTabCumul->SaveAs(outputfile);
1383  cTabTrigger->SaveAs(outputfile);
1384  cTabPmm2->SaveAs(outputfile);
1385  cTabTT->SaveAs(outputfile);
1386  // cSideSummary->SaveAs(outputfile);
1387  cTabTT->SaveAs(outputfileclose);
1388 
1389  cout << "File Saved" << endl;
1390 
1391 
1392  // mfile = TMapFile::Create("/tmp/harpo.map","READ",50000000);
1393  // mfilePmm2 = TMapFile::Create("/tmp/harpoPmm2.map","READ",10000000);
1394  // TFile* fileout = new TFile(outputfileroot,"recreate");
1395 
1396  // TKey *key;
1397  // TList* list = mfile->GetDirectory()->GetListOfKeys();
1398  // TIter next((TList*)list);
1399  // while ((key = (TKey *) next())) {
1400  // TObject *thing = mfile->Get(key->GetName());
1401  // if(thing){
1402  // cout << key->GetName() << endl;
1403  // thing->Write(key->GetName());
1404  // }
1405  // }
1406 
1407  // fileout->Close();
1408 
1409  gSystem->Sleep(1000); // sleep for 0.1 seconds
1410 
1411  fAutoRefresh = AutoRefreshTmp;
1412  fSaveButton->SetState(kButtonUp,kFALSE);
1413 
1414 }
1415 
1416 
1417 // //__________________________________________________________________
1418 // void HarpoMonitorGui::Hist2dClicked(TVirtualPad* pad, TObject* select, Int_t event)
1419 // {
1420 // //this action function is called whenever you click the mouse
1421 // //it just prints the pad coordinates and channel number, and
1422 // //displays the pulse in time in another window
1423 
1424 // if (event != kButton1Down) return; //has to click to see pad signal in time
1425 // if (!select) return;
1426 // if (!select->InheritsFrom("TH2F")) return;
1427 // TH2F *hist = (TH2F*)select;
1428 // }
1429 
1430 
1431 //---------------------------------
1432 
1433 
1434 
1435 
1436 
1437 
1438 Bool_t HarpoMonitorGui::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
1439 {
1440 
1441  switch(GET_MSG(msg)){
1442  case kC_COMMAND:
1443  switch(GET_SUBMSG(msg)){
1444  case kCM_BUTTON:
1445  switch(parm1){
1446  case M_DISPLAY_EVENT: DisplayEvent(); break;
1447  case M_NEXT_EVENT: NextEvent(); break;
1448  // case M_DISPLAY: Display(); break;
1449  case M_SAVE: Save(); break;
1450  case M_PREV_EVENT: PrevEvent(); break;
1451  case M_AUTOREFRESH:
1453  fChooseDelay->SetState(fAutoRefresh);
1454  if(fAutoRefresh) fAutoRefreshButton->SetText("Freeze");
1455  else fAutoRefreshButton->SetText("AutoRefresh");
1456  break;
1457  default: cout << "Unknown button" << endl; break;
1458  }
1459  default:
1460  break;
1461  }
1462  default:
1463  break;
1464  }
1465 
1466  return kTRUE;
1467 }
1468 
1469 
1470 
1472 {
1473  // TStyle *myStyle= new TStyle("myStyle","Plot style");
1474 
1475  // // use plain black on white colors
1476  // myStyle->SetFrameBorderMode(0);
1477  // myStyle->SetCanvasBorderMode(0);
1478  // myStyle->SetPadBorderMode(0);
1479  // myStyle->SetPadColor(kWhite);
1480  // myStyle->SetCanvasColor(kWhite);
1481  // //myStyle->SetTitleColor(0);
1482  // myStyle->SetStatColor(kWhite);
1483  // myStyle->SetTitleFillColor(kWhite);
1484  // //myStyle->SetFillColor(kWhite);
1485 
1486  // // set the paper & margin sizes
1487  // myStyle->SetPaperSize(20,26);
1488  // myStyle->SetPadTopMargin(0.05);
1489  // myStyle->SetPadRightMargin(0.05);
1490  // myStyle->SetPadBottomMargin(0.16);
1491  // myStyle->SetPadLeftMargin(0.12);
1492 
1493  // // use large Times-Roman fonts
1494  // myStyle->SetTitleFont(132,"xyz"); // set the all 3 axes title font
1495  // // myStyle->SetTitleFont(132," "); // set the pad title font
1496  // myStyle->SetTitleSize(0.07,"xyz"); // set the 3 axes title size
1497  // // myStyle->SetTitleSize(0.06," "); // set the pad title size
1498  // myStyle->SetTitleOffset(0.8,"y");
1499  // myStyle->SetLabelFont(132,"xyz");
1500  // myStyle->SetLabelSize(0.06,"xyz");
1501  // myStyle->SetTextFont(132);
1502  // myStyle->SetTextSize(0.08);
1503  // // myStyle->SetStatFont(132);
1504 
1505  // // use bold lines and markers
1506  // // myStyle->SetMarkerStyle(8);
1507  // // myStyle->SetHistLineWidth(1.85);
1508  // // myStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
1509 
1510  // //..Get rid of X error bars
1511  // myStyle->SetErrorX(0.001);
1512 
1513  // // do not display any of the standard histogram decorations
1514  // myStyle->SetOptTitle(1);
1515  // myStyle->SetOptStat(0);
1516  // myStyle->SetOptFit(0);
1517 
1518  // // put tick marks on top and RHS of plots
1519  // // myStyle->SetPadTickX(1);
1520  // // myStyle->SetPadTickY(1);
1521 
1522 
1523  // myStyle->SetPalette(1);
1524 
1525  // cout << "Using style 'myStyle'...\n";
1526  // gROOT->SetStyle("myStyle");
1527  // gROOT->ForceStyle();
1528 }
1529 
1530 
1531 
1532 
1533 
1534 //_______________________________________________________________________
1535 void HarpoMonitorGui::MakeNice1dHisto(TH1* hist, TVirtualPad* c1, const char* opt)
1536 {
1537  gStyle->SetTitleH(0.08);
1538  gStyle->SetTitleW(0.78);
1539  gStyle->SetTitleX(0.16);
1540  gStyle->SetTitleY(0.99);
1541  gStyle->SetTitleFont(132," ");
1542  gStyle->SetTitleSize(0.09," ");
1543  hist->SetTitleFont(132);
1544  hist->SetTitleSize(0.09);
1545  hist->GetXaxis()->SetTitleSize(0.07);
1546  hist->GetYaxis()->SetTitleSize(0.07);
1547  hist->GetXaxis()->SetTitleOffset(0.7);
1548  hist->GetYaxis()->SetTitleOffset(0.7);
1549  hist->GetXaxis()->SetTitleFont(132);
1550  hist->GetYaxis()->SetTitleFont(132);
1551  hist->GetXaxis()->SetLabelFont(132);
1552  hist->GetYaxis()->SetLabelFont(132);
1553  hist->GetXaxis()->SetLabelSize(0.06);
1554  hist->GetYaxis()->SetLabelSize(0.06);
1555  if(c1) {
1556 
1557  c1->SetLeftMargin(0.12);
1558  c1->SetRightMargin(0.02);
1559  c1->SetBottomMargin(0.12);
1560  c1->SetTopMargin(0.09);
1561  c1->cd();
1562  hist->DrawCopy(opt);
1563  }
1564 }
1565 
1566 //_______________________________________________________________________
1567 void HarpoMonitorGui::MakeNice2dHisto(TH2* hist, TVirtualPad* c1, Bool_t colz)
1568 {
1569  gStyle->SetTitleH(0.08);
1570  gStyle->SetTitleW(0.78);
1571  gStyle->SetTitleX(0.16);
1572  gStyle->SetTitleY(0.99);
1573  if(colz)
1574  gStyle->SetTitleW(0.68);
1575  gStyle->SetTitleFont(132," ");
1576  gStyle->SetTitleSize(0.09," ");
1577 
1578  hist->GetXaxis()->SetTitleSize(0.07);
1579  hist->GetYaxis()->SetTitleSize(0.07);
1580  hist->GetZaxis()->SetTitleSize(0.07);
1581  hist->GetXaxis()->SetTitleOffset(0.7);
1582  hist->GetYaxis()->SetTitleOffset(0.8);
1583  hist->GetZaxis()->SetTitleOffset(0.8);
1584  hist->GetXaxis()->SetTitleFont(132);
1585  hist->GetYaxis()->SetTitleFont(132);
1586  hist->GetZaxis()->SetTitleFont(132);
1587  hist->GetXaxis()->SetLabelFont(132);
1588  hist->GetYaxis()->SetLabelFont(132);
1589  hist->GetZaxis()->SetLabelFont(132);
1590  hist->GetXaxis()->SetLabelSize(0.06);
1591  hist->GetYaxis()->SetLabelSize(0.06);
1592  hist->GetZaxis()->SetLabelSize(0.06);
1593  if(c1) {
1594 
1595  c1->SetLeftMargin(0.12);
1596  if(!colz)
1597  c1->SetRightMargin(0.02);
1598  else
1599  c1->SetRightMargin(0.12);
1600  c1->SetBottomMargin(0.12);
1601  c1->SetTopMargin(0.09);
1602  c1->cd();
1603  if(colz)
1604  hist->DrawCopy("colz");
1605  else
1606  hist->DrawCopy();
1607  }
1608 }
TRootEmbeddedCanvas * ecTabCumul
void DisplayEvent(HarpoEvent *event)
TGLabel * fEventPmm2Label
TMapFile * mfile
TGTextButton * fNextEvent
TGListBox * fLog
TGNumberEntry * fChooseEvent
TMapFile * mfilePmm2
TObjArray * padHelpArray[100]
TGTextButton * fSave
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
TCanvas * cTabCumul
TRootEmbeddedCanvas * ecSideSummary
HarpoMonitorGui * gHarpoGui
ETestCommandIdentifiers
TGTextButton * fDisplayEvent
TGCheckButton * fCheckClusters
void BuildButtonsFrame(TGVerticalFrame *f)
TGTextButton * fDisplayBox
void BuildDisplayFrame(TGVerticalFrame *f)
void SetListOfRuns(TGComboBox *box, const char *dirname)
void MakeNice2dHisto(TH2 *hist, TVirtualPad *c1, Bool_t colz=kTRUE)
void BuildInfoFrame(TGHorizontalFrame *f)
TGTextButton * fPrevEvent
TGNumberEntry * fChooseDelay
TGComboBox * fChooseRun
void MakeNice1dHisto(TH1 *hist, TVirtualPad *c1, const char *opt="")
TGTextButton * fAutoRefreshButton
TRootEmbeddedCanvas * ecTabPmm2
TCanvas * cTabEvent
TGTextButton * fDisplay
Char_t rundir[128]
TCanvas * cTabTrigger
Long64_t gHarpoDebug
Definition: HarpoDebug.cxx:9
TRootEmbeddedCanvas * ecTabTT
TGNumberEntry * fChooseNEvents
TRootEmbeddedCanvas * ecTabEvent
virtual void CloseWindow()
TCanvas * cSideSummary
void * handle1(void *)
HarpoMonitorGui(const TGWindow *p, UInt_t w, UInt_t h, UInt_t opt)
TGTextButton * fSaveButton
A class store HARPO row event data and header. Provide access metods to the row event data...
Definition: HarpoEvent.h:29
TCanvas * cTabPmm2
TGMainFrame * fFrameMain
TRootEmbeddedCanvas * ecTabTrigger
TGLabel * fEventLabel