# Presentation: 758720

## The STAR offline framework*

- V. Fine

- *) See also: **h****ttp://sol.star.bnl.gov/~fine/Publications/**_**Chep2000.ppt**_
**          ****http://chep2000.pd.infn.it/abs/abs_326.htm**
**          **http://root.cern.ch/root/R2000Abstracts.html

## STAR reconstruction framework*

- * “... *a set of cooperating classes that make up a reusable design for a specific class of software ...*”
- by **Erich Gamma**,et al.
- “Design Patterns: Elements of Reusable Object-Oriented Software”, Addison-Wesley Pub Co, 1995.

- “The framework dictates the architecture of your application.  It defines the over-all structure, its partitioning into classes and objects, the key responsibilities thereof, how the classes and objects collaborate, and the thread of control. “

- A framework predefines these design parameters so **physicists can**
- design their solutions using a proven programming model and can
**concentrate on the specifics of their applications**.

## STAR framework is designed to support the  chained components, which can themselves be composite sub-chains, with components (“makers”) managing “datasets” they have created and are responsible for.

- An **St_DataSet** class from which data sets and makers inherit allows the construction
- of hierarchical organizations of components and
- data, and centralizes almost all system tasks:

-  **data set navigation**,
-  **I/O, database access**,
-  **inter-component communication.**

## Permanent stable interface 	- 	various datas

- Various interfaces 	 	- 	permanent data

*Abstract interface, hidden data approach*

*Dataset model, transparent data*

- We do not know how our data will look like,
-  but we know how we will access them

- We do  know how our data will look like,
-  but we do not know how we will access them

## Basic St_DataSet properites

_***Dataset Member***_.   Any object from the collection above is called “***DataSet Member****”*
_***Structural  member***_. The *“Dataset Member”* is its *“Structural member”* if its “back pointer” points to this object
_***Dataset Owner***_ (parent). We will say this St_DataSet object “owns”
- (or is an owner / parent of ) another St_DataSet object if the last
- one is its *“Structural Member*”
-  _***Associated member***_. If some object is not *“Structural member”* of this object we will say it is an *“Associated Member”* of this dataset
-  _***Orphan dataset***_.    If some dataset is a member of NO other St_DataSet object it is called an *“orphan”* dataset object

- _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)__[DataSet](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)_* object ::= the "named" collection of *_[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)__[DataSet](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)_* objects*

## OO model of the STAR simulation / reconstruction chain:

- _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)__[DataSet](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)_
- _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSetIter.html)__[DataSetIter](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSetIter.html)_

- “base” container
- class

- _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_ObjectSet.html)__[ObjectSet](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_ObjectSet.html)_

- _[St_Table](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_Table.html)_
- _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_TableSorter.html)__[TableSorter](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_TableSorter.html)_

- _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_FileSet.html)__[FileSet](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_FileSet.html)_

- _[St_Node](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_Node.html)_/
- _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_NodeView.html)__[NodeView](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_NodeView.html)_

- _[StMaker](http://www.star.bnl.gov/STAR/html/comp_l/root/html/StMaker.html)_

**Data definition**

**“****abstract” TObject**

**“****file system”**
** ****description**

**GEANT Geometry**
** ****structure**

**Flow control**

- _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)__[DataSet](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)_* object ::= the "named" collection of *_[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)__[DataSet](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)_* objects*

## No transaction changes the dataset relationship

- StMaker

- StMaker

- StMaker

- .maker

- .data

- .const

- .const

- .data

- 1. Init()

- 2. Make()

- GetDataSet()

- AddData()

- _“__regular” makers communication_

*No transaction changes the dataset relationship*

## StMaker

- .maker

- .data

- .const

- .garb

- {

- 56 different
- makers

## Typical STAR St_DataSet/St_Table structure

- Since St_Table's are subclasses of St_DataSet it is easy to combine them in the various hierarchical structure.

- This way we compensate lacking of pointers within St_Table objects

## StMaker

- I/O StMaker

- .maker

- .data

- .const

- .const

- .data

- 1. Init()

- 2. Make()

- GetDataSet(“name”)

- AddData()

- I/O maker

- File formats: xdf, root, ASCII, MySQL

## Is the table only furniture to be comfortable?

- Match well with all flavor of databases, file systems, share memory
- No “died pointer” nightmare
- Ease to feed the legacy Fortran / C codes
- Well define the raw experimental data
- No problem with the schema evolution. It  is ease to implement and maintain
- Feasible to control “*memory leak*” and “*memory violation”*
- Fit well ROOT TClonesArray / TNTuple / TTree model

- No, since each **User** has his / her own point view what this data means

## One needs “chairs”

-  **TVolume** class to define GEANT-like detector geometry. This class gives an access to the full detector definition from GEANT for visualization and coordinate transformation.
- “Proxy” base class -** TChair.** To get his / her custom access to one and the same table the USER may derive the class from TChair. Every individual or working group can create as many chairs as they find useful with no argue which chair is better.

## StMaker

- I/O StMaker

- .maker

- .data

- .const

- .const

- .data

- 1. Init()

- 2. Make()

- GetDataSet()

- AddData()

- display maker

- Display StMaker

- .const

- .data

- GetDataSet()

## OO model of STAR geometry

**“****Event” geometry supplied by “bfc.C” ****	****Makers of the reconstruction chain**.

## StEventDisplayMaker

-  _[“Detector” geometry](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_PolyLineShape.html#St_PolyLineShape:description)_
- St_Node / St_NodeView
- (St_geant_Maker/StDBMaker)

- _[“Event” geometry](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_PolyLineShape.html#St_PolyLineShape:description)_
- _[StEvent](http://star1.physics.yale.edu/WEBPUB/datamodel.html)_ / St_Table’s
- ( _[“](http://www.star.bnl.gov/STAR/html/comp_l/train/tut/bfc.html)__[bfc](http://www.star.bnl.gov/STAR/html/comp_l/train/tut/bfc.html)__[”](http://www.star.bnl.gov/STAR/html/comp_l/train/tut/bfc.html)_ Makers)

- StVirtualEventFilter

- 3D “Viewers”:
**TBrowser TPad X3D OpenGL, etc**

## “Detector” and “Event” data model

- _[STAR](http://www.star.bnl.gov/)_ 3D geometry Object _[Model](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_PolyLineShape.html#St_PolyLineShape:description)_
-  =============================
-                                      _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)__[DataSet](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_DataSet.html)_         Legend:
-                                           |               "classA”
-                                           |                  |"classB" is derived from
-                                           v                  v the "classA”
-                                        _[St_Node](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_Node.html)_            "classB”
-                                           ^
-                                           |               "classQ”
-                                           |                  ^ "classQ" has a pointer
-                                         _[TShape](http://root.cern.ch/root/html/TShape.html)_               | to "classT”
-                                           |               "classT”
-                                           v
-            -------------------------------------------------------------
-            |                           |      |               |        |
-            |                           |      |    . . .      |        |
-            |                           |      |               |        |
-            v                           v      v               v        v
-      _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_PolyLineShape.html)__[PolyLineShape](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_PolyLineShape.html)_                _[TBRIK](http://root.cern.ch/root/html/TBRIK.html)_  _[TTUBE](http://root.cern.ch/root/html/TTUBE.html)_           _[TPCON](http://root.cern.ch/root/html/TPCON.html)_    _[TTRD1](http://root.cern.ch/root/html/TTRD1.html)_
-        |         ^
-        |         |                             _[R O O T S H A P E S](http://root.cern.ch/root/html/TShape.html)_
-        v         |                       (see _[GEANT 3.21 shapes](http://wwwinfo.cern.ch/asdoc/geant_html3/node109.html)_ as well)
-    _[St_PolyLine3D](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_PolyLine3D.html)_ |
-                  |
-             _[TPoints3DABC](http://root.cern.ch/root/html/TPoints3DABC.html)_
-                  |
-                  v
-          --------------------------------------------------------------
-          |                   |                    |                   |
-          |                   |                    |                   |
-          |                   |                    |                   |
-          V                   v                    v                   v
-    _[StHits3DPoints](http://www.star.bnl.gov/STAR/html/comp_l/root/html/StHits3DPoints.html)_      _[StHelix3DPoints](http://www.star.bnl.gov/STAR/html/comp_l/root/html/StHelix3DPoints.html)__[ ](http://root.cern.ch/root/html/StHelix3DPoints.html)__[ ](http://root.cern.ch/root/html/StHelix3DPoints.html)_    _[St_Table3Points](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_Table3Points.html)_      _[St_Points3D](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_Points3D.html)_
-          ^                   ^                    ^                   ^
-          |                   |                    |                   |
-          |                   |                    |                   |
-     _[StObjArray](http://www.star.bnl.gov/STAR/html/comp_l/root/html/StObjArray.html)_       _[StTrack](http://www.star.bnl.gov/STAR/html/comp_l/root/html/StTrack.html)_ / _[StHelixD](http://www.star.bnl.gov/STAR/html/comp_l/root/html/StHelixD.html)__[  ](file:///StHelixD.html)_  _[St_](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_TableSorter.html)__[TableSorter](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_TableSorter.html)_      flat floating
-                                                 ^               point array
-                                                 |       (see _[St_PolyLine3D](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_PolyLine3D.html)_ as well)
- _                                             __[St_Table](http://www.star.bnl.gov/STAR/html/comp_l/root/html/St_Table.html)_
-                       **S T A R    S H A P E S**

- Detector geometry

**Event geometry**

## .x bfc.C(2)

- These pictures present “**g2t_svt_hit**” (round filled mark)  vs packed “**dst_point**” (cross mark).
- It is clear the hits on the outermost **svt** layer  from **g2t** are not included into the “packed” **dst_point ** table.

**.x bfc.C(2)**
**.x TurnDisplay.C(“no”)**
**.x PadControlPanel.C**
**dsMaker->SetTableFlag()**
**dsMaker->ReDraw()**

## table name:

- “point”

## Slide 19

## Slide 20

## kaonDecay_withCut_full

**.x bfc.C(1,"off tpc tfs y1b eval fzin global -v0 -xi",**
**        ****"/disk0/star/test/venus412/b0_3/year_1b/set0352_01_35evts.fzd")**
**.x TurnDisplay.C("StTrackFilter2")**
**.x SetObjectFilter.C**
**.x PadControlPanel.C**

## OpenGL viewer

## Slide 23

## Current status

- The present framework has being testing for the last year. It was  used to produce 100 GBytes of DST from 3 TBytes of the GEANT-simulated data. It is proved it allows the construction of hierarchical organizations of components and data, and centralizes almost all system tasks such as data set navigation, I/O, database access, and inter-component communication.