The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
readMetaData.C
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#include <TFile.h>
12#include <TTree.h>
13#include <map>
14#include <stdio.h>
15#include <string>
16
17#include <TApplication.h>
18#include <TColor.h>
19#include <TDatime.h>
20#include <TGColorSelect.h>
21#include <TGComboBox.h>
22#include <TGHtml.h>
23#include <TGLabel.h>
24#include <TGNumberEntry.h>
25#include <TROOT.h>
26#include <TTimeStamp.h>
27
28using namespace std;
29
30class Widget {
31private:
32 TString fHeader; // HTML header
33 TString fFooter; // HTML footer
34 TString fHtml_text; // output HTML string
35
36 TGMainFrame* fMain; // main frame
37 TGHtml* fHtml; // html widget to display HTML calendar
38public:
39 void MakeHeader();
40 void MakeFooter();
41 Widget( map<string, string> md );
42 virtual ~Widget();
43 TString Html() const { return fHtml_text; }
45};
47 fHeader = "<html><head><title>Meta Data Viewer</title></head>";
48 fHeader += "<body>\n";
49 fHeader += "<center><H2>Meta Data Viewer</H2></center>";
50}
51void Widget::MakeFooter() { fFooter = "</body></html>"; }
52
53Widget::Widget( map<string, string> md ) {
54 MakeHeader();
55 MakeFooter();
56
57 map<string, string>::iterator iter;
58
60 fHtml_text += "<table border='1' style='width:100%'>";
61
62 for ( iter = md.begin(); iter != md.end(); iter++ ) {
63 fHtml_text += "<tr><td><font color='black'><b>";
64 fHtml_text += iter->first;
65 fHtml_text += "</b></font></td><td><font color='blue'><b>";
66 fHtml_text += iter->second;
67 fHtml_text += "</b></font></td></tr>";
68 }
69 fHtml_text += "</table>";
71
72 // Main window.
73 fMain = new TGMainFrame( gClient->GetRoot(), 10, 10, kVerticalFrame );
74 fMain->SetCleanup( kDeepCleanup ); // delete all subframes on exit
75 // create HTML widget
76 fHtml = new TGHtml( fMain, 1, 1 );
77 fMain->AddFrame( fHtml, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 5, 2, 2 ) );
78 fHtml->ParseText( (char*)fHtml_text.Data() );
79 // terminate ROOT session when window is closed
80 fMain->Connect( "CloseWindow()", "TApplication", gApplication, "Terminate()" );
81 fMain->DontCallClose();
82
83 fMain->MapSubwindows();
84 fMain->Resize( 700, 700 );
85
86 // set minimum size of main window
87 fMain->SetWMSizeHints( fMain->GetDefaultWidth(), fMain->GetDefaultHeight(), 1000, 1000, 0, 0 );
88 fMain->MapRaised();
89}
92 TFile mFile( "TupleEx.root" ); // TODO update name of the file
93 map<string, string>* mdMap = (map<string, string>*)mFile.Get( "info" );
94 map<string, string> newMap = *mdMap;
95 new Widget( newMap );
96}
void MakeFooter()
TGHtml * fHtml
TString fHeader
TGMainFrame * fMain
TString fHtml_text
ClassDef(Widget, 0)
TString Html() const
TString fFooter
virtual ~Widget()
Widget(map< string, string > md)
void MakeHeader()
STL namespace.
void readMetaData()