Difference between revisions of "HOWTO create a ROOT tree of detector hits and display event data with the tree"

From GlueXWiki
Jump to: navigation, search
(Looking at correlations)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Getting started==
 
==Getting started==
 +
 
The data in an evio file can be coverted into a ROOT tree by using the '''janaroot''' plugin.  Suppose you want to look at the CDC hits in more detail.  To do so, invoke the JANA framework using the following command line:
 
The data in an evio file can be coverted into a ROOT tree by using the '''janaroot''' plugin.  Suppose you want to look at the CDC hits in more detail.  To do so, invoke the JANA framework using the following command line:
<blockquote>
+
 
hd_ana -PPLUGINS=DAQ,TTab,janaroot file.evio -PAUTOACTIVATE=DCDCHit
+
 
</blockquote>
+
 
The '''DAQ''' plugin converts the evio data into raw detector objects in memory.  The '''TTab''' plugin applies the translation tables.   The '''janaroot''' plugin fills a ROOT tree and writes it out to a file called janaroot.root in the current working directory.
+
<font size="+1">hd_ana -PPLUGINS=janaroot -PAUTOACTIVATE=DCDCHit file.evio</font>
The '''-PAUTOACTIVATE''' command-line parameter invokes the code that produces the DCDCHit object in memory.
+
 
 +
 
 +
 
 +
The arguments are:
 +
;'''-PPLUGINS=janaroot'''
 +
:attach the ''janaroot'' plugin
 +
 
 +
;'''-PAUTOACTIVATE=DCDCHit'''
 +
:tell the ''hd_ana'' program to make ''DCDCHit'' causing the ''janaroot'' plugin to put them in the output ROOT file. ( additional objects can be added after ''DCDCHit'', separated by commas. ''e.g. -PAUTOACTIVATE=DCDCHit,DFDCHit,DBCALHit'' )
 +
 
 +
;'''file.evio'''
 +
:input file. for raw data, this might be something like ''hd_rawdata_004747_002.evio''
 +
 
 +
 
 +
The '''janaroot''' plugin fills a ROOT tree for each type of object created and writes it out to a file called janaroot.root in the current working directory.
  
 
To look at the janaroot.root file, run root (''root janaroot.root'') and at the root command line invoke the browser (type ''TBrowser T'';  this will pop up another window).
 
To look at the janaroot.root file, run root (''root janaroot.root'') and at the root command line invoke the browser (type ''TBrowser T'';  this will pop up another window).

Latest revision as of 07:55, 10 February 2016

Getting started

The data in an evio file can be coverted into a ROOT tree by using the janaroot plugin. Suppose you want to look at the CDC hits in more detail. To do so, invoke the JANA framework using the following command line:


hd_ana -PPLUGINS=janaroot -PAUTOACTIVATE=DCDCHit file.evio


The arguments are:

-PPLUGINS=janaroot
attach the janaroot plugin
-PAUTOACTIVATE=DCDCHit
tell the hd_ana program to make DCDCHit causing the janaroot plugin to put them in the output ROOT file. ( additional objects can be added after DCDCHit, separated by commas. e.g. -PAUTOACTIVATE=DCDCHit,DFDCHit,DBCALHit )
file.evio
input file. for raw data, this might be something like hd_rawdata_004747_002.evio


The janaroot plugin fills a ROOT tree for each type of object created and writes it out to a file called janaroot.root in the current working directory.

To look at the janaroot.root file, run root (root janaroot.root) and at the root command line invoke the browser (type TBrowser T; this will pop up another window). In the browser window, under ROOT files select janaroot.root, which gives you a list of branches on the tree. In the example below I have selected the distribution of the number of hits N in the CDC:

TBrowserView.png

In addition to the DCDCHit data, all the raw event data types (Df250PulseIntegral, etc.) are available for perusal.

Looking at correlations

A leaf quantity can be plotted against another leaf quantity in a given branch using the root command line interface. For example, to look at time in the CDC as function of charge for all straws, type

DCDCHit->Draw("t:q");

TBrowserView t vs q.png

You can apply cuts to the plotted distribution by using the second argument of the Draw method. For example, to restrict the plot above to single straw in a single ring, type

DCDCHit->Draw("t:q","ring==12&&straw==10","col");

In this example I used the third (optional) argument of Draw to use the color drawing method.

TBrowserView t vs q with cut.png

To look at correlations between variables in different branches of the tree, use the special event branch. For example, to plot FDC TDC times vs times reported by the FADC, type

event->Draw("DFDCWireDigiHit.time:DFDCCathodeDigiHit.pulse_time","DFDCCathodeDigiHit.pulse_time>0.","col");

TBrowserView event example.png

Note that you must explicitly reference each branch you are using in the Draw arguments.