Dual analysis framework for ezTree & muDst data format
updated 2004-06-7

This example illustrates how to construct analysis code so it can run on both the ezTree & muDst data without any changes. The EEMC DB access is avaliable in both cases.

General remarks about utility/features of proposed scheme are posted in the STAR software-hn #5472.

The scheme was tested (and will be supported) only in stardev. All code is depositted in CVS.

The key requirement is to separate unpacking of hits stored in muDst/ezTree from the analysis code. In a typical application one keeps already a local copy of hits, since multiple browsing of muDst/ezTree for the same events is very ineffcient. Here you are asked to split the code between two classes (#5+6 vs. #7+8). That is it.

Table sumarizes differences in usage of both aproaches:
# StRoot scheme ezTree scheme
1 real data INPUT=muDst INPUT=ezTree
2 main script rdMu2histoExample.C
uses StMuDstMaker() to read muDst
runs under root4star
rdEz2histoExample.C
uses TChain::Add() to read ezTree==TTree
runs under plain root
3 output regular hist.root file
4 M-C events INPUT= .fzd
use fzd2muDst.C to convert .fzd -->muDst without tracking data.
no interface, use muDst
5 interface class StEEtowerExampleMaker EzEEtowerExample
6 unpacking hits ::unpackMuDst()
full event
::unpackEzTree()
only ETOW,ESMD, BTOW, some TRIG
7 analysis class Physics analysis example: EEtower. Hits/data taken from local arrays, e.g.: towerE[ieta][iphi]
8 data processing simple examples ::task1(), ::print()
9 source code
mkdir aaa
cd aaa
cvs co StRoot/StEEmcPool/StEzExample 
cp StRoot/StEEmcPool/StEzExample/macros/* .
cvs co offline/EEpromis/ezGames
mv offline/EEpromis/ezGames .
cd ezGames
cvs co StRoot/StDbLib
cvs co StRoot/StEEmcDbMaker
cvs co StRoot/StEEmcUtil
cvs co StRoot/StEEmcPool/StEzExample 
cp StRoot/StEEmcPool/StEzExample/macros/* . 
10 compilation, execution Type:
cd aaa
cons
root4star -b rdMu2histoExample.C
Note, if you compiled earlier with 'make', you must erase all Dict_*.* files in all subdirectories. In principle 'make clean' typed before 'cons' should work .
All libraries needed by rdEzXXX.C need to be compiled with make. Type only once:
cd ezGams
make
root -b rdEz2histoExample.C
fzd2muDst.C is located at $STAR/StEEmcPool/StBlankStEventMaker/macros/fzd2muDst.C


ezTree content:
 EEMC: 
        u_short etow[ETOW_MAXFEE][ETOW_DATSIZE] ;       // ADC data...
        u_short etow_pre[ETOW_MAXFEE][ETOW_PRESIZE]; // ETOW preamble

        u_short esmd[ESMD_MAXFEE][ESMD_DATSIZE] ;       // ADC data
        u_short esmd_pre[ESMD_MAXFEE][ESMD_PRESIZE]; // ESMD preamble
 BEMC: 
        u_short btow_new[BTOW_MAXFEE][BTOW_DATSIZE] ;
        u_short btow_pre[BTOW_MAXFEE][BTOW_PRESIZE] ;
(see online/RTS/src/EVP_READER/emcReader.h)

TRIG: 
  u_int bX48hi, bX48lo, bX7bit; // bXing counter
  u_int daqbits ;       // fired triggers
  u_short offline_id[32] ;      // trigged ID for fired triggers  
  u_char  EEMC[144] ;  // E-EMC DSM  inputs level-0, 1
  u_short EEMC_l1[16] ;  
  u_char  BEMC[2][240] ;   // B-EMC DSM  inputs 
  u_short BEMC_l1[48] ;  
  u_char  CTB[240] ;  // CTB hits
  u_short  lastDSM[8];  //level-3 inputs , results of all DSM trees 
  u_short  npre,npost; // used in a trivial way for now
  u_short  VTX[8];  // level-2 inputs for BBC and ZDC
  u_short  EMC[8];  // level-2 inputs, results of separate BEMC and EEMC DSMs 
  (see     $STAR/StRoot/StEEmcUtil/EEfeeRaw/EEstarTrig.h )

 EVE HEADER: 
  unsigned mEventNumber;       //
  unsigned mToken;             //
  time_t   mTimeStamp;         //(unix time, GMT) 
  unsigned mRunNumber;         //
  (see $STAR/StRoot/StEEmcUtil/EEfeeRaw/EEmcEventHeader.h )