treeviewer.C

Mikhail Kozlov, 09/13/2017 04:15 PM

Download (2.69 KB)

 
1
void treeviewer() {
2
//=========Macro generated by ROOT version6.06/02
3
//=========for tree "cbmsim" (Wed Sep 13 16:01:21 2017)
4
//===This macro can be opened from a TreeViewer session after loading
5
//===the corresponding tree, or by running root with the macro name argument
6

    
7
   open_session();
8
}
9

    
10
open_session(void *p = 0) {
11
   gSystem->Load("libTreeViewer");
12
   TTreeViewer *treeview = (TTreeViewer *) p;
13
   if (!treeview) treeview = new TTreeViewer();
14
   TTree *tv_tree = (TTree*)gROOT->FindObject("cbmsim");
15
   TFile *tv_file = (TFile*)gROOT->GetListOfFiles()->FindObject("full.root");
16
   if (!tv_tree) {
17
      if (!tv_file) tv_file = new TFile("full.root");
18
      if (tv_file)  tv_tree = (TTree*)tv_file->Get("cbmsim");
19
      if(!tv_tree) {
20
         printf("Tree %s not found", fTree->GetName());
21
         return;
22
      }
23
   }
24

    
25
   treeview->SetTreeName("cbmsim");
26
   treeview->SetNexpressions(10);
27
//         Set expressions on axis and cut
28
   TTVLVEntry *item;
29
//   X expression
30
   item = treeview->ExpressionItem(0);
31
   item->SetExpression("BeamDetMWPCPoint.fELoss", "~BeamDetMWPCPoint.fELoss");
32
//   Y expression
33
   item = treeview->ExpressionItem(1);
34
   item->SetExpression("", "-empty-");
35
//   Z expression
36
   item = treeview->ExpressionItem(2);
37
   item->SetExpression("", "-empty-");
38
//   Cut expression
39
   item = treeview->ExpressionItem(3);
40
   item->SetExpression("BeamDetMWPCPoint.fPlaneNb == 2 && BeamDetMWPCPoint.fMWPCNb == 2 && BeamDetMWPCPoint.fPid > 3000", "~BeamDetMWPCPoint.fPlaneNb");
41
//         Scan list
42
   item = treeview->ExpressionItem(4);
43
   item->SetExpression("", "Scan box");
44
//         User defined expressions
45
   item = treeview->ExpressionItem(5);
46
   item->SetExpression("BeamDetMWPCPoint.fPlaneNb == 2 && BeamDetMWPCPoint.fMWPCNb == 2 && BeamDetMWPCPoint.fPid > 3000", "~name", kTRUE);
47
   item = treeview->ExpressionItem(6);
48
   item->SetExpression("", "-empty-", kFALSE);
49
   item = treeview->ExpressionItem(7);
50
   item->SetExpression("", "-empty-", kFALSE);
51
   item = treeview->ExpressionItem(8);
52
   item->SetExpression("", "-empty-", kFALSE);
53
   item = treeview->ExpressionItem(9);
54
   item->SetExpression("", "-empty-", kFALSE);
55
   item = treeview->ExpressionItem(10);
56
   item->SetExpression("", "-empty-", kFALSE);
57
   item = treeview->ExpressionItem(11);
58
   item->SetExpression("", "-empty-", kFALSE);
59
   item = treeview->ExpressionItem(12);
60
   item->SetExpression("", "-empty-", kFALSE);
61
   item = treeview->ExpressionItem(13);
62
   item->SetExpression("", "-empty-", kFALSE);
63
   item = treeview->ExpressionItem(14);
64
   item->SetExpression("", "-empty-", kFALSE);
65
//--- session object
66
   tv_session = new TTVSession(treeview);
67
   treeview->SetSession(tv_session);
68
//--- Connect first record
69
   tv_session->First();
70
}