DIRC R&D Software User's Guide

Analysis of a PMT scan (update needed!)

The PMT scanning setup currently produces a raw data format (we refer to that as the flat file) via ROOT I/O that is very compact and efficient. It it not, however, intuitive nor does it lend itself to interactive data analysis. We therefore convert the flat file format to a ROOT ntuple (we refer to that as the inter file), allowing ROOT/CINT access to the events - in other words, interactive analysis (like PAW in the old days) or batch analysis (like FORTRAN jobs to read ntuples in the old days).

Conversion from the raw data to the inter file happens semi-automatic with a cron job that runs on kzero. If the inter file has not been produced, you can do that manually, but I won't get into that here. Please refer to the detailed documentation. Note that an inter file is only created automatically after one more flat file has been created by the scanning setup.

The inter files are kept on NFS and a copy o fthe recent files is usually also on kzero, so ssh to kzero and go to one of the four local disks (called /u1 /u2 /u3) there. Create a directory for yourself if you don't have one already, use your user id as directory name.

By default, the new inter files will be located in /u2/pmtscans. You can directly access the inter file from there, for example type

 root /u2/pmtscans/inter_file_date20040203_time535.root
The root ntuple in the file is called main_scan. There are a number of ways to analyze this root ntuple.
  1. You can use a graphical GUI to make plots. To open the GUI in ROOT, type
     TBrowser B 
    and in the ROOT Object Browser window select the ROOT Files icon, then the icon that has the file name, then right-click on the icon named main_scan and select Start Viewer. A window will open that shows all quantities in the ntuple, simple click, for example, on the icon called hits_values_pad24 to plot the time distribution for all hits on pad number 24 in number of TDC counts for the line from February 3, 2004, at 5:35 am.
  2. You can simply make plots of quantities in the ntuple, for example
     main_scan->Draw("hits_values_pad24"); 
    will plot the time distribution for all hits on pad number 24 in number of TDC counts for the line from February 3, 2004, at 5:35 am.
     main_scan->Draw("hits_values_pad24>>myhist1(651,-0.5,650.5)"); 
    will do the same but will use the 651 bins from -0.5 through 650.5.

  3. You can write a simple C program to analyze the ROOT ntuple in batch mode or interactively. This is the equivalent of kumac files in PAW and FORTRAN/COMIS files in PAW. See Thomas' CRT web page for instructions.
The quantities in the main_scan ntuple are: for a total of 194 variables.

Please refer to examples in the CRT software or in the ROOT manual for more on ROOT commands and scripting.

Analysis recipe example: 2d relative efficiency plot

Ingredients: ssh to the fast linux machine, cd to the directory that contains the inter_files. Now create a file that lists all inter_files of the scan and set up the chain to combine them
\ls inter*[0-9].root > ! datafile3
root -b -l -q ../chain_OVER_ALL_LINESCANS_2004_local.C
Inspect the file overall_efficiency.C and, if necessary, adjust the PMT boundaries, width and rotation. Now create the macro that will book and fill the histograms.
root -b -l -q overall_efficiency.C
and run that macro to produce a new ROOT file that contains the 2d histogram
root -b -l combined.root overall_efficiency_run.C > &! opfile < /dev/null
If you plan to draw the PMT boundaries and pad numbers on top of the scan result, create a file that contains the boundaries. Edit make_pad_boundaries.C so that the PMT size and position are correct. Then create the new file called store_pad_boundaries.root
root make_pad_boundaries.C  
To plot the resulting 2d efficiency histo, run a ROOT session with the following commands:
root store_signal.root

  gStyle->SetOptStat(0);
  gStyle->SetNumberContours(50);
  normalized->SetTitle("Uniformity, MCP #5, scan 20040113, HV: -2.4kV")
  normalized->Draw("COLZ");

  TFile* f = new TFile("store_pad_boundaries.root")
  boundary->Draw("SAME BOX");
  Pads->SetMarkerSize(1.)
  Pads->Draw("TEXT SAME");
Print a PostScript or GIF file from the ROOT window if you want.

If you want to see the uniformity and efficiency plotted in the standard four eps files, edit pmt_effi.C and enter the correct PMT info and scan parameters and then run the macro with:

root -q -b -l pmt_effi.C
You're done.

Last significant update: February 3, 2004, by Joe