StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTofrDaqMap.h
1 /*******************************************************************
2  *
3  * $Id: StTofrDaqMap.h,v 1.7 2008/03/27 00:15:39 dongx Exp $
4  *
5  * Author: Xin Dong
6  *****************************************************************
7  *
8  * Description: (1) Mapping between Daq channel numbers, ADC(TDC) channel
9  * numbers and TOFr cell numbers
10  * (2) Parameters initalize from dbase
11  *
12  *****************************************************************
13  *
14  * $Log: StTofrDaqMap.h,v $
15  * Revision 1.7 2008/03/27 00:15:39 dongx
16  * Update for Run8 finished.
17  *
18  * Revision 1.6 2007/11/22 00:04:13 dongx
19  * - update for tof8++
20  * - added ValidTrays() function
21  *
22  * Revision 1.3 2005/04/12 17:23:15 dongx
23  * Update for year 5 new data format, writter by Jing Liu
24  *
25  * Revision 1.2 2004/03/09 17:43:04 dongx
26  * first release
27  *
28  *
29  *******************************************************************/
30 #ifndef STTOFRDAQMAP_H
31 #define STTOFRDAQMAP_H
32 
33 #include "StObject.h"
34 #include "StMaker.h"
35 #include <assert.h>
36 #include "Stypes.h"
37 #include "TDataSet.h"
38 #include "TDataSetIter.h"
39 #include "TObjectSet.h"
40 #include <string>
41 
42 #include <vector>
43 #ifndef ST_NO_NAMESPACES
44 using std::vector;
45 #endif
46 
47 #if !defined(ST_NO_TEMPLATE_DEF_ARGS) || defined(__CINT__)
48 //#ifndef ST_NO_TEMPLATE_DEF_ARGS
49 typedef vector<Int_t> IntVec;
50 #else
51 typedef vector<Int_t, allocator<Int_t>> IntVec;
52 #endif
53 
55  private:
56  static const Int_t mDAQOVERFLOW = 255; // daq max channel #
57  static const Int_t mNTOFR = 120; // 72
58  static const Int_t mNTOFR5 = 192; // 192 for tofr5
59 
60  static const Int_t mNTOF = 192; // 192 for tof in Run 8++
61  static const Int_t mNTray = 120; // # of trays
62  static const Int_t mNModule = 32; // 32 for tofr5++
63  static const Int_t mNCell = 6;
64  static const Int_t mNVPD = 19; // 19 on each side
65 
66  Int_t mNValidTrays;
67 
68  Int_t mTrayId[mNTOFR], mModuleId[mNTOFR], mCellId[mNTOFR];
69  Int_t mAdc[mNTOFR], mTdc[mNTOFR];
70 
71  // new arrays for tofr5
72  Int_t mGlobalTDCChan[mNTOFR5], mGlobalModuleChan[mNTOFR5];
73 
74  // General arrays for tof8++
75  Int_t mMRPC2TDIGChan[mNTOF]; // tdc channel # of MRPC channel
76  Int_t mTDIG2MRPCChan[mNTOF]; // MRPC channel # of tdc channel
77  Int_t mEastPMT2TDIGLeChan[mNVPD], mEastPMT2TDIGTeChan[mNVPD]; // tdc channel of vpd PMTs
78  Int_t mTDIGLe2EastPMTChan[mNTOF], mTDIGTe2EastPMTChan[mNTOF]; // vpd PMT tube of tdc channels
79  Int_t mWestPMT2TDIGLeChan[mNVPD], mWestPMT2TDIGTeChan[mNVPD]; // tdc channel of vpd PMTs
80  Int_t mTDIGLe2WestPMTChan[mNTOF], mTDIGTe2WestPMTChan[mNTOF]; // vpd PMT tube of tdc channels
81 
82  // Valid tray Ids
83  Int_t mValidTrayId[mNTray];
84 
85  public:
86  StTofrDaqMap();
87  ~StTofrDaqMap();
88 
89  void init();
90  void init(StMaker *maker);
91  void initFromDbase(StMaker *maker);
92  void initFromDbaseY5(StMaker *maker); // tofr5
93  void initFromDbaseGeneral(StMaker *maker); // tof8++, general
94  void Reset();
95 
96  void setNValidTrays(int ntrays);
97 
98  IntVec DaqChan2Cell( const Int_t iTofrDaq );
99  Int_t Cell2DaqChan( const Int_t iTray, const Int_t iModule, const Int_t iCell );
100  IntVec ADCChan2Cell( const Int_t iAdc );
101  IntVec TDCChan2Cell( const Int_t iTdc );
102  Int_t Cell2ADCChan( const Int_t iTray, const Int_t iModule, const Int_t iCell );
103  Int_t Cell2TDCChan( const Int_t iTray, const Int_t iModule, const Int_t iCell );
104  Int_t DaqChan2ADCChan( const Int_t iTofrDaq );
105  Int_t DaqChan2TDCChan( const Int_t iTofrDaq );
106  Int_t ADCChan2DaqChan( const Int_t iAdc );
107  Int_t TDCChan2DaqChan( const Int_t iTdc );
108 
109  // tofr5 interface, Jing Liu
110  IntVec Tofr5TDCChan2Cell( const Int_t iTdc );
111  Int_t Tofr5Cell2TDCChan( const Int_t iTray, const Int_t iModule, const Int_t iCell );
112 
113  // general interface, tray number obseleted
114  IntVec TDIGChan2Cell( const Int_t iTdc );
115  Int_t Cell2TDIGChan( const Int_t iModule, const Int_t iCell );
116  Int_t EastPMT2TDIGLeChan( const Int_t iTube );
117  Int_t TDIGLeChan2EastPMT( const Int_t iTdc );
118  Int_t EastPMT2TDIGTeChan( const Int_t iTube );
119  Int_t TDIGTeChan2EastPMT( const Int_t iTdc );
120  Int_t WestPMT2TDIGLeChan( const Int_t iTube );
121  Int_t TDIGLeChan2WestPMT( const Int_t iTdc );
122  Int_t WestPMT2TDIGTeChan( const Int_t iTube );
123  Int_t TDIGTeChan2WestPMT( const Int_t iTdc );
124 
125  IntVec ValidTrays();
126 };
127 
128 inline void StTofrDaqMap::setNValidTrays(int ntrays) { mNValidTrays = ntrays; }
129 
130 #endif