StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBbcTriggerDetector.h
1 
5 /***************************************************************************
6  *
7  * $Id: StBbcTriggerDetector.h,v 2.10 2008/08/15 18:36:18 ullrich Exp $
8  *
9  * Author: Akio Ogawa, Jan 2002
10  ***************************************************************************
11  *
12  * Description:
13  *
14  ***************************************************************************
15  *
16  * $Log: StBbcTriggerDetector.h,v $
17  * Revision 2.10 2008/08/15 18:36:18 ullrich
18  * Minor change, move zVertex().
19  *
20  * Revision 2.9 2007/07/11 23:06:45 perev
21  * Cleanup+fix StXXXTriggerDetector
22  *
23  * Revision 2.8 2007/04/24 14:52:23 ullrich
24  * Fixed bug in BBC unpacking (Akio).
25  *
26  * Revision 2.7 2004/08/03 17:22:16 ullrich
27  * Major update by Akio and Marco.
28  *
29  * Revision 2.6 2004/02/11 01:42:09 ullrich
30  * Added new constructor to load data from StTriggerData.
31  *
32  * Revision 2.5 2003/01/23 23:23:29 ullrich
33  * Modified to cope with changes in how BBC data is loaded for Run3.
34  *
35  * Revision 2.4 2002/10/17 02:07:49 akio
36  * Increase # of PMT from 32 to 48 for 2003 run.
37  * Schema evolution should take care for reading old files.
38  * Some of access functions (for east west separately, or sums)
39  * will give wrong answer if you are using new 2003 mapping.
40  * One should access data through raw adc values until improvements.
41  * These functions do correct job for 2002 data.
42  *
43  * Revision 2.3 2002/02/22 22:56:46 jeromel
44  * Doxygen basic documentation in all header files. None of this is required
45  * for QM production.
46  *
47  * Revision 2.2 2002/01/28 19:28:10 jeromel
48  * Wrong format of an enum list corrected. Solaris picked this up.
49  *
50  * Revision 2.1 2002/01/03 20:57:37 ullrich
51  * Initial Revision.
52  *
53  **************************************************************************/
54 #ifndef StBbcTriggerDetector_hh
55 #define StBbcTriggerDetector_hh
56 #include "StObject.h"
57 
58 class dst_TrgDet_st;
59 class StTriggerData;
60 
62 public:
64  StBbcTriggerDetector(const dst_TrgDet_st&);
66  virtual ~StBbcTriggerDetector();
67  // StBbcTriggerDetector(const StBbcTriggerDetector&); use default
68  // StBbcTriggerDetector& operator=(const StBbcTriggerDetector&); use default
69 
70  unsigned int numberOfPMTs() const;
71  unsigned int numberOfRegisters() const;
72  unsigned int numberOfPedestalData() const;
73  unsigned int numberOfScalars() const;
74 
75  unsigned short adc(unsigned int) const;
76  unsigned short tdc(unsigned int) const;
77  unsigned short bbcRegister(unsigned int) const;
78  unsigned short pedestalData(unsigned int) const;
79  unsigned int scalar(unsigned int) const;
80 
81  unsigned short pedestal(unsigned int id) const;
82  unsigned short pedestalWidth(unsigned int id) const;
83  unsigned short mip(unsigned int id) const;
84  unsigned short mipWidth(unsigned int id) const;
85 
86 
87  int adcSumEast();
88  int adcSumWest();
89  int adcSumEastLarge();
90  int adcSumWestLarge();
91  int adcSum();
92  int adcSumLarge();
93  int adcSumAll();
94  unsigned short onlineTimeDifference() const; // z vertex from Layer2 DSM in channel
95 
97  // No longer supported after 2003. Do not use
98  int nHitEast();
99  int nHitWest();
100  int nHitEastLarge();
101  int nHitWestLarge();
102  int nHit();
103  int nHitLarge();
104  int nHitAll();
105  int tdcEarliestEast(); // 2002 = common start = smaller channel is earlier
106  int tdcEarliestWest(); // 2003 = common stop = larger channel os earlier
107  // No longer supported after 2003. Do not use
109 
110  float zVertex(); //z vertex in cm
111 
112  void setAdc(unsigned int, unsigned short);
113  void setTdc(unsigned int, unsigned short);
114  void setRegister(unsigned int, unsigned short);
115  void setPedestal(unsigned int, unsigned short);
116  void setScalar(unsigned int, unsigned int);
117  void setOnlineTimeDifference(unsigned short);
118  void dump();
119 
120  unsigned int year() const;
121  void setYear(unsigned int);
122 
123 protected:
124  enum {
125  mMaxPMTs = 48,
126  mMaxRegisters = 2,
127  mMaxPedData = 128,
128  mMaxScalars = 32
129  };
130  char mBeg[1];
131  UShort_t mAdc[mMaxPMTs];
132  UShort_t mTdc[mMaxPMTs];
133  UShort_t mReg[mMaxRegisters];
134  UShort_t mPed[mMaxPedData];
135  UShort_t mScl[mMaxScalars];
136  UInt_t mYear;
137  UInt_t mDSMVTX;
138  char mEnd[1];
139  ClassDef(StBbcTriggerDetector,5)
140 };
141 
142 inline unsigned int
143 StBbcTriggerDetector::numberOfPMTs() const {return mMaxPMTs;}
144 
145 inline unsigned int
146 StBbcTriggerDetector::numberOfRegisters() const {return mMaxRegisters;}
147 
148 inline unsigned int
149 StBbcTriggerDetector::numberOfPedestalData() const {return mMaxPedData;}
150 
151 inline unsigned int
152 StBbcTriggerDetector::numberOfScalars() const {return mMaxScalars;}
153 
154 inline unsigned short
155 StBbcTriggerDetector::pedestal(unsigned int id) const {return pedestalData(id);}
156 
157 inline unsigned short
158 StBbcTriggerDetector::pedestalWidth(unsigned int id) const {return pedestalData(id+32);}
159 
160 inline unsigned short
161 StBbcTriggerDetector::mip(unsigned int id) const {return pedestalData(id+64);}
162 
163 inline unsigned short
164 StBbcTriggerDetector::mipWidth(unsigned int id) const {return pedestalData(id+96);}
165 
166 inline unsigned int
167 StBbcTriggerDetector::year() const {return mYear;}
168 
169 inline void
170 StBbcTriggerDetector::setYear(unsigned int v) {mYear = v;}
171 
172 inline unsigned short
173 StBbcTriggerDetector::onlineTimeDifference() const {return mDSMVTX;}
174 
175 inline void
176 StBbcTriggerDetector::setOnlineTimeDifference(unsigned short v) {mDSMVTX = v;}
177 
178 #endif