Go to D0 at Work

Back to TrigSimCert Home

Using The Macros

On this page
Basic ROOT Instructions
Extra Features
Using the Makefile

Basic ROOT Instructions

Although it is possible to run the trigsimcert comparison macro directly from a release environment, it is not recommanded. In order to run the macro,the recommanded method is to check out the trigsimcert package from the CVS repository as described in the data tutorial.

cd to the directory where the trigsimcert package has been put. IN THAT DIRECTORY, setup environment (if not done previously) and launch ROOT ie:

      setup D0RunII p17.00.00 
     
      root

It is also possible to use the macros without setting up a D0 release. Make sure the kinem_util package has been checked out from CVS into your working area. Then, simply setup a working version of ROOT. The method to add packages from CVS is described in the data tutorial.

Load and compile Plots.C:

      root [0] .x trigsimcert/macros/LoadPlots.C 

Make a Plots object with the desired input/output parameters:

      root [1] Plots YourPlot("input/file","output/dir") 

"input/file" should be a text file containing a list of ROOT tuples. If any of the listed files are not found, they are skipped and the macro will just analyze the valid files. "output/dir" should be a path to an existing directory. Run the Loop function to generate the plots, using Loop(true) to generate the reference file or Loop() to produce the comparison plots.

      root [2] YourPlot.Loop() 

The reference ROOT file should be in the directory you selected as your "output/dir" (if doing a comparison), and a postscript file called plots.ps will be placed there (overwriting any previous plots.ps). If you want to name the postscript file (and the associated ROOT file) modify the line root[1]:

      root [1] Plots YourPlot("input/file","output/dir","psname")

!!Note: to keep the canvas' from poping up, run ROOT as "root -b"!!

!! BUG WARNING !!

After compiling LoadPlots.C in ROOT, the first time you run the Loop() function you may get a crash (segmentation violation), but if you quit ROOT, load LoadPlots.C again, it should be fine. The problem has to do with compiling but hasn't been sorted out yet.

For more details about the macros, you can consult the full macro documentation.

If you do want to run the macros from the release area directly, simply setup your environment and load the Plots method by doing

root [0] .x $SRT_PUBLIC_CONTEXT/trigsimcert/macros/LoadPlots.C

instead of the command given above.

This result can also be achieve by using the Makefile which is a more stable, more convenient and more powerful tool.

back to top


Extra Features

After initalizing the Plots method but before doing the Loop() over the events, a few additionnal methods are provided in the macros to customize the obtained plots.

Unbiased & ForceUnbiased Events

For versions from t04.05.00/p17 on, RefChain allows the removal of all L3Unbiased or L3ForceUnbiased events in the data set used and a comparison dataset. That way, only the events that have no unbiased or force unbiased L3 triggers in either set are used when the Loop() is called.

      YourPlot.RefChain("comparison_filelist")
(where comparison_filelist is a text file containing a list of trigsimcert ROOT trees to be compared to) removes L3Unbiased events and
      YourPlot.RefChain("comparison_filelist", true)
removes L3ForceUnbiased events.

It is necessary to use the RefChain method when producing the reference as well as when running on the data set in order to produce plots where the unbiased/forceunbiased events are correctly taken out.

Plots by Trigger Level

For versions from t04.05.00/p17 on, DoLevels allows the user to select only certain levels of certification plots to be produced by the macros.

      YourPlot.DoLevels(int levels)
where levels is any combination of 1 to 3 digits specifying which levels to take into account. For example, DoLevels(31) will produce the plots of L1 and L3.

back to top


Using the Makefile

Included in versions from t04.05.00/p17 on.

The makefile allows the user to produce the same set of comparison plots as the ROOT macros but from a command line executable.

To use the makefile, cd to the trigsimcert/macros/ directory of your trigsimcert area. Make sure the ROOT librairies are available by either setup D0RunII some_version or by explicitely doing setup root some_version. Then:

      make
      ./TrigCertAna [options]

Then, unless changing the code, there is no need to compile again.

If you do not want to get a local version of the makefile you can cd to a directory where you have write access and do:

      setup D0RunII some_version
      make -f $SRT_PUBLIC_CONTEXT/trigsimcert/macros/Makefile

You can then use the makefile in that directory.

Typical command lines would look like

      ./TrigCertAna -filelist my_filelist -makeref
      
      ./TrigCertAna -filelist my_second_filelist -psname myplots.ps

There is a command line option equivalent to all the parameters that can be set by running the macros in ROOT. The command line options are:
-h (-help) Help: shows the various command line options
-filelist inputfileslistFile containing list of trigsimcert ROOT files
-name output_directory Location of reference and output files (default current directory)
-psname postscript_file Name of output Postscript file (also used for output ROOT file name, default plots.ps)
-reffilelist filelistname File containing list of files to compare L3Unbiased information
-levels levels_to_doSpecify which trigger levels to process, levels_to_do is any combination of 1, 2 and 3
-makeref Produces a reference (no comparison made)
-force Use L3ForceUnbiased instead of L3Unbiased (requires -reffilelist)

back to top


camille@fnal.gov
Last modified: Thu Oct 14 15:16:59 CDT 2004