HA: C++ and user interface

From: Valeri Onuchin <Valeri.Onoutchine_at_cern.ch>
Date: Sat, 26 Apr 2008 08:20:38 +0200


Hi Tom,
off-topic. Very nice GUI. Many things from there can be easily reused and even might be used as addons to "official" ROOT tree-viewer (the power of C++ scripting :) Thanks for sharing. Personally I would like to see a repository of such type GUIs in ROOT - a web page with screenshots and scripts which do these GUIs.

Regards. Valeriy

-----Исходное сообщение-----
От: owner-roottalk_at_root.cern.ch от имени Tom Roberts Отправлено: Пт, 4/25/2008 4:39
Кому: Rene Brun
Копия: 'ROOT Talk'
Тема: [ROOT] C++ and user interface  

[I sent this once, but it was apparently too long for the list. To make it short enough, I put the macro file onto

     http://www.muonsinc.com/g4beamline/HistoRoot.C ]

Rene Brun wrote:
> Tom Roberts wrote:

>> I, too, am in HEP. And what you say is true for students, postdocs, 
>> and junior faculty that are traditionally involved in simulations and 
>> analysis. I am trying to provide tools that "even a professor can 
>> use", and in my experience most of them do not know C++, and have 
>> little interest in learning. 

> You must be in a different planet.

As an informal poll, I just asked the people in the room of the conference I am attending "How many people have used C++ in the past year?". This was 10 minutes before the start, and four people out of 19 raised their hands (myself included). This is the Low Emittance Muon collider Workshop at Fermilab, and simulations are the majority of the work discussed in this workshop. The median age in the room is >40. Many of the simulations used ICOOL, written in FORTRAN, and its author did not raise his hand; many simulations used G4beamline, written in C++ (by me), and a few used other accelerator-physics tools -- NONE of these tools require any programming by the user.

This may be a "different planet", but I believe my experience is quite normal (arguably this workshop is as much accelerator physics as it is HEP). Physicists are not computer scientists, and in my experience only those involved in building tools are really expert in the use of computers, including programming in any language. Grad students and postdocs are usually so involved, but more senior people generally are not. And in my experience physicists are quite conservative, and FORTRAN tools are as common as C++ tools. Perhaps CERN is different from Fermilab in this, but I doubt it -- C++ is ubiquitous in the Computing Division, but not in the Accelerator Division or the Particle Physics Division, and I work with people from the latter two.

> I don't believe that any serious
> physicist can do any work without
> knowing C++ these days.

My experience is VERY different. Offhand, I cannot remember a single professor who has used C++ for more than trivial examples (not to mention people from AD and PPD). And, of course, "knowing" C++ is very different from being expert enough to build a complex physics tool in C++.

> Hiding C++ is the thing to do if you show always
> the same very restricted
> application, but a bad service you give to your students if you try to
> discourage them to learn C++.

I am not "discouraging" people from learning C++, I am providing tools that are easy to use, for people who don't know C++, and for physicists who feel answers are more important than wasting time using sub-optimal tools.

I have spent 12 years in HEP and 24 years at Bell Labs, and am an expert in software development and C++ programming. When I need a histogram (I _do_ use my own tools to do physics), I use historoot (a script using my Root GUI macro), not a Root/Cint script written for the plot needed, and not TBrowser. Because I can get the answer in much less time and effort with a user interface designed to produce plots, rather than one designed to be a C++ interpreter or one designed to debug and inspect Root data structures.

> Could you post your comments, gripes to the ROOT browser? Could you post
> your script, such that we can
> understand what you mean by a good GUI and try to improve the browser or
> other utilities if we find something interesting in your script.

It's not a question of "improving" the browser, its a question of using the appropriate tool for the job. TBrowser is not designed to generate plots, HistoRoot is. It is a work in progress, and some aspects are not yet complete (e.g. handling particle types, the .historoot file, the help text).

The macro is http://www.muonsinc.com/g4beamline/HistoRoot.C , and can be executed:

      root -b -l HistoRoot.C
This macro crashes if you do ".q" (close its GUI window to exit). It also crashes sometimes when you close a plot window. And it crashes on "CreatePlot" in Root 5.18 (inside Plot::Plot(...), line 410), but does work in 5.12-5.16. I provide a bash script and a Windows shortcut to use it, but they won't work without other parts of my distribution, so I did not include them here.

[update: the version I put at the above URL has a good chance of avoiding these crashes, and works for simple things in 5.18.]

The attached "g4beamline.root" file contains a few events in a TNtuple "VirtualDetector/Det1" that can be plotted (most of my .root files have many more TNtuples and lots more events). Open it using File/Open and do the obvious.... If you have other .root files containing TNtuples, or ASCII files in column or .csv format, try them.

I develop software in a user-driven manner related to "rapid prototyping"; any comments or suggestions are welcome.

Tom Roberts Received on Sat Apr 26 2008 - 08:20:45 CEST

This archive was generated by hypermail 2.2.0 : Tue Apr 29 2008 - 17:50:01 CEST