HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Getting Started

Making analysis code with the <tt>HarpoAnalyse</tt> class

The HarpoAnalyse class is the base class to process data event by event. It has three main functions:

A template analysis class HarpoAnalyseTemplate exists. The makeNewAnalysis.sh script allows to generate a copy of the template with all the required files and modifications to Makefile, harpoanalysis.cxx and hrecomonitor.cxx. For consistency, please use a name starting with "Analyse" for analysis (does not modify the data).

$ cd $HARPO_SCRIPT_DIR
$ ./makeNewAnalysis.sh AnalyseName
$ cd ../analysis
$ ls HarpoAnalyseName*
  HarpoAnalyseName.cxx
  HarpoAnalyseName.h
  HarpoAnalyseNameLinkDef.h

The script modifies Makefile, harpoanalysis.cxx and hrecomonitor.cxx. If you want to remove your analysis, look for its name in those files to remove the corresponding lines.

Making Event Selector

You can also create a selction process. It is the same type of object HarpoAnalyse, but it modifies the flag fEvAnaStatus in the event header.

$ ./makeNewSelector.sh SelectorName
$ ls HarpoSelectorName*
  HarpoSelectorName.cxx
  HarpoSelectorName.h
  HarpoSelectorNameLinkDef.h

The script modifies Makefile, harpoanalysis.cxx and hrecomonitor.cxx. If you want to remove your selector, look for its name in those files to remove the corresponding lines.

Applying the analysis

The harpoanalysis program can run your analysis (if you created it with makeNewAnalysis.sh). You can apply the analysis through the command line option -a:

   harpoanalysis -a HarpoSelectorName -a HarpoAnalyseName -b hist.root run.root

This will apply the analysis HarpoAnalyseName, to the events in run.root that pass the selection in HarpoSelectorName. The output histograms are saved in hist.root. You can apply multiple selectors, and multiple analyses. They will be run sequentially in the order given in the command line.

You can also do that in a configuration file:

  # File myConfig.cfg
  
  config:
  {
   analyses="HarpoSelectorName HarpoAnalyseName";
  };
  
  @include "HarpoReconstruction.cfg"

The analyses in the list will be applied sequentially for each event.

You can then apply the list of analyses to data:

  ./runRawData harpoanalysis RUNNO -c myConfig.cfg
  harpoanalysis -c myConfig.cfg --root run.root

Check event by event in the monitor

The HarpoAnalyse class contains a function DisplayAnalysis(TRootEmbeddedCanvas* ecTab, TGListBox* infobox), which allows to display histogram on the "Analysis" tab of the recomonitor, and text output on the text box of the recomonitor. You can look at details in the template class. The analysis can be selected in the "Analysis" menu on the left of the monitor.

Similarly, a selector can be selected in the "Selector" menu on the left of the monitor. This allows to browse events which pass the selector cuts, using the "Find Next Event" button.

A configuration window can be created for an analysis or a selector in the function ConfigFrame(TGMainFrame* fMain, Int_t id). Look at the template for more details.