R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop Towards a Nicer User Interface The competition : JAS!

Slides:



Advertisements
Similar presentations
H.G.Essel: Go4 - J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel, S.Linev CHEP 2004 Go4 v2.8 Analysis Design.
Advertisements

Postgraduate Computing Lectures ROOT 1 What is ROOT? Tool and a Framework for OO Data Analysis As a Tool –Enter commands to display and manipulate data.
CSE 115 Week 5 February , Monday Announcements Exam 3 today Exam 3 today Lab 3 due this week Lab 3 due this week Exam 4 Monday 2/18 Exam.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
Guide To UNIX Using Linux Third Edition
PolymorphismCS-2303, C-Term Polymorphism Hugh C. Lauer Adjunct Professor (Slides include materials from The C Programming Language, 2 nd edition,
Shallow Versus Deep Copy and Pointers Shallow copy: when two or more pointers of the same types point to the same memory – They point to the same data.
From C++ to C#. Web programming The course is on web programming using ASP.Net and C# The course is on web programming using ASP.Net and C# ASP.Net is.
Graphical User Interfaces in Haskell Koen Lindström Claessen.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Sept 11, 2003ROOT Day1, Suzanne Panacek39 ROOT An object oriented HEP analysis framework. Day 1.
Microsoft Visual Basic 2005: Reloaded Second Edition
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
09-Jun-2005J. Adamczewski1 C++ course 2005 The ROOT framework 2.
21-Apr-2005J. Adamczewski1 DVEE C++ course 2005 The ROOT framework 1: Introduction.
Session 08: Architecture Controllers or Managers Graphical User Interface (GUI) FEN AK - IT Softwarekonstruktion.
FLTK Tutorial.
Introduction to Java University of Sunderland CSE301 Harry R. Erwin, PhD.
FLTK Help Session By Richard Yu Gu CS 638 -Graphics Fall, 1999.
Java Programming: Advanced Topics 1 Common Elements of Graphical User Interfaces Chapter 6.
Learning to Use Root for STAR Gene Van Buren (UCLA) for the STAR Collaboration Accessing STAR Data Programming for STAR (Makers) Star => Computing => Tutorials.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
1 Chapter Eleven Handling Events. 2 Objectives Learn about delegates How to create composed delegates How to handle events How to use the built-in EventHandler.
CSC 205 – Java Programming II Applet. Types of Java Programs Applets Applications Console applications Graphics applications Applications are stand-alone.
Windows Forms Navigating database with windows forms.
V Slide 1V 1.0Slide 1 Class Details School Administrator School JAN 1 Class Subject Maintain Class Details  Basic Information  Class-Based Subject.
CNS 1410 Graphical User Interfaces. Obectives Students should understand the difference between a procedural program and an Event Driven Program. Students.
1 CSC 222: Object-Oriented Programming Spring 2012 netBeans & GUIBuilder  netBeans IDE create/edit/run a project  GUIBuilder JFrame, JButton, JTextField,
Introduction to Java COM379 (Part-Time) University of Sunderland Harry R Erwin, PhD.
Build-A-Button Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, October 8, 2003.
CPSC 252 The Big Three Page 1 The “Big Three” Every class that has data members pointing to dynamically allocated memory must implement these three methods:
Java Beans. Definitions A reusable software component that can be manipulated visually in a ‘builder tool’. (from JavaBean Specification) The JavaBeans.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
May 12, 1998CS102-01Lecture 7-3 Building GUIs in Java I CS Lecture 7-3 A picture's worth a thousand words.
Object Oriented Analysis & Design Game Patterns. Contents  What patterns are  Delegation  Game Loop  Scene Graph  Double Buffering  Component 
Class Builder Tutorial Presented By- Amit Singh & Sylendra Prasad.
Chapter 5 Introduction to Defining Classes
QT Programming QT Programming Ruku Roychowdhury. Background QT is a cross platform application framework. Widely used to develop GUI applications. Originally.
ACM/JETT Workshop - August 4-5, : Defining Classes in Java.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
General Purpose ROOT Utilities Victor Perevoztchikov, BNL.
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
S.Linev: Go4 - J.Adamczewski, H.G.Essel, S.Linev ROOT 2005 New development in Go4.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
1 G4UIRoot Isidro González ALICE ROOT /10/2002.
Go4 Workshop J.Adamczewski-Musch, S.Linev Go4 advanced features.
LCG AA Meeting 30 June 2004 Ilka Antcheva Graphics User Interface in ROOT.
Java State Explorer by: Richard Sherman Stephanie Taylor.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
COMPOSITE PATTERN NOTES. The Composite pattern l Intent Compose objects into tree structures to represent whole-part hierarchies. Composite lets clients.
Chapter 12: Pointers, Classes, Virtual Functions, Abstract Classes, and Lists.
Creating an Object that can draw itself The paint method can ‘draw’ because it is passed a graphics environment as a parameter. If a class method is passed.
Joe Foster 1 This talk extends the one I gave in 2006 called Visualizing Data with ROOT. –
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
Section 10.1 Define scripting
CSC 222: Object-Oriented Programming
Inheritance and Polymorphism
Chapter Eleven Handling Events.
Ellen Walker Hiram College
Event Driven Programming
Doug Jeffries CS490 Design Patterns May 1, 2003
CS18000: Problem Solving and Object-Oriented Programming
Polymorphism Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
Constructors, GUI’s(Using Swing) and ActionListner
Event loops.
Dynamic Array: Implementation of Stack
NatQuery An End-User Perspective On Using To Extract Data From ADABAS
Introduction to Classes and Objects
Presentation transcript:

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop Towards a Nicer User Interface The competition : JAS!

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop User Interface: helper macro & GUI Assertion: –end users should not have to deal with details of file manipulation, random access to events and some histogram manipulation Create helper macro to work in conjunction with ‘standard’ Event class –open, reopen, rewind files –process n events from anywhere in the file –clear histograms –well-defined places to put histogram definitions and event loop code Create GUI to give even easier access to helper member functions

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop MyEvent Helper Macro Started from Root’s MakeClass idea Goals –user only touches a small part of the MyEvent code for histogram definitions and the event loop and analysis –much of the code is hidden in the.h file –file open, rewind, and random access to events handled by member functions –some global histogram manipulation (eg clear) Most standard functions held in base class MyEvent member functions –constructor - opens file –destructor cleans up - allows editing of macro and reload –Init - open new file –Rewind –Go(n) - process n events through user analysis –StartAtEvent- reset starting point for Go –HistDefine - user histograms –HistClr - clear all histograms

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop MyEvent.h class MyEvent { public : TFile* histFile; // histogram file TFile* f; // input file TTree *fTree; //pointer to the analyzed TTree Event* event; MyEvent() {}; // default ctr MyEvent(char* rootFileName); // ctr with root file name ~MyEvent(); // default dtr void StartWithEvent(Int_t event); // start next Go with this event void Init(char* rootFileName); // re-init with this root file void HClr(); // Reset() all user histograms void AllHistDelete(); // delete all user histograms void HistDefine(); // define user histograms void MakeHistList(); // make list of user histograms void Rewind(); // reset for next Go to start at beginning of file void Go(Int_t numEvents=100000); // loop over events private: Int_t m_StartEvent; // starting event TObjArray* HistList; // list of user histograms };

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop Example of Use gROOT->LoadMacro("startmacro.C") // load shared libs gROOT->LoadMacro("MyEvent.C"); // 'compile' class MyEvent* m = new MyEvent("MyRootFile.root"); // create MyEvent object m->Go(500); // loop over 500 events. Go contains your analysis code m->Go() // look at remainder of file... m->HClr(); // clear histograms m->Init("AnotherRootFile.root"); m->Go(50);... and so on … delete m; // prior to reloading macro gROOT->LoadMacro("MyEvent.C"); // 'compile' class … and so on … It’s easy to define macros to hold the gRoot directives.

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop User Input: Histogram Definition void MyEvent::HistDefine() { // define histograms here // set up histograms and root file for them here histFile = new TFile("Histograms.root","RECREATE"); TH1F *NLOGS = new TH1F("NLOGS","Num Cal Logs", 100,0,100); TH1F *LOGID = new TH1F("LOGID","Cal LogID", 100,0,100); // end histogram definition ________________________________________ }

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop User Analysis - 1 void MyEvent::Go(Int_t numEvents) { // event loop. User analysis goes here. User must refresh pointers to // histograms. // This is the loop skeleton // To read only selected branches, Insert statements like: // fTree->SetBranchStatus("*",0); // disable all branches // fTree->SetBranchStatus("branchname",1); // activate branchname printf("\nNumEvents is: %i\n", numEvents); if (fTree == 0) return; Int_t nentries = fTree->GetEntries(); printf("\nNum Events in file is: %i\n", nentries); Int_t curI; Int_t nMax = TMath::Min(numEvents+m_StartEvent,nentries); if (m_StartEvent == nentries) { printf(" all events in file read\n"); return; } Boilerplate

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop User Analysis - 2 // refresh your histogram pointers here ______________________________ TFile *histFile = (TFile*)gROOT->GetFile("Histograms.root"); TH1F *NLOGS = (TH1F*)histFile->Get("NLOGS"); TH1F *LOGID = (TH1F*)histFile->Get("LOGID"); // end histogram pointer refresh ____________________________________ Int_t nbytes = 0, nb = 0; for (Int_t ievent=m_StartEvent; ievent<nMax; ievent++, curI=ievent) { if (event) event->Clean(); nb = fTree->GetEvent(ievent); nbytes += nb; // start analysis code _______________________________________ int nCAL = event->CAL()->GetEntries(); NLOGS->Fill(nCAL); for (int ihit=0; ihit < nCAL; ihit++) { CalHit *hit = (CalHit*)event->CAL()->At(ihit); LogID *log = (LogID*)hit->GetLog(); LOGID->Fill(log->ID()); } } // end analysis code in event loop ___________________________ m_StartEvent = curI; } Weak point!! User analysis

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop GUI Add to HADES example Buttons for the MyEvent member functions

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop GUI - cont’d But only on unix!

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop What’s Next? Java GUI? V 2.23 now exposes GUI drawing classes for override Possible to create a Java GUI framework to solve platform problem Classes such as TVirtualX, TVirtualPad, TVirtualHistPainter, etc. need to be subclassed to provide interfaces to Java. Then their Java Native Interface counterpart classes must be created. Once this is done, people should be able to create a Java GUI that substitutes a “TJavaHistPainter” for the global gHistPainter object, etc. Then have a “TJavaPad” that histograms, etc., get painted to. This may not be a good solution –lots of work to duplicate full Root functionality –support nightmare –may be OK in short term for just these 3 classes

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop Java GUI All Platforms with a JVM! All Platforms with a JVM! All GUI widgets are Java (Swing?) components. Widget (1) would be an overridden Java canvas which uses JNI to talk to a corresponding ROOT class. When GUI events (button clicks, etc.) occur, Java widgets can interact with each other, including the canvas widget. Other JNI classes could be added to facilitate communication between the Java GUI and ROOT code. For such things as creating, clearing, or updating histograms, or other ROOT objects. To reproduce the Hades GUI (without postscript support), three ROOT classes (see next slide) would have to be overridden. Later TVirtualPS, TVirtualTreeViewer, etc., could be overridden as they are needed. (1)

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop Java Provided by Java New Classes C++ New Classes Provided by ROOT ROOT - Java interface TVirtualPad TPad TJPad TVirtualHistPainter THistPainter TJHistPainter TVirtualX TGX11 TGJava TGWin32 JNI PadHistPainterGJava Access to member data and functions Swing GUI classes, etc. Events

R.Dubois D.Flath 4 Feb 20002nd Root Users Workshop Conclusion Users need some helper macro to do the mundane work for them –we have invented one that suits our needs for now: MyEvent GUI makes it even nicer, BUT: –Root GUI classes are not maintained equally on NT and Unix –investigate a Java interface for the GUI –we will talk to the FNAL folks. From initial discussions, it appears more daunting than we thought!