HannaPlusPlus
Page maintainer: Andreas
| This page is considered done. It been reviewed by Hyon-Suk. There may be missing elements, but they are all flagged and the text has no errors. |
Hanna++ is a ROOT based C++ extension to the Hanna analysis framework. Before you continue and if you haven't done already, please have a look at the Hanna, uDST and MC uDST documentations.
The uDST Framework
Data Flow
The flow chart above shows how the Hanna++ internal data structures are filled and how the actual analysis codes can access the data. As Hanna++ is an extension to Hanna, a Hanna based analysis code is used to fill the data structures. In the flow chart this code is represented by the box Hanna-to-Hanna++. It will read in the uDST data and distribute it as ROOT objects to the Internal Data Containers. This is done via the main analysis object uDST. The Hanna-to-Hanna++ interface is aware of all uDST ddl versions and therefore can read in uDST data from all productions. For a documentation of the different uDST productions see the page Current Productions.
The class uDST is the main analysis object of the Hanna++ uDST framework. It provides access to all data structures and manages the list of Analysis Modules (uDSTVAnalyzer). The idea of analysis modules is to split the actual analysis code into small pieces that can be reused in different types of analyses and shared with other analyzers. In addition analysis modules can be arranged in a hierarchy.
Work Flow
The flow chart below shows the work flow of the Hanna++ uDST analysis framework. As the Hanna-to-Hanna++ interface is based on Hanna it provides all user functions known from Hanna (user_init(), user_runinit(), user_burstinit(), user_event(), user_burstend(), user_runend() and user_end()).
From within these functions the member functions AnaMain(), AnaInit(), AnaInitCuts() and AnaEnd() of a class derived from uDSTVUserFunctions are called to set up and create all analysis modules. The Hanna-to-Hanna++ interface will also call the Begin(), BeginOfRun(), BeginOfBurst(), BeginOfEvent(), Process(), EndOfEvent(), EndOfBurst(), EndOfRun() and End() member functions of the uDST main analysis object. The uDST main analysis object will then call the respective member functions in all analysis modules registered with the analysis object. Analysis modules can be arranged in a tree like structure (hierarchy) which means that an analysis module can have child analysis modules. The uDST main analysis object will not call the appropriate member functions for a child module automatically. The user has therefore to call those functions from within the parent module. For a step by step guide on how to create your own analysis modules and analysis program have a look at the examples provided with the Hanna++ source distribution.
The following list shows what can/should be done in each of the analysis modules member functions:
- uDSTVAnalyzer::Begin()
- Create histograms
- Add variables to the output ROOT tree
- Add child analysis modules
- uDSTVAnalyzer::BeginOfRun()
- uDSTVAnalyzer::BeginOfBurst()
- Check burst level data
- uDSTVAnalyzer::BeginOfEvent()
- Prepare for the upcoming event
- uDSTVAnalyzer::Process()
- Actual analysis code should go here
- uDSTVAnalyzer::EndOfEvent()
- Do some post event stuff here
- uDSTVAnalyzer::Clear()
- Cleanup after event
- uDSTVAnalyzer::BeginOfBurst()
- uDSTVAnalyzer::EndOfBurst()
- uDSTVAnalyzer::EndOfRun()
- uDSTVAnalyzer::End()
- Clean up
Further information can be found in the Hanna++ class documentation pages.
Data Structures
The main analysis object uDST provides the interface to all Hanna++ internal data structures. The figure above is a description of the data structures available. The structure of each table (columns) available in the ADAMO input files is represented by a class. For each row in a table of the ADAMO input file an object of the corresponding type is stored in the internal data containers. The naming scheme of the classes representing an ADAMO table is T followed by the name of the table. For a complete description of the tables stored in a uDST file have a look at the uDST Documentation, the MC uDST Documentation and the Hanna++ class documentation pages.
In the figure thin black and red arrows denote relationships between certain objects which are present in the ADAMO data structures. On filling the internal data structures, the Hanna-to-Hanna++ interface has already resolved these relationships by the appropriate ADAMO navigations. So a track in the forward spectrometer (Tg1Track) for instance already has a pointer to a tracked cluster (TsmTrack) in the calorimeter.
Versions
Hanna++ provides a uDST version independent interface to the data. The ADAMO navigation is done inside the Hanna-to-Hanna++ interface. This code is a regular Hanna based program that is aware of most of the uDST productions. Currently the following uDST productions are supported:
- MC
- 96d0
- 97d1
- 98d0, 98d1
- 99c0, 99c1
- 00d2
- 02b0, 02c0, 02c1
- 03b0, 03c0, 03c1
- 04b0, 04c0, 04c1
- 05b0, 05c0, 05c1, 05c2
- 06b0, 06b1, 06b2, 06d0
- 07b0, 07b1, 07c0
If you are missing a uDST production or if you experience problems with one of them, file a request or bug report on the Hanna++ Bugs page and send a mail to Andreas Mussgiller.
The HRC Framework
Data Flow
The flow chart above shows how the Hanna++ internal data structures are filled and how the actual analysis codes can access the data. As Hanna++ is an extension to Hanna, a Hanna based analysis code is used to fill the data structures. In the flow chart this code is represented by the box Hanna-to-Hanna++. It will read in the HRC data and distribute it as ROOT objects to the Internal Data Containers. This is done via the main analysis object HRC.
The class HRC is the main analysis object of the Hanna++ HRC framework. It provides access to all data structures and manages the list of Analysis Modules (HRCVAnalyzer). The idea of analysis modules is to split the actual analysis code into small pieces that can be reused in different types of analyses and shared with other analyzers. In addition analysis modules can be arranged in a hierarchy.
Work Flow
The flow chart below shows the work flow of the Hanna++ HRC analysis framework. As the Hanna-to-Hanna++ interface is based on Hanna it provides all user functions known from Hanna (user_init(), user_runinit(), user_event(), user_runend() and user_end()).
From within these functions the member functions AnaMain(), AnaInit(), AnaInitCuts() and AnaEnd() of a class derived from HRCVUserFunctions are called to set up and create all analysis modules. The Hanna-to-Hanna++ interface will also call the Begin(), BeginOfRun(), BeginOfBurst(), BeginOfEvent(), Process(), EndOfEvent(), EndOfBurst(), EndOfRun() and End() member functions of the HRC main analysis object. The HRC main analysis object will then call the respective member functions in all analysis modules registered with the analysis object. Analysis modules can be arranged in a tree like structure (hierarchy) which means that an analysis module can have child analysis modules. The HRC main analysis object will not call the appropriate member functions for a child module automatically. The user has therefore to call those functions from within the parent module. For a step by step guide on how to create your own analysis modules and analysis program have a look at the examples provided with the Hanna++ source distribution.
The following list shows what can/should be done in each of the analysis modules member functions:
- HRCVAnalyzer::Begin()
- Create histograms
- Add variables to the output ROOT tree
- Add child analysis modules
- HRCVAnalyzer::BeginOfRun()
- HRCVAnalyzer::BeginOfEvent()
- Prepare for the upcoming event
- HRCVAnalyzer::Process()
- Actual analysis code should go here
- HRCVAnalyzer::EndOfEvent()
- Do some post event stuff here
- HRCVAnalyzer::Clear()
- Cleanup after event
- HRCVAnalyzer::BeginOfBurst()
- HRCVAnalyzer::EndOfBurst()
- HRCVAnalyzer::EndOfRun()
- HRCVAnalyzer::End()
- Clean up
Further information can be found in the Hanna++ class documentation pages.
Data Structures
The main analysis object HRC provides the interface to all Hanna++ internal data structures. The figure above is a description of the data structures available. The structure of each table (columns) available in the ADAMO input files is represented by a class. For each row in a table of the ADAMO input file an object of the corresponding type is stored in the internal data containers. The naming scheme of the classes representing an ADAMO table is T followed by the name of the table.
In the figure thin black and red arrows denote relationships between certain objects which are present in the ADAMO data structures. On filling the internal data structures, the Hanna-to-Hanna++ interface has already resolved these relationships by the appropriate ADAMO navigations. So a track in the recoil detector (TrdTrack) for instance already has a pointer to all spacepoints (TrdSpacePoint) used in that track.
Versions
Hanna++ supports HRC data via a dedicated Hanna-to-Hanna++ interface for HRC/XTC data. Currently both versions of the recoil.ddl are supported.
- V1 (version 1 of the recoil.ddl)
- 06a, 06b, 06c
- 07a, 07b
- V2 (version 2 of the recoil.ddl)
- 06d
- 07c
- For early years or if you are not interested in recoil data you can use either one of the versions
If you experience problems with one of them, file a request or bug report on the Hanna++ Bugs page and send a mail to Andreas Mussgiller.
Cut Management
Hanna++ has a very comfortable cut management included. It allows the user to store the chosen cuts in a nice (human-readable) file format and to change cuts easily. The input/output file format is based on XML (Extensible Markup Language). An explicit example is given in Example 2, here only the basic features will be described.
A variety of cut classes are offered in Hanna++ for the most common variable types such as boolean, integer, double, etc and the standard operators are provided. In addition, for integer and double variables range classes can be chosen and classes for functions and graphical cuts included. The cuts are defined in the header file of the analysis module or a predefined selector and should also be documented there. This information will be added to the XML output file. In an analysis with child modules, the cut hierarchy is conserved and will be reflected in the structure of the output file.
In the analysis modules or selectors a default value for all used cuts is set. It can be changed in the code or by reading in a user-defined XML file via the command line option "--cuts <file>".
Python Interface
Hanna++ also provides a Python interface between the data (HRC/XTC and uDST) and the framework. For details have a look at the Python examples below.
Installation
For installation instructions have a look at the dedicated Hanna++ Installation page.
There are also public installations of Hanna++ available in /group02/rcoilgrp/Software/Hanna++_X.YY.00 in which X and YY are the ROOT version numbers Hanna++ was compiled for. The public installations are kept up to date and are recompiled after every major CVS commit.
Examples
The source distribution of Hanna++ provides a collection of simple examples that are intended as a step by step guide on how to use Hanna++. They will also explain some of the key features.
uDST
- Example 1
- Simple example that produces histograms with the position and energy deposits of tracked and untracked clusters in the calo as well as the z vertex distribution.
- Example 2
- This example is based on example 1 and introduces the use of cuts and the Hanna++ cut management.
- Example 3
- Based on example 2 and introduces the use of option strings when creating analysis modules. This is also the first example with multiple analysis modules.
- Example 4
- Example that produces histograms for the Q2, nu, xb, W2 and y distributions. This example uses a child analysis module to select DIS events.
- Example 5
- This example is based on example 4. In addition it writes the DIS kinematic variables to a ROOT tree. The tree will also have a branch that holds the number of untracked clusters.
- Example 6
- Example 6 is based on the previous example and produces the same histograms and ROOT trees. The only difference is that a burst selector is used that reads in the burst list. For details have a look at the page Burst lists with Hanna++.
- Example 7
- First Hanna++ example that deals with MC data. The analysis module used in this example uses the standard DIS event selector module. For DIS events the reconstructed and generated values for Q2, nu, xb and W2 are written to a ROOT tree.
- Bootcamp exercise
- Simple analysis program used to produce the ROOT tree with condensed MC data for the ROOT exercise of Bootcamp 4
- RICH unfolding example
- Simple example program that reads in inverted Pmatrices and makes a histogram of unfolded pions.
- Python Example 4
- Python version of Example 4
- Python Example 7
- Python version of Example 7
HRC
- HRC analysis example
- Very simple example intended as a skeleton for a HRC analysis.
- Python HRC analysis example
- Python version of HRC analysis example
More Information
Related Pages
- Hanna++ Tools
- Installation instructions
- Releases and release notes
- Hanna++ Doxygen Documentation
- Hanna++ Utility and Helper Classes
- uDST Command Line Options
- HRC Command Line Options
- Hanna++ Client Communication
- Burst lists with Hanna++
- Collection of analysis modules
- Hanna++ Bugs (use this page to file requests and bug reports)
- Please use the cern-root mailing list for any discussion and questions about Hanna++
- RecoilUtils - Various Hanna++ extensions and additional libraries for the Recoil Detector