Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OnlBbcEvent.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file OnlBbcEvent.h
1 #ifndef __ONLBBCEVENT_H__
2 #define __ONLBBCEVENT_H__
3 
4 #include "OnlBbcSig.h"
5 
6 class PHCompositeNode;
7 class Event;
8 class Packet;
9 class TF1;
10 class TCanvas;
11 
13 {
14 public:
15  OnlBbcEvent ();
16  ~OnlBbcEvent ();
17 
18  bool setRawData(Event *);
19  int calculate();
20  int InitRun();
21  void Clear();
22 
23  int calib_is_done() { return calib_done; }
24 
25  float get_bbcz() { return f_bbcz; }
26  float get_t0() { return f_bbct0; }
27 
28  int getEventNumber (void) const
29  {
30  return (EventNumber);
31  }
32 
33  int getAdc (int PmtIndx) const
34  {
35  //return (Adc[PmtIndx]);
36  return (f_pmtq[PmtIndx]);
37  }
38 
39  int getTdc0 (int PmtIndx) const
40  {
41  return (f_pmtt0[PmtIndx]);
42  }
43 
44  int getTdc1 (int PmtIndx) const
45  {
46  return (f_pmtt1[PmtIndx]);
47  }
48 
49  float getQ (int PmtIndx) const
50  {
51  //return (Adc[PmtIndx]);
52  return (f_pmtq[PmtIndx]);
53  }
54 
55  // Time from Timing Channel
56  float getTT (int PmtIndx) const
57  {
58  return (f_pmtt0[PmtIndx]);
59  }
60 
61  // Time from Charge Channel
62  float getTQ (int PmtIndx) const
63  {
64  return (f_pmtt1[PmtIndx]);
65  }
66 
67  /*
68  int getCutVal ()
69  {
70  return (calib.getCutVal ());
71  }
72 
73  BbcTime_t getEventTime (void) const
74  {
75  return (0);
76  }
77 
78  float getTrueAdc (int PmtIndx) const
79  {
80  return (TrueAdc[PmtIndx]);
81  }
82 
83  float getCharge (int PmtIndx) const
84  {
85  return (Charge[PmtIndx]);
86  }
87  float getHitTime0 (int PmtIndx) const
88  {
89  return (HitTime0[PmtIndx]);
90  }
91  float getHitTime1 (int PmtIndx) const
92  {
93  return (HitTime1[PmtIndx]);
94  }
95  int isHit (int PmtIndx) const
96  {
97  return (iHit[PmtIndx]);
98  }
99 
100  int isArmHitPmt (int PmtIndx) const
101  {
102  return (armHitPmt[PmtIndx]);
103  }
104 
105  int getnHitPmt (Bbc::ArmType arm) const
106  {
107  return (nHitPmt[arm]);
108  }
109  */
110 
111  float getChargeSum (int arm) const
112  {
113  return (ChargeSum[arm]);
114  }
115  /*
116  float getArmHitTime (Bbc::ArmType arm) const
117  {
118  return (ArmHitTime[arm]);
119  }
120  float getArmHitTimeError (Bbc::ArmType arm) const
121  {
122  return (ArmHitTimeError[arm]);
123  }
124  */
125 
126  float getZVertex (void) const
127  {
128  return (ZVertex);
129  }
130  float getZVertexError (void) const
131  {
132  return (ZVertexError);
133  }
134  float getTimeZero (void) const
135  {
136  return (TimeZero);
137  }
138 
139  /*
140  float getTimeZeroError (void) const
141  {
142  return (TimeZeroError);
143  }
144 
145  void setEventNumber (int givenEventNumber)
146  {
147  EventNumber = givenEventNumber;
148  }
149  void setAdc (int givenAdc, int PmtIndx)
150  {
151  Adc[PmtIndx] = givenAdc;
152  }
153  void setTdc0 (int givenTdc0, int PmtIndx)
154  {
155  Tdc0[PmtIndx] = givenTdc0;
156  }
157  void setTdc1 (int givenTdc1, int PmtIndx)
158  {
159  Tdc1[PmtIndx] = givenTdc1;
160  }
161 
162  int printAdcTdc (void) const;
163  int printPmtChTime (void) const;
164 
165  float TimeLagOfTransitTime (int PmtIndx, float ZVertex2) const;
166  */
167 
168  OnlBbcSig* GetSig(const int ipmt) { return &bbcsig[ipmt]; }
169 
170 
171 private:
172  int Read_Charge_Calib( const char *calfname );
173  int Read_TQ_T0_Offsets( const char *calfname );
174  float gaincorr[128] {}; // gain corrections
175  float tq_t0_offsets[128] {}; // t0 offsets in charge channels
176  float bz_offset{0.};
177 
178  static const int NCH = 256;
179  static const int NSAMPLES = 31;
180  static const int NCHPERPKT = 128;
181 
182  int verbose;
185  Packet *p[2] {nullptr,nullptr} ;
186 
187  //raw data
188  Float_t f_adc[NCH][NSAMPLES]; // raw waveform
189  Float_t f_samp[NCH][NSAMPLES]; // raw waveform
190  Float_t f_ampl[NCH]; // amplitude
191  //Float_t f_t0[NCH]; // time
192 
193  std::vector<OnlBbcSig> bbcsig;
194 
195  static const int BBC_N_PMT = 128;
196 
197  // converted (corrected) data
200 
201  // Adc value w/ pedestal subtracted
202  //float TrueAdc[BBC_N_PMT];
203 
207 
208  // End product data
209  int nHitPmt[2];
210  float ChargeSum[2];
211  float ArmHitTime[2];
212  float ArmHitTimeError[2];
213  float ZVertex;
215  float TimeZero;
217 
218  Float_t f_pmtq[BBC_N_PMT]{}; // npe in each arm
219  Float_t f_pmtt0[BBC_N_PMT]{}; // time in each arm
220  Float_t f_pmtt1[BBC_N_PMT]{}; // time in each arm
221  Short_t f_bbcn[2]{}; // num hits for each arm (north and south)
222  Float_t f_bbcq[2]{}; // total charge (currently npe) in each arm
223  Float_t f_bbct[2]{}; // time in arm
224  Float_t f_bbcte[2]{}; // earliest hit time in arm
225  Float_t f_bbcz = NAN; // z-vertex
226  Float_t f_bbct0 = NAN; // start time
227  TH1 *hevt_bbct[2]{}; // time in each bbc, per event
228  TF1 *gaussian = nullptr;
229  Float_t _tres = NAN; // time resolution of one channel
230 
231  TH2 *h2_tmax[2] = {}; // [0 == time ch, 1 == chg ch], max sample in evt vs ch
232 
233  float TRIG_SAMP[16]; // [board]
235 
236  TCanvas *ac;
237  /*
238  int calcEndProduct (void);
239  int calcArmProduct (Bbc::ArmType arm);
240  int calcPmtProduct (int PmtIndx);
241 
242  // must exec after calcArmProduct
243  int calcFlag ();
244  */
245 
246 };
247 
248 #endif /* __ONLBBCEVENT_H__ */