D0 GROUP LEVEL3
ONLINE LESSONS

Gustaaf Brooijmans

Fermilab, MS # 357
Tel: +1 (630) 840 4269 
Last Update:
6/8/2000
by Gustaaf Brooijmans

Episode XIII
Logging of Timing and Statistics for Level 3 Tools

by Gustaaf Brooijmans

This episode will tell you how you should set up your tool to log statistics while running.  It will tell you what you have to implement in your tool,  and what should be logged.

Implementation in Tools

The statistics manager has been implemented as a so-called singleton pattern.  To use it (note that all tools are required to implement this), your tool should do the following: This implies you should  #include "l3fstatmanager/l3StatManager.hpp". Now you're ready to use the manager: we have decided (but this can be discussed) to log four items: (1) the time it takes for the tool to make its calculations,  (2) its point of exit, which is useful for timing versus rejection studies(an electron tool could exit before checking for tracks if no satisfactory calorimeter clusters were found for example), (3) an integer with meaning left to the tool author (this could be the number of candidates found for example), and (4) the number of times a tool gets called in an event.
So,  only when your tool has to do some work (we don't want to time your tool returning cached results, and we don't want to duplicate exit point etc. in the statistics - so this call usually comes after if (!HaveIRun())...): And then at every exit point (i.e. not only at the end of the if (!HaveIRun()) {... block but also at every intermediate exit point): From the statmanager point of view, each startclock-stopclock interval is treated as one event, so to address the possibility of multiple calls per event (when regional unpacking is done for example), we have added the possibility to log the number of calls per event.   To do this, keep an internal counter of the number of times your tool runs in an event, and in the ToolReset() method, use Note that you should initialize the variable "ncalls" to 0 in your MakeMe().

That's it!
 

What Happens Behind My Back?

The information is stored in an instance of class l3ToolStats (one per tool), and at regular intervals ScriptRunner will make sure it is shipped to the monitoring tasks.
 

How Do I Access the Results During Development?

This is pretty easy:  at the end of your job, get a pointer to the development statmanager: (Note that you will need to #include "l3fstats_devel/l3StatDevel.hpp" in your test program)
Then invoke its drawhist method: This will create a file toolstats.root in your working directory which contains the histograms you're looking for!
 

As usual: comments, questions?  -> Feel free to contact me.
 
 
Main Page Next Episode