mEmcTOFCorr2Module.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //
00003 //  (c) PHENIX Collaboration 2000
00004 //
00005 // Purpose: wraps the TOF Run-by-Run & Tower-by-Tower correction of DST
00006 // 
00007 // Description: algorithm class
00008 //              
00009 // Author:  Ken Oyama
00010 //          Modified by Hisayuki Torii Dec 2000
00011 //          Modified for V05 production by H.Torii Aug/15/2001
00012 //
00013 /* ======================================
00014    Memo by H.Torii
00015    
00016    TOF correction done by the following function.
00017    
00018    TOFCORR =
00019    _tbt_lc[arm][sec][y][z] * tof  - _tbt_corr[arm][sec][y][z] - _pb**_corr[run]
00020    
00021    --------HOW to use---------
00022    mEmcTOFCorr2Module* mEmcTOFCorr = 
00023     mEmcTOFCorr2Module::instance("./t0_run_pbsc_merge","./t0_run_pbgl_merge","./t0_tower_merge");
00024    while( event ){
00025     mEmcTOFCorr->event(topNode);
00026     //Analysis ...
00027    }
00028    =========================================*/
00029 //-----------------------------------------------------------------------------
00030 #ifndef __MEMCTOFCORR2MODULE_H__
00031 #define __MEMCTOFCORR2MODULE_H__
00032 
00033 #include "phool.h"
00034 
00035 #include "TString.h"
00036 
00037 #include <iostream>
00038 
00039 class PHCompositeNode;
00040 
00041 #define MEMCTOFCORR_DEF_RBR_CORR 0.00
00042 #define MEMCTOFCORR_DEF_TBT_CORR 0.00
00043 #define MEMCTOFCORR_N_MAX_RUNS   10000
00044 
00048 class mEmcTOFCorr2Module
00049 {
00050  public:
00051 
00053   mEmcTOFCorr2Module();
00055   virtual ~mEmcTOFCorr2Module(){}
00056 
00058   static mEmcTOFCorr2Module* instance( char *pbsc_file, char *pbgl_file, char *tbt_file );
00059   static mEmcTOFCorr2Module* instance();
00060   void   read_rbrsc_file( char *file);
00061   void   read_rbrgl_file( char *file);
00062   void   read_tbt_file( char *file );
00063   void   read_tbt_lc_file( char *file ) { std::cout << "read_tbt_lc_file not implemented" << std::endl; }
00064   void   read_t0_file( char *pbsc_file, char *pbgl_file, char *tbt_file );
00065   void   read_tdcped_file(char *file ){ tdcped_file = file; };
00066 
00068   PHBoolean  event(PHCompositeNode * root) ;
00069   PHBoolean  eventFirst(PHCompositeNode * root) ;
00070 
00071  private:
00072   static mEmcTOFCorr2Module* _instance;
00073   float get_correction( int run, int arm, int sec, int ind_y, int ind_z );
00074   TString tdcped_file;
00075   PHBoolean apply_tdcped(int runNum,PHCompositeNode* topNode);
00076 
00077   int    fVerbose ;
00078 
00079   int    _pbsc_runs[MEMCTOFCORR_N_MAX_RUNS];   // Existing run number list of tof run-by-run correction.
00080   float  _pbsc_corr[MEMCTOFCORR_N_MAX_RUNS];   // Corresponding run-by-run correction.
00081   int    _pbsc_nruns;                          // Number of column in the rbr table.
00082   int    _pbgl_runs[MEMCTOFCORR_N_MAX_RUNS];   // Some things for PbGl
00083   float  _pbgl_corr[MEMCTOFCORR_N_MAX_RUNS];
00084   int    _pbgl_nruns;
00085   float  _tbt_corr[2][4][48][96];              // Tower-by-tower correction. Indexes are [ARM][SEC][Y][Z]
00086   float  _tbt_lc[2][4][48][96];                // Tower-by-tower least count correction.
00087 };
00088 
00089 #endif /*__MEMCTOFCORRMODULE_H__*/
00090 
00091 // EOF