# Presentation: 609448

## STAR Software Basics

-  Compiling using 'cons'
-  STAR_LEVELS, starver and changing environment
-  Coding Standards for C++
-  File types in use
_*http://www.star.bnl.gov/STAR/comp/*_

## STAR Software Library

***ls $STAR***
- BIN  OBJ   StRoot  asps  include  lib  obj
- LIB  StDb  StarDb  bin   kumacs   mgr  pams
**Makers**
- Compiled code to put in a “chain”,
-     2 main chains are bfc.C and doEvents.C
**bfc.C** is the chain for running reconstruction. Works on **raw** data.
**doEvents.C** is for analyzing the **reconstructed** dsts
**Macros**
- Interpreted code - many examples

***$STAR/StRoot***

## CVS - Concurrent Versions System 

- Used to record the history of your source files.
- CVS is essential for a project is being worked on by multiple people.
_**Quick Reference**_
***cvs co name***   =  check out a copy of ‘name' into your working directory
***cvs update***  =  update all the files in the current directory
***cvs -n update*** = tells what it would update, but the -n means it doesn't do it

## Cons 

- Replacement for “Make”
- Cons is a system for constructing software
- Cons ensures that complex software is easily and accurately reproducible

**To get help:    *****cons -x***

**Full build:****   ****In top level directory type **
***cons***
** **
**Partial build:**** **
***cons +name***** **
**Remove products:**
***cons -r +name***

## Cons – example: 

- Obtain token
*** ******klog***  (then type afs password at prompt)
- In a fresh  directory “check out”
***cvs co StRoot/StFtpcTrackMaker***
- Compile and build using “cons”
***cons +StFtpcTrackMaker***

## STAR_LEVEL

_*http://www.star.bnl.gov/STAR/comp/ofl/software_releases.html*_
- -------------------------------------------------
**The present release assignment:**
-              **SL00m**  (SL00m)   ROOT_LEVEL 2.25.03
-              **SL01i**    (SL01i)   ROOT_LEVEL 3.02.00 AuAu 130GeV production
-              **SL01j**    (SL01j)   ROOT_LEVEL 3.02.00 updated SL01i with SIMU tag
-              **SL02c**   (SL02c)   ROOT_LEVEL 3.02.07 AuAu200 GeV production
-              **SL02d**   (SL02d)   ROOT_LEVEL 3.02.07 AuAu200 GeV production
-              **SL02e**   (SL02e)   ROOT_LEVEL 3.02.07 AuAu and pp 200GeV production
-              **SL02g**   (SL02g)   ROOT_LEVEL 3.02.07 FTPC side AuAu200 production
-              **SL02h**   (SL02h)   ROOT_LEVEL 3.02.07 only tag exists
-              **SL02i**    (SL02i)   ROOT_LEVEL 3.02.07 daq100 test,dAu200 MC
-              **SL03a**   (SL03a)   ROOT_LEVEL 3.03.09 real dAu 200GeV production
-              **SL03b**   (SL03b)   ROOT_LEVEL 3.03.09 dau200 MC hijing
-        **old**-> SL03d   (SL03d)   ROOT_LEVEL 3.03.09
-        **pro**-> SL03e   (SL03e)   ROOT_LEVEL 3.05.04 ppMinBias, ppTrans-1,ppLong-1
-        **new**-> SL03f   (SL03f)   ROOT_LEVEL 3.05.04 ppMinBias 2001/2002 SVT rerun
-        **dev**-> DEV               ROOT_LEVEL 3.10.01
-       **.dev**-> .DEV              ROOT_LEVEL 3.99.99
- -------------------------------------------------

## Changing   STAR_LEVEL

- 3 main library versions:
**dev** (updated daily) for development
**new** (~few weeks) relatively stable, perform studies here
**pro** (when necessary) for official production
- switch levels by typing e.g. ‘***starnew***’
- can check current level with ‘STAR_LEVELS’
- switch levels by  ‘***starver  tag***’ e.g.
*** ******starver 02d***  - to work in  SL02gd

**Important**:* *
*If the software you’re using was written in a more recent library version than the one you’re in – switch immediately – it’s a miracle your code worked at all! *

## Coding standards

_*http://www.star.bnl.gov/STAR/comp/train/standards.html*_
**File Extensions**
**ROOT related code****	****	****	**.h  	.cxx
**Plain C++ header files****	****	**.hh	.cc
**C++ coding style guidelines**
**The *****public*****, *****protected***** and *****private***** keywords must be used explicitly**
**Self-explanatory English names **
*theTotalEnergy*, *setEnergyTable(), getTrackPosition() *
**Member functions should start with a small letter**
*StTrack::whatever()*
**Begin each class data member with a lowercase *****m***.
* **StDouble mDipAngle;*

## Coding standards

- Each **header file** should contain only one class declarations
- Each **class** implementation code should go into a single source file
- Each **header file** must be protected from multiple inclusions
- #ifndef NAME_HH
- #define NAME_HH
- ...
- #endif
- Every class should have at least one **constructor** and a **destructor**
- Use of **private/protected**,  inline functions
- Avoid **global** variables or functions
- No **hard-coded numbers**. Use of constants (const)
- Use  StType types

## Data Organization Model

*** ******DAQ ***(Data Acquisition)*** ******file created during event-taking ***
*** ******DAQ*** file gets through ***BFC*** (Big Full Chain) 
**3. ******** *****Event.root**** *files created: no hits, instead: tracks fit using different methods and stored using ***StEvent*** model.
**4. ******** StMuDST**: a *Root* Tree with selected information; tracks are organized and sorted *(StMuDST’s are smaller than the event.root files) *

## StAssociationMaker

_*http://www.star.bnl.gov/STAR/comp/simu/stasso.html*_
-  Used on MC or Embedded data
-  Studies of
- Energy loss
- Acceptance
- Efficiency
- Hadronic interaction effects
- Momentum resolution
- Background contribution
- ......

**StAssociationMaker**

## Multimap Usage

_**Methods:**_** ****Find, Count, Equal_range**

## Maps

- TPC Hits    		SVT Hits  		FTPC Hits
- Tracks (using all the previous hit multimaps)
- Kink Vertices  		V0 Vertices 		Xi Vertices

- The defaults are:
- _TPC Cuts_ 	X Cut : 5 mm Y Cut : 5 mm Z Cut : 2 mm
- 		Required TPC Hits for Associating Tracks : 3
- _SVT Cuts_ 	X Cut : 1 mm Y Cut : 1 mm Z Cut : 1 mm
- 		Required SVT Hits for Associating Tracks : 1
- _FTPC Cuts_ 	R Cut : 3 mm Phi Cut : 5 degrees
- 		Required FTPC Hits for Associating Tracks : 3

## How to make a use of it:

_*$STAR/StRoot/macros/examples/*__***StAssociator.C***__* *_
**	****Run a chain **
**StEventMaker**
**StMcEventMaker**
**StAssociationMaker**
**StMcAnalysisMaker**
** ****Use standard McDst**
**MiniMcDst     (***.minimc.root**)****	**** Spectra PWG**
**strangeMuDst (***.MuDst.root**) ****	****Strangeness PWG**