event_model, event_next, event_vis : THE commands to know

For the display, THE commands to know are event_model, event_next and event_vis:

    event_next  # have an event, if not done.
    event_vis <event_model_class> [options]

The event_model command lists the event model classes (MCTrack, WCDetectorPoint, FgdDetectorPoint, FgdHit for 2.0.0) along their fields known by the little interpreter of the -cut option of event_vis.

EsbRootView_insh$ event_model
MCTrack :
E             m             p             py            t             y             
index         mother_id     pdg           pz            x             z             
is_secondary  name          px            rapidity
WCDetectorPoint :
Eloss   length  p       pdg     px      py      pz      time    x       y       z       

FgdDetectorPoint :
Eloss   length  p       pdg     px      py      pz      time    x       y       z       

FgdHit :
absorbed          dz                photoE            time_stamp_error  
added             index             photoEx           x                 
detector_id       mppcx             photoEy           y                 
dx                mppcy             photoEz           z                 
dy                mppcz             time_stamp        

For example, you can type (or have in your event.insh script):

    event_vis MCTrack -color=red
    event_vis MCTrack -cut=(pdg==50000050) -color=red
    event_vis MCTrack -cut=(pdg!=50000050)&&(mother_id!=-1)&&(is_secondary==false) -color=cyan -modeling=arrow

    event_vis WCDetectorPoint -cut=pdg==50000050 -color=red
    event_vis WCDetectorPoint -cut=pdg!=50000050 -color=blue -point_size=4

    event_vis FgdDetectorPoint -cut=pdg==22 -pickable=true -color=skyblue
    event_vis FgdDetectorPoint -cut=pdg!=22 -pickable=true -color=skyblue -point_size=4

    event_vis FgdHit -modeling=cube -color=skyblue    # FgdHits represented as cubes in solid.
    event_vis FgdHit -point_size=2

The -cut logic applies also for the event_count, event_stats, event_print commands:

    event_print <event_model_class> [options] [fields]

    event_print MCTrack -cut=(pdg==50000050)
    event_print MCTrack -cut=(pdg==50000050) x y z p

    event_count MCTrack -cut=(pdg==50000050)

    event_stats MCTrack -cut=(pdg==50000050) p t

As explained in "help event_stats", event_stats prints the sum/min/max/mean/rms for the fields of the selected objects:

EsbRootView_insh$ event_stats MCTrack x y z p t     
MCTrack (49071) sum/min/max/mean/rms with cut "" : 
          x         y           z           p           t
    -143933  -24637.4 8.48516e+06    0.310859 7.10046e+06
   -11.0951  -3.47492         150 1.77014e-09           0
 0.00249994   1.95191     191.255         0.2     409.789
   -2.93316 -0.502076     172.916 6.33488e-06     144.698
    3.47884   1.03714      14.448 0.000947268     195.431


Each event model class has a default representation which is "point" for MCTrack, WCDetectorPoint, FgdDetectorPoint, FgdHit. You can change the color and point size with the options "-color" and "-point_size" as in:

    event_vis MCTrack -color=cyan -point_size=6

The default values for color and point_size are the ones found in the EsbRootView.style XML file deposited in the res directory. The event_vis command will look in this style file for a style item with the name of the event model class and then, if found, for a color or point_size XML element in it. For example for MCTrack the XML style is:

    <style name="MCTrack">

But the graphics attributes passed as options in the event_vis command have priority over the .style file. Note that you can create your own EsbRootView.style file in your doc directory with different default values. It will override the one in res/EsbRootView.style. Then the priority order for style is:

    event_vis options  # highest priority

With the style_load_file command, you can also load a style file of your own deposited where you want and with the name you want. For example to load a my.style file put in your home directory:

    file_sep=`sys_file_sep`  # to cope also with the Windows/DOS file path syntax.
    style_load_file ${home_dir}${file_sep}my.style


A color can be given in various ways. It can be given by a common color name in the default colormap (for exa "blue"), by giving the name of a color in a known colormap, by giving an hexa encoding or by giving the three or four r,g,b,a (in [0,1]) of the color.

The command style_print_colormaps prints the known colormaps with their colors.

For example to change the background color in scene mode:

    scene_set_clear_color lightgrey
    scene_set_clear_color ROOT/kMagenta+3
    scene_set_clear_color '#FFFF00'
    scene_set_clear_color 0.2 0.1 0.2

or to draw the FgdHit as cube with the "ROOT/kMagenta+3" color:

    event_vis FgdHit -modeling=cube -color='ROOT/kMagenta+3' 


An event model class can have multiple represenations or modelings. For example the MCTrack has also an "arrow" representation. You can trigger it with the "-modeling" option as in :

    event_vis MCTrack -modeling=arrow

In this case, for each MCTrack, and arrow is added in the dynamic scene graph starting at the fields (x,y,z) and pointing in the impulse direction. The default parameters for an arrow are found in the EsbRootView.style. It is:

    <style name="MCTrack_arrow">   <!-- if MCTrack modeling is "arrow". -->
      <base_tube>false</base_tube>  <!-- if true, the base of the arrow is a cylinder,
                                         and a cone if not. -->

The FgdHit event model class has also the "cube" modeling:

    event_vis FgdHit -modeling=cube -color=skyblue