HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoAnalyseMonitorGui.cxx
Go to the documentation of this file.
1 //
2 // File HarpoAnalyseMonitorGui.cxx
3 //
12 #include "HarpoAnalyseMonitorGui.h"
13 #include "HarpoConfig.h"
14 #include "HarpoDetSet.h"
15 #include "HarpoDebug.h"
16 #include "HarpoDccEvent.h"
17 #include "HarpoEvent.h"
18 #include "HarpoRecoEvent.h"
19 
20 #include "TFile.h"
21 #include "TStyle.h"
22 #include "TCanvas.h"
23 #include "TLatex.h"
24 #include "TGraph.h"
25 #include "TF1.h"
26 #include "TMath.h"
27 
28 #include <TGComboBox.h>
29 #include <TGTab.h>
30 #include <TGButton.h>
31 #include <TGTextEntry.h>
32 
33 #include <cstdlib>
34 #include <cstring>
35 #include <cassert>
36 #include <fstream>
37 #include <iostream>
38 
39 ClassImp(HarpoAnalyseMonitorGui)
40 
41 void HarpoAnalyseMonitorGui::print()
42  {
43  unsigned int nd; // number of detectors
44  HarpoEventHeader *hdr = fEvt->GetHeader();
45 
46  assert(hdr != NULL);
47  hdr->print();
48 
49  for (nd = 0; nd < gkNDetectors; nd++) {
50  // if (fEvt->isdataExist(nd)) {
51  HarpoDccMap *plane = fEvt->GetDccMap(nd);
52  if (plane != NULL )plane->print();
53  }
54  }
55 
57  {
58  // Bool_t drawEvent = kFALSE;
59  nEvents++;
60 
61 
62 
63  // Process RAW data
64  for(UInt_t ndet=0;ndet<gkNDetectors;ndet++) {
65  if (gHDetSet->isExist(ndet)) {
66  HarpoDccMap* m = fEvt->GetDccMap(ndet);
67  // std::cout << "Event " << nEvents << ", detector " << ndet << " " << m << std::endl;
68  if ( m != NULL ) {
69  // for(Int_t i=0;i<NADC;i++){ //Time bins
70  // for(Int_t j=0;j<NALL;j++){ // Channels
71  // Double_t q = m->map(j,i);
72  // }
73  // }
74  }
75  }
76  }
77 
78 
79  // ???? Process Reconstructed data (clusters, tracks, matched tracks) ????
80  // HarpoRecoEvent* reco = fEvt->GetRecoEvent();
81  // TClonesArray* clArray = reco->GetClustersArray();
82  // TClonesArray* trArray = reco->GetTracksArray();
83  // Int_t NtrX=reco->GetNtracksXEvt();
84  // Int_t NtrY=reco->GetNtracksYEvt();
85  // Int_t nCl = clArray->GetEntries();
86  // Int_t nTr = trArray->GetEntries();
87  // for(Int_t icl = 0; icl<nCl; icl++){
88  // HarpoRecoClusters* cluster = (HarpoRecoClusters*)clArray->At(icl);
89  // Double_t q = cluster->GetQ();
90  // }
91  // for(Int_t itr = 0; itr<nCl; itr++){
92  // HarpoRecoTracks* track = (HarpoRecoTracks*)trArray->At(itr);
93  // Double_t id = track->GetNtrack();
94  // }
95 
96  std::cout << std::endl;
97  }
98 
100  {
101  fMainFrame = new TGMainFrame(gClient->GetRoot(),10,10,kMainFrame | kHorizontalFrame);
102 
103  UInt_t xsize1 = 100;
104  UInt_t xsize2 = 200;
105  // UInt_t ysize = 20;
106  UInt_t mainx = xsize1 + xsize2;
107  UInt_t mainy = 700;
108 
109  gStyle->SetFrameBorderMode(1);
110  gStyle->SetFrameBorderSize(1);
111  TGLayoutHints* fLayout1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5);
112  //TGLayoutHints* fLayout12 = new TGLayoutHints(kLHintsLeft,5,5,5,5);
113  //TGLayoutHints* fLayout2 = new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5);
114  // TGLayoutHints* fLayout3 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX,5,5,5,5);
115  //TGLayoutHints* fLayout3 = new TGLayoutHints(kLHintsBottom ,5,5,5,5);
116  // fMainFrame->SetLayoutBroken(kTRUE);
117 
118  TGVerticalFrame* f1 = new TGVerticalFrame(fMainFrame,xsize1,mainy,kVerticalFrame);
119  TGVerticalFrame* f2 = new TGVerticalFrame(fMainFrame,xsize2,mainy,kVerticalFrame);
120  fMainFrame->AddFrame(f1,new TGLayoutHints(kLHintsLeft | kLHintsExpandY,5,5,5,5));
121  fMainFrame->AddFrame(f2,fLayout1);
122  // Initialise histograms here
123 
124 
125  //--------- create Tab widget and some composite frames for Tab testing
126 
127  //TGTab*
128  fTab = new TGTab(fMainFrame, 300, 300);
129  //TGLayoutHints*
130  fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
131 
132  TGCompositeFrame *tf = fTab->AddTab("Tab 1");
133  //TGCompositeFrame*
134  fF1 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
135  fF1->AddFrame(new TGTextButton(fF1, "&Test button", 0), fL3);
136  //TGTextEntry*
137  fTxt1 = new TGTextEntry(fF1, new TGTextBuffer(100));
138  fF1->AddFrame(fTxt1, fL3);
139  //TGTextEntry*
140  fTxt2 = new TGTextEntry(fF1, new TGTextBuffer(100));
141  fF1->AddFrame(fTxt2, fL3);
142  tf->AddFrame(fF1, fL3);
143  fTxt1->Resize(150, fTxt1->GetDefaultHeight());
144  fTxt2->Resize(150, fTxt2->GetDefaultHeight());
145 
146  tf = fTab->AddTab("Tab 2");
147  // TGLayoutHints*
148  fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
149  200, 2, 2, 2);
150  //TGCompositeFrame*
151  fF2 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
152  fF2->AddFrame(fBtn1 = new TGTextButton(fF2, "&Button 1", 0), fL1);
153  fF2->AddFrame(fBtn2 = new TGTextButton(fF2, "B&utton 2", 0), fL1);
154  fF2->AddFrame(fChk1 = new TGCheckButton(fF2, "C&heck 1", 0), fL1);
155  fF2->AddFrame(fChk2 = new TGCheckButton(fF2, "Chec&k 2", 0), fL1);
156  fF2->AddFrame(fRad1 = new TGRadioButton(fF2, "&Radio 1", 81), fL1);
157  fF2->AddFrame(fRad2 = new TGRadioButton(fF2, "R&adio 2", 82), fL1);
158  //TGComboBox*
159  fCombo = new TGComboBox(fF2, 88);
160  fF2->AddFrame(fCombo, fL3);
161 
162  tf->AddFrame(fF2, fL3);
163 
164 
165 
166  fMainFrame->MapSubwindows();
167  fMainFrame->MapWindow();
168  fMainFrame->SetWindowName("LCTPC Display");
169  fMainFrame->MoveResize(0,0,mainx,mainy);
170 
171  fMainFrame->Layout();
172 
173 
174 
175 
176  }
177 
178 void HarpoAnalyseMonitorGui::Save(char * /* mode */ )
179  {
180 
181 
182  TString * hstFile = gHConfig->GetHistFile();
183  if ( hstFile == NULL ) {
184  std::cout << gHConfig->GetProgramName() << " " <<
185  "No Hist File name given, use default" << std::endl;
186  hstFile = new TString(Form("outputs/anaph%lli.root",gHConfig->GetRunNo()));
187  }
188 
189  TFile *hf = new TFile(hstFile->Data(),"RECREATE");
190  // Save histograms here
191  hf->Close();
192  printf("fNewFile %s closed\n", hstFile->Data() );
193 
194  }
195 
TString * GetProgramName()
Get Program Name.
Definition: HarpoConfig.h:105
Long64_t GetRunNo()
Set Run Number.
Definition: HarpoConfig.h:127
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
Definition: HarpoDetSet.h:33
virtual void print()
FullEvent Header not scecific to the detectors The class is ....
virtual void print()
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
Definition: HarpoDccMap.h:29
GUI for online monitoring (RAW data)
TGMainFrame * fMainFrame
Redefine empty default.
HarpoEvent * fEvt
Definition: HarpoAnalyse.h:70
ULong_t nEvents
Definition: HarpoAnalyse.h:75
TString * GetHistFile()
Get Name of Histogram output file.
Definition: HarpoConfig.h:100
const ULong_t gkNDetectors
Definition: HarpoDet.h:14
HarpoConfig * gHConfig
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
Definition: HarpoEvent.cxx:108
R__EXTERN HarpoDetSet * gHDetSet
Definition: HarpoDetSet.h:71