Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JEventProcessor_TOF_calib.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: JEventProcessor_TOF_calib.cc
4 // Created: Fri Mar 13 10:37:27 EDT 2015
5 // Creator: zihlmann (on Linux gluon47.jlab.org 2.6.32-358.23.2.el6.x86_64 x86_64)
6 //
7 
8 
10 using namespace jana;
11 
12 // Routine used to create our JEventProcessor
13 #include <JANA/JApplication.h>
14 #include <JANA/JFactory.h>
15 extern "C"{
16  void InitPlugin(JApplication *app){
17  InitJANAPlugin(app);
18  app->AddProcessor(new JEventProcessor_TOF_calib());
19  }
20 } // "C"
21 
22 //------------------
23 // JEventProcessor_TOF_calib (Constructor)
24 //------------------
26 {
27 
28 }
29 
30 //------------------
31 // ~JEventProcessor_TOF_calib (Destructor)
32 //------------------
34 {
35 
36 }
37 
38 //------------------
39 // init
40 //------------------
42 {
43  // This is called once at program startup. If you are creating
44  // and filling historgrams in this plugin, you should lock the
45  // ROOT mutex like this:
46  //
47  // japp->RootWriteLock();
48  // ... fill historgrams or trees ...
49  // japp->RootUnLock();
50  //
51 
52  cout<<"INITIALIZE VARIABLES "<<flush<<endl;
53 
54  pthread_mutex_init(&mutex, NULL);
55 
56  //BINTDC_2_TIME = 0.025;
57  BINTDC_2_TIME = 0.0234375;
58  BINADC_2_TIME = 0.0625; // is 4ns/64
59 
60  TDCTLOC = 385.;
61  ADCTLOC = 115.;
62 
63  ADCTimeCut = 50.;
64  TDCTimeCut = 60.;
65 
66  first = 1;
67  MakeHistograms();
68 
69  return NOERROR;
70 }
71 
72 //------------------
73 // brun
74 //------------------
75 jerror_t JEventProcessor_TOF_calib::brun(JEventLoop *eventLoop, int32_t runnumber)
76 {
77  // This is called whenever the run number changes
78 
79  RunNumber = runnumber;
80 
81  // this should have already been done in init()
82  // so just in case.....
83 
84  map<string,double> tdcshift;
85  if (!eventLoop->GetCalib("/TOF/tdc_shift", tdcshift)){
86  TOF_TDC_SHIFT = tdcshift["TOF_TDC_SHIFT"];
87  }
88 
89  return NOERROR;
90 }
91 
92 //------------------
93 // evnt
94 //------------------
95 jerror_t JEventProcessor_TOF_calib::evnt(JEventLoop *loop, uint64_t eventnumber)
96 {
97  // This is called for every event. Use of common resources like writing
98  // to a file or filling a histogram should be mutex protected. Using
99  // loop->Get(...) to get reconstructed objects (and thereby activating the
100  // reconstruction algorithm) should be done outside of any mutex lock
101  // since multiple threads may call this method at the same time.
102  // Here's an example:
103  //
104  // vector<const MyDataClass*> mydataclasses;
105  // loop->Get(mydataclasses);
106  //
107  // japp->RootWriteLock();
108  // ... fill historgrams or trees ...
109  // japp->RootUnLock();
110 
111  //NOTE: we do not use WriteLock() to safe time.
112 
113 
114  //cout<<"CALL EVENT ROUTINE!!!! "<<eventnumber<<endl;
115 
116  // Get First Trigger Type
117  vector <const DL1Trigger*> trig_words;
118  uint32_t trig_mask, fp_trig_mask;
119  try {
120  loop->Get(trig_words);
121  } catch(...) {};
122  if (trig_words.size()) {
123  trig_mask = trig_words[0]->trig_mask;
124  fp_trig_mask = trig_words[0]->fp_trig_mask;
125  }
126  else {
127  trig_mask = 0;
128  fp_trig_mask = 0;
129  }
130 
131 
132  /* fp_trig_mask & 0x100 - upstream LED
133  fp_trig_mask & 0x200 - downstream LED
134  trig_mask & 0x1 - cosmic trigger*/
135 
136  if (fp_trig_mask){ // this is a front pannel trigger like LED
137  return NOERROR;
138  }
139  if (trig_mask>7){ // this is not a BCAL/FCAL trigger
140  return NOERROR;
141  }
142 
143  vector< const DCAEN1290TDCHit*> CAENHits;
144  loop->Get(CAENHits);
145  if (CAENHits.size()<=0){
146  return NOERROR;
147  }
148  uint32_t locROCID = CAENHits[0]->rocid;
149 
150  vector <const DCODAROCInfo*> ROCS;
151  loop->Get(ROCS);
152  int indx = -1;
153  for ( unsigned int n=0; n<ROCS.size(); n++) {
154  if (locROCID == ROCS[n]->rocid){
155  indx = n;
156  break;
157  }
158  }
159 
160  if (indx<0){
161  return NOERROR;
162  }
163 
164  uint64_t TriggerTime = ROCS[indx]->timestamp;
165  int TriggerBIT = TriggerTime%6;
166  float TimingShift = TOF_TDC_SHIFT - (float)TriggerBIT;
167  if(TimingShift <= 0) {
168  TimingShift += 6.;
169  }
170 
171  TimingShift *= 4. ;
172 
173  vector<const DTOFDigiHit*> ADCHits, ADCHitsLeft[2],ADCHitsRight[2];
174  vector<const DTOFTDCDigiHit*> TDCHits, TDCHitsLeft[2], TDCHitsRight[2];
175  vector<int> ADCLeftOverFlow[2],ADCRightOverFlow[2];
176 
177  loop->Get(ADCHits);
178  loop->Get(TDCHits);
179 
180  // loop over DTOFDigiHit: this are ADC hits
181  // sort them into ADCLeft and ADCRight hits
182  // only keep hits within the time-peak
183  // also keep the hodoscope planes separate
184  int th[2][44][2];
185  memset(th,0,2*44*2*4);
186  for (unsigned int k=0; k<ADCHits.size(); k++){
187  const DTOFDigiHit *hit = ADCHits[k];
188  int plane = hit->plane;
189  int end = hit->end;
190 
191  float time = (float)hit->pulse_time * BINADC_2_TIME;
192  int val = (hit->pulse_time & 0x3F);
193  if (!val){
194  continue;
195  }
196 
197  int bar = hit->bar;
198  float indx = bar-1 + plane *88 + end*44;
199  //cout<<plane<<" "<<bar<<" "<<end<<endl;
200 
201  if (hit->pedestal){
202  TOFPedestal->Fill(indx, (float)hit->pedestal);
203  TOFEnergy->Fill(indx, (float)hit->pulse_integral);
204  TOFPeak->Fill(indx, (float)hit->pulse_peak);
205  }
206 
207  if (th[plane][bar-1][end]){ // only take first hit
208  continue;
209  }
210 
211  th[plane][bar-1][end] = 1;
212  TOFADCtime->Fill(time,indx);
213  if (fabsf(time-ADCTLOC)<ADCTimeCut){
214  // test for overflow if raw data available
215  vector <const Df250PulseIntegral*> PulseIntegral;
216  hit->Get(PulseIntegral);
217  //vector <const Df250WindowRawData*> WRawData;
218  //PulseIntegral[0]->Get(WRawData);
219  int overflow = 0;
220  /*
221  if ( WRawData.size() > 0) {
222  for (int n=0;n<100;n++){
223  if (WRawData[0]->samples[n] & 0x1000){
224  overflow++;
225  }
226  }
227  } else {
228  //overflow = PulseIntegral[0]->quality_factor;
229  }
230 */
231  if (end){
232  ADCHitsRight[plane].push_back(hit);
233  ADCRightOverFlow[plane].push_back(overflow);
234  } else {
235  ADCHitsLeft[plane].push_back(hit);
236  ADCLeftOverFlow[plane].push_back(overflow);
237  }
238  }
239  }
240 
241  if (ADCLeftOverFlow[0].size() != ADCHitsLeft[0].size()){
242  cout<<"Error vector size missmatch!"<<endl;
243  }
244 
245 
246  // loop over DTOFTDCDigiHits : these are the TDC hits
247  // sort them into left and right hits
248  // only keep hits within the time peak
249  // also keep the hodoscope planes separate
250  for (unsigned int k=0; k<TDCHits.size(); k++){
251  const DTOFTDCDigiHit *hit = TDCHits[k];
252  int plane = hit->plane;
253  int end = hit->end;
254  float time = (float)hit->time * BINTDC_2_TIME;
255  float indx = plane*88 + end*44 + hit->bar-1;
256  TOFTDCtime->Fill(time, indx);
257  if (fabsf(time-TDCTLOC)<TDCTimeCut){
258  if (end){
259  TDCHitsRight[plane].push_back(hit);
260  } else {
261  TDCHitsLeft[plane].push_back(hit);
262  }
263  }
264  }
265 
266  float Signum = -1.;
267  vector <paddle> TOFADCPaddles[2];
268  vector <SingleP> TOFADCSingles[2];
269  //int firsttime = 1;
270 
271  // for each hodoscope plane find matches between
272  // ADC left and right data or find single hits for
273  // the single ended readout paddles.
274  for (int plane=0; plane<2; plane++){
275 
276  // loop over right pmts to find single ended paddle hits
277  // these are paddle 22 and paddle 23
278  for (unsigned int i = 0; i<ADCHitsRight[plane].size(); i++) {
279  const DTOFDigiHit *hitR = ADCHitsRight[plane][i];
280  int paddle = hitR->bar;
281  if ((paddle == 22) || (paddle == 23)){
282  struct SingleP newsingle;
283  newsingle.paddle = paddle;
284  newsingle.LR = 1;
285  newsingle.time = (float)hitR->pulse_time*BINADC_2_TIME ;
286  newsingle.adc = (float)hitR->pulse_integral -
287  (float)hitR->pedestal/(float)hitR->nsamples_pedestal*(float)hitR->nsamples_integral;
288 
289  newsingle.Peak = hitR->pulse_peak - (float)hitR->pedestal/(float)hitR->nsamples_pedestal;
290 
291  newsingle.OverFlow = ADCRightOverFlow[plane][i];
292  TOFADCSingles[plane].push_back(newsingle);
293  }
294  }
295 
296  // loop over left pmts to find single ended paddle hits
297  // these are paddle 22 and paddle 23
298  // for the other paddle loop over the right ones and find match
299 
300  for (unsigned int j = 0; j<ADCHitsLeft[plane].size(); j++) {
301  const DTOFDigiHit *hit = ADCHitsLeft[plane][j];
302  int paddle = hit->bar;
303  if ((paddle == 22) || (paddle == 23)){ // save singles of left pmts
304  struct SingleP newsingle;
305  newsingle.paddle = paddle;
306  newsingle.LR = 0;
307  newsingle.adc = (float)hit->pulse_integral -
308  (float)hit->pedestal/(float)hit->nsamples_pedestal*(float)hit->nsamples_integral;
309 
310  newsingle.Peak = hit->pulse_peak - (float)hit->pedestal/(float)hit->nsamples_pedestal;
311 
312  newsingle.time = (float)hit->pulse_time*BINADC_2_TIME ;
313  newsingle.OverFlow = ADCLeftOverFlow[plane][j];
314  TOFADCSingles[plane].push_back(newsingle);
315  } else {
316 
317  // loop over Right adc hits find match with the left and prepare paddle hits
318  for (unsigned int i = 0; i<ADCHitsRight[plane].size(); i++) {
319  const DTOFDigiHit *hitR = ADCHitsRight[plane][i];
320  if (hitR->bar == paddle){
321  struct paddle newpaddle;
322  newpaddle.paddle = paddle;
323  newpaddle.timeL = (float)hit->pulse_time*BINADC_2_TIME ;
324  newpaddle.timeR = (float)hitR->pulse_time*BINADC_2_TIME ;
325  newpaddle.mt = (newpaddle.timeL + newpaddle.timeR)/2.;
326  newpaddle.td = Signum*(newpaddle.timeL - newpaddle.timeR)/2.;
327  newpaddle.adcL = (float)hit->pulse_integral -
328  (float)hit->pedestal/(float)hit->nsamples_pedestal*(float)hit->nsamples_integral;
329  newpaddle.adcR = (float)hitR->pulse_integral -
330  (float)hitR->pedestal/(float)hitR->nsamples_pedestal*(float)hitR->nsamples_integral;
331 
332  newpaddle.PeakR = hitR->pulse_peak - (float)hitR->pedestal/(float)hitR->nsamples_pedestal;
333 
334  newpaddle.PeakL = hit->pulse_peak - (float)hit->pedestal/(float)hit->nsamples_pedestal;
335 
336  newpaddle.OverFlowL = ADCLeftOverFlow[plane][j];
337  newpaddle.OverFlowR = ADCRightOverFlow[plane][i];
338  if ((paddle != 22) && (paddle !=23)) {
339  //cout<<newpaddle.OverFlowL<<" "<< newpaddle.OverFlowR <<endl;
340  TOFADCPaddles[plane].push_back(newpaddle);
341  }
342  }
343  }
344  }
345  }
346  }
347 
348  vector <paddle> TOFTDCPaddles[2];
349  vector <SingleP> TOFTDCSingles[2];
350  //firsttime = 1;
351 
352  // now do the same thing for TDC hits
353  // find matches between left and right and treat the single ended paddles separately
354 
355  for (int plane=0; plane<2; plane++){
356 
357  for (unsigned int j = 0; j<TDCHitsRight[plane].size(); j++) {
358  const DTOFTDCDigiHit *hit = TDCHitsRight[plane][j];
359  int paddle = hit->bar;
360  if ((paddle == 22) || (paddle == 23)){
361  struct SingleP newsingle;
362  newsingle.paddle = paddle;
363  newsingle.LR = 1;
364  newsingle.time = (float)hit->time*BINTDC_2_TIME ;
365  TOFTDCSingles[plane].push_back(newsingle);
366  }
367  }
368 
369  for (unsigned int j = 0; j<TDCHitsLeft[plane].size(); j++) {
370  const DTOFTDCDigiHit *hit = TDCHitsLeft[plane][j];
371  int paddle = hit->bar;
372  if ((paddle == 22) || (paddle == 23)){
373  struct SingleP newsingle;
374  newsingle.paddle = paddle;
375  newsingle.LR = 0;
376  newsingle.time = (float)hit->time*BINTDC_2_TIME ;
377  TOFTDCSingles[plane].push_back(newsingle);
378  } else {
379  for (unsigned int i = 0; i<TDCHitsRight[plane].size(); i++) {
380  const DTOFTDCDigiHit *hitR = TDCHitsRight[plane][i];
381  if (hitR->bar == paddle){
382  struct paddle newpaddle;
383  newpaddle.paddle = paddle;
384  newpaddle.timeL = (float)hit->time*BINTDC_2_TIME ;
385  newpaddle.timeR = (float)hitR->time*BINTDC_2_TIME ;
386  newpaddle.mt = (newpaddle.timeL + newpaddle.timeR)/2.;
387  newpaddle.td = Signum*(newpaddle.timeL - newpaddle.timeR)/2.; // left side get positive x
388  if ((paddle != 22) && (paddle !=23)) {
389  TOFTDCPaddles[plane].push_back(newpaddle);
390  }
391  }
392  }
393  }
394  }
395  }
396 
397  // FILL HISTOGRAMS
398  // Since we are filling histograms (and trees in a file) local to this plugin, it will not interfere with other ROOT operations: can use plugin-wide ROOT fill lock
399  japp->RootFillLock(this); //ACQUIRE ROOT FILL LOCK
400 
401  Event = eventnumber;
402  TShift = TimingShift;
403  Nhits = TOFTDCPaddles[0].size() + TOFTDCPaddles[1].size();
404  int cnt = 0;
405  int AllHits[4]={0,0,0,0};
406 
407  if (Nhits<MaxHits){
408  for (unsigned int k = 0; k<TOFTDCPaddles[0].size() ; k++){
409  Plane[cnt] = 0;
410  Paddle[cnt] = TOFTDCPaddles[0][k].paddle;
411  MeanTime[cnt] = TOFTDCPaddles[0][k].mt;
412  TimeDiff[cnt] = TOFTDCPaddles[0][k].td;
413  cnt++;
414  AllHits[0]++;
415  }
416  AllHits[0] = cnt;
417  for (unsigned int k = 0; k<TOFTDCPaddles[1].size() ; k++){
418  Plane[cnt] = 1;
419  Paddle[cnt] = TOFTDCPaddles[1][k].paddle;
420  MeanTime[cnt] = TOFTDCPaddles[1][k].mt;
421  TimeDiff[cnt] = TOFTDCPaddles[1][k].td;
422  cnt++;
423  AllHits[1]++;
424  }
425  } else {
426  Nhits = 0;
427  }
428 
429  cnt = 0;
430  NhitsA = TOFADCPaddles[0].size() + TOFADCPaddles[1].size();
431  if (NhitsA<MaxHits){
432  for (unsigned int k = 0; k<TOFADCPaddles[0].size() ; k++){
433  PlaneA[cnt] = 0;
434  PaddleA[cnt] = TOFADCPaddles[0][k].paddle;
435  MeanTimeA[cnt] = TOFADCPaddles[0][k].mt;
436  TimeDiffA[cnt] = TOFADCPaddles[0][k].td;
437  ADCL[cnt] = TOFADCPaddles[0][k].adcL;
438  ADCR[cnt] = TOFADCPaddles[0][k].adcR;
439  OFL[cnt] = TOFADCPaddles[0][k].OverFlowL;
440  OFR[cnt] = TOFADCPaddles[0][k].OverFlowR;
441  PEAKL[cnt] = TOFADCPaddles[0][k].PeakL;
442  PEAKR[cnt] = TOFADCPaddles[0][k].PeakR;
443 
444  cnt++;
445  AllHits[2]++;
446  }
447 
448  for (unsigned int k = 0; k<TOFADCPaddles[1].size() ; k++){
449  PlaneA[cnt] = 1;
450  PaddleA[cnt] = TOFADCPaddles[1][k].paddle;
451  MeanTimeA[cnt] = TOFADCPaddles[1][k].mt;
452  TimeDiffA[cnt] = TOFADCPaddles[1][k].td;
453  ADCL[cnt] = TOFADCPaddles[1][k].adcL;
454  ADCR[cnt] = TOFADCPaddles[1][k].adcR;
455  OFL[cnt] = TOFADCPaddles[1][k].OverFlowL;
456  OFR[cnt] = TOFADCPaddles[1][k].OverFlowR;
457  PEAKL[cnt] = TOFADCPaddles[1][k].PeakL;
458  PEAKR[cnt] = TOFADCPaddles[1][k].PeakR;
459 
460  cnt++;
461  AllHits[3]++;
462  }
463  } else {
464  NhitsA = 0;
465  }
466 
467  NsinglesA = TOFADCSingles[0].size() + TOFADCSingles[1].size();
468  NsinglesT = TOFTDCSingles[0].size() + TOFTDCSingles[1].size();
469 
470  unsigned int j=0;
471  for (unsigned int k = 0; k<TOFADCSingles[0].size(); k++){
472  PlaneSA[k] = 0;
473  PaddleSA[k] = TOFADCSingles[0][k].paddle ;
474  LRA[k] = TOFADCSingles[0][k].LR ;
475  ADCS[k] = TOFADCSingles[0][k].adc;
476  TADCS[k] = TOFADCSingles[0][k].time;
477  OF[k] = TOFADCSingles[0][k].OverFlow;
478  PEAK[k] = TOFADCSingles[0][k].Peak;
479 
480  j++;
481  }
482  for (unsigned int k = 0; k<TOFADCSingles[1].size(); k++){
483  PlaneSA[k+j] = 1;
484  PaddleSA[k+j] = TOFADCSingles[1][k].paddle ;
485  LRA[k+j] = TOFADCSingles[1][k].LR ;
486  ADCS[k+j] = TOFADCSingles[1][k].adc;
487  TADCS[k+j] = TOFADCSingles[1][k].time; ;
488  OF[k+j] = TOFADCSingles[1][k].OverFlow;
489  PEAK[k+j] = TOFADCSingles[1][k].Peak;
490  }
491  j = 0;
492  for (unsigned int k = 0; k<TOFTDCSingles[0].size(); k++){
493  PlaneST[k] = 0;
494  PaddleST[k] = TOFTDCSingles[0][k].paddle ;
495  LRT[k] = TOFTDCSingles[0][k].LR ;
496  TDCST[k] = TOFTDCSingles[0][k].time;
497  j++;
498  }
499  for (unsigned int k = 0; k<TOFTDCSingles[1].size(); k++){
500  PlaneST[k+j] = 1;
501  PaddleST[k+j] = TOFTDCSingles[1][k].paddle ;
502  LRT[k+j] = TOFTDCSingles[1][k].LR ;
503  TDCST[k+j] = TOFTDCSingles[1][k].time; ;
504  }
505 
506  if (((AllHits[0]>0) && (AllHits[1]>0)) ||
507  ((AllHits[2]>0) && (AllHits[3]>0))){
508  t3->Fill();
509  }
510 
511  japp->RootFillUnLock(this); //RELEASE ROOT FILL LOCK
512 
513  return NOERROR;
514 }
515 
516 //------------------
517 // erun
518 //------------------
520 {
521  // This is called whenever the run number changes, before it is
522  // changed to give you a chance to clean up before processing
523  // events from the next run number.
524  return NOERROR;
525 }
526 
527 //------------------
528 // fini
529 //------------------
531 {
532  // Called before program exit after event processing is finished.
533 
534  WriteRootFile();
535 
536  return NOERROR;
537 }
538 
539 
541 
542 
543  //sprintf(ROOTFileName,"tofdata_run%d.root",RunNumber);
544  //ROOTFile = new TFile(ROOTFileName,"recreate");
545 
546  TDirectory *top = gDirectory;
547 
548  ROOTFile->cd();
549  ROOTFile->cd("TOFcalib");
550 
551  TOFTDCtime->Write();
552  TOFADCtime->Write();
553  TOFEnergy->Write();
554  TOFPeak->Write();
555  TOFPedestal->Write();
556 
557  t3->Write();
558  //t3->AutoSave("SaveSelf");
559 
560  //ROOTFile->Close();
561  top->cd();
562 
563  return NOERROR;
564 
565 }
566 
568 
569  //NO LOCKS: CALLED IN init(): GUARANTEED TO BE SINGLE-THREADED
570  /*
571  cout<<endl;
572  cout<<"CALL MakeHistograms for TOF_calib!!!! "<<endl;
573  cout<<endl;
574  */
575 
576  if (first){
577 
578  //cout<<"SETUP HISTOGRAMS AND TREE FOR RUN "<<RunNumber<<flush<<endl;
579 
580  first = 0;
581 
582  TDirectory *top = gDirectory;
583 
584  // create root file here so the tree does not show up in hd_root.root
585  sprintf(ROOTFileName,"hd_root_tofcalib.root");
586  ROOTFile = new TFile(ROOTFileName,"recreate");
587  ROOTFile->cd();
588 
589  ROOTFile->mkdir("TOFcalib");
590  ROOTFile->cd("TOFcalib");
591 
592 
593  TOFTDCtime = new TH2F("TOFTDCtime","TOF CAEN TDC times", 8000, 0., 4000., 176, 0., 176.);
594  TOFADCtime = new TH2F("TOFADCtime","TOF ADC times", 800, 0., 400., 176, 0., 176.);
595 
596  TOFEnergy = new TH2F("TOFEnergy","TOF Energy Integral (no ped subraction)",
597  176, 0., 176., 100, 0., 20000.);
598  TOFPeak = new TH2F("TOFPeak","TOF Peak Amplitude",176, 0., 176., 100, 0., 4100.);
599  TOFPedestal = new TH2F("TOFPedestal","TOF Pedestal",176, 0., 176., 300, 0., 600.);
600 
601 
602  t3 = new TTree("t3","TOF Hits");
603  t3->Branch("Event", &Event,"Event/I");
604 
605  t3->Branch("Nhits", &Nhits,"Nhits/I");
606  t3->Branch("TShift",&TShift,"TShift/F");
607  t3->Branch("Plane",Plane,"Plane[Nhits]/I");
608  t3->Branch("Paddle",Paddle,"Paddle[Nhits]/I");
609  t3->Branch("MeanTime",MeanTime,"MeanTime[Nhits]/F");
610  t3->Branch("TimeDiff",TimeDiff,"TimeDiff[Nhits]/F");
611 
612  t3->Branch("NhitsA", &NhitsA,"NhitsA/I");
613  t3->Branch("PlaneA",PlaneA,"PlaneA[NhitsA]/I");
614  t3->Branch("PaddleA",PaddleA,"PaddleA[NhitsA]/I");
615  t3->Branch("MeanTimeA",MeanTimeA,"MeanTimeA[NhitsA]/F");
616  t3->Branch("TimeDiffA",TimeDiffA,"TimeDiffA[NhitsA]/F");
617  t3->Branch("ADCL",ADCL,"ADCL[NhitsA]/F");
618  t3->Branch("ADCR",ADCR,"ADCR[NhitsA]/F");
619  t3->Branch("OFL",OFL,"OFL[NhitsA]/I");
620  t3->Branch("OFR",OFR,"OFR[NhitsA]/I");
621  t3->Branch("PEAKL",PEAKL,"PEAKL[NhitsA]/F");
622  t3->Branch("PEAKR",PEAKR,"PEAKR[NhitsA]/F");
623 
624  t3->Branch("NsinglesA", &NsinglesA,"NsinglesA/I");
625  t3->Branch("PlaneSA",PlaneSA,"PlaneSA[NsinglesA]/I");
626  t3->Branch("PaddleSA",PaddleSA,"PaddleSA[NsinglesA]/I");
627  t3->Branch("LRA",LRA,"LRA[NsinglesA]/I"); //LA=0,1 (left/right)
628  t3->Branch("ADCS",ADCS,"ADCS[NsinglesA]/F");
629  t3->Branch("OF",OF,"OF[NsinglesA]/I");
630  t3->Branch("TADCS",TADCS,"TADCS[NsinglesA]/F");
631  t3->Branch("PEAK",PEAK,"PEAK[NsinglesA]/F");
632 
633  t3->Branch("NsinglesT", &NsinglesT,"NsinglesT/I");
634  t3->Branch("PlaneST",PlaneST,"PlaneSA[NsinglesT]/I");
635  t3->Branch("PaddleST",PaddleST,"PaddleSA[NsinglesT]/I");
636  t3->Branch("LRT",LRT,"LRT[NsinglesT]/I"); //LA=0,1 (left/right)
637  t3->Branch("TDCST",TDCST,"TDCST[NsinglesT]/F");
638 
639  top->cd();
640  }
641 
642  return NOERROR;
643 }
uint32_t pedestal
pedestal info used by FPGA (if any)
Definition: DTOFDigiHit.h:23
sprintf(text,"Post KinFit Cut")
#define MaxHits
uint32_t nsamples_integral
number of samples used in integral
Definition: DTOFDigiHit.h:25
int bar
bar number
JApplication * japp
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
InitPlugin_t InitPlugin
uint32_t nsamples_pedestal
number of samples used in pedestal
Definition: DTOFDigiHit.h:26
int end
left/right 0/1 or North/South 0/1
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
uint32_t pulse_time
identified pulse time as returned by FPGA algorithm
Definition: DTOFDigiHit.h:22
uint32_t pulse_peak
maximum sample in pulse
Definition: DTOFDigiHit.h:27
int plane
plane (0: vertical, 1: horizontal)
uint32_t time
hit time
uint32_t pulse_integral
identified pulse integral as returned by FPGA algorithm
Definition: DTOFDigiHit.h:21