-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.cc
92 lines (65 loc) · 2.4 KB
/
run.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "TROOT.h"
#include "TFile.h"
#include "TApplication.h"
#include "src/TBDisplay.cc"
// #include "MultiView.C"
TBDisplay *gDisplay = 0;
void make_gui();
void run(string str_input = "default.root", string particle = "e"){
TString filein = str_input;
cout << "Input: " << filein << endl;
gDisplay = new TBDisplay(filein);
TFile::SetCacheFileDir(".");
TEveManager::Create();
const int nslabs = 15;
TEveGeoShape *layer[nslabs];
for(int i=0; i<nslabs; i++){
layer[i] = new TEveGeoShape;
layer[i]->SetShape(new TGeoBBox(0.95e+02, 0.95e+02, 0.5)); // dx, dy, dz
layer[i]->SetNSegments(100); // number of vertices
layer[i]->SetMainColor(kGreen);
layer[i]->SetMainAlpha(0.2);
layer[i]->RefMainTrans().SetPos(0, 0, 0.5+i*15.0); // set position
gEve->AddGlobalElement(layer[i]);
}
gStyle->SetOptStat(0);
TGLViewer *tglv = gEve->GetDefaultGLViewer();
tglv->SetGuideState(TGLUtil::kAxesEdge, kTRUE, kFALSE, 0);
tglv->SetStyle(TGLRnrCtx::kOutline);
gEve->GetBrowser()->GetTabRight()->SetTab(1);
make_gui();
gEve->AddEvent(new TEveEventManager("Event", "SiWECAL VSD Event"));
gDisplay->GotoEvent(0);
gEve->Redraw3D(kTRUE); // Reset camera after the first event has been shown.
ROOT::Math::MinimizerOptions::SetDefaultMaxFunctionCalls( 200 );
}
//______________________________________________________________________________
void make_gui()
{
// Create minimal GUI for event navigation.
auto browser = gEve->GetBrowser();
browser->StartEmbedding(TRootBrowser::kLeft);
auto frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600);
frmMain->SetWindowName("XX GUI");
frmMain->SetCleanup(kDeepCleanup);
auto hf = new TGHorizontalFrame(frmMain);
{
TString icondir("./icons/");
TGPictureButton* b = 0;
b = new TGPictureButton(hf, gClient->GetPicture(icondir+"back.png"));
hf->AddFrame(b);
b->Connect("Clicked()", "TBDisplay", gDisplay, "Prev()");
b = new TGPictureButton(hf, gClient->GetPicture(icondir+"search.png"));
hf->AddFrame(b);
b->Connect("Clicked()", "TBDisplay", gDisplay, "GoTo()");
b = new TGPictureButton(hf, gClient->GetPicture(icondir+"next.png"));
hf->AddFrame(b);
b->Connect("Clicked()", "TBDisplay", gDisplay, "Next()");
}
frmMain->AddFrame(hf);
frmMain->MapSubwindows();
frmMain->Resize();
frmMain->MapWindow();
browser->StopEmbedding();
browser->SetTabTitle("Event Control", 0);
}