Simple Cosmic Ray Visualization
Every high-energy physicist must know that ROOT has some really fantastic features. I'm sure I'm not the only one who has found the learning curve a little steep, and the documentation somewhat lacking particularly when trying to link against the ROOT libraries from an external program.
I have written some extremely basic classes for visualizing cosmic ray showers. They have neither the functionality/flexibility of ROOT, nor the complexity and learning curve. It's a trade off, and for some purposes quick-n-dirty is more desirable.
Class: aonPoint
For each particle, create points (x, y, z, t) along it's track which we can draw later (or simultaneuously).
Class: aonTrack
A Track consists of a list of Points. The easiest way to create a Point is to use aonTrack::AddPoint (x,y,z,t). We can call Track::Draw() to draw all the points in a track (for example, store the whole track during the simulation, but only draw it at the end). Or we can call Track::DrawLast() to only draw the final point along the track.
Function: InitVisuals()
Does all the glut (GL utility/toolkit library) initialization. Sets some of the glut callback functions which are below, for Keyboard, Reshape, Display, Idle. Starts the glut MainLoop()
Function: DrawDetector()
Draws the earth as a sphere, with a cube on it's surface to represent the detector.
Function: Keyboard()
Sets up a couple of keys for input. 'm' starts the simulation. 'esc' exits.
Function: Reshape()
This handles window resize events.
Function: Idle()
Does nothing.
Usage:
I have added an aonTrack to my Particle class and a member function Particle::AddTrackPoint() which will add a point to that Track. Then every time I iterate through the stack (a list of Particles) I call Particle::AddTrackPoint() and Particle.itsTrack.DrawLast()
During program startup, if I have visuals turned on, I call InitVisuals(), which puts the program in the glutMainLoop awaiting keyboard input ('m' to start the simulation). If no visuals, I go straight to the simulation and don't call Particle::AddTrackPoint().