Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JEventProcessor_CDC_expert.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: JEventProcessor_CDC_expert.cc
4 // Created: Wed Oct 22
5 // Creator: Naomi Jarvis
6 
7 
8 #include <stdint.h>
9 #include <vector>
10 
11 #include <TMath.h>
12 
13 
15 #include <JANA/JApplication.h>
16 
17 
18 using namespace std;
19 using namespace jana;
20 
21 
22 #include "CDC/DCDCHit.h"
23 #include "CDC/DCDCDigiHit.h"
24 #include "DAQ/Df125PulseIntegral.h"
25 #include "DAQ/Df125PulsePedestal.h"
26 #include "DAQ/Df125WindowRawData.h"
27 #include "DAQ/Df125CDCPulse.h"
28 #include "TRIGGER/DTrigger.h"
29 
30 #include <TDirectory.h>
31 #include <TH2.h>
32 #include <TH1.h>
33 
34 
35 // root hist pointers
36 
37 
38 
39 static TH1D *cdc_e = NULL;
40 static TH2D *cdc_e_vs_n = NULL;
41 
42 static TH1D *cdc_t = NULL;
43 static TH2D *cdc_t_vs_n = NULL;
44 
45 
46 static TH2D *cdc_e_ring[29];
47 static TH2D *cdc_t_ring[29];
48 
49 
50 static TH2D *cdc_e_vs_t;
51 static TH2D *cdc_e_vs_t_ring[29];
52 
53 static TH2I *cdc_raw_int_vs_t;
54 static TH2I *cdc_raw_int_vs_t_ring[29];
55 
56 
57 static TH2I *cdc_o_badt;
58 static TH2I *cdc_o_overflow;
59 
60 static TH2I *cdc_ped_ring[29];
61 static TH1I *cdc_ped_badt;
62 static TH1I *cdc_ped_overflow;
63 
64 static TH2I *cdc_windata_ped_ring[29];
65 
66 static TH2I *cdc_windata_ped_roc25;
67 static TH2I *cdc_windata_ped_roc26;
68 static TH2I *cdc_windata_ped_roc27;
69 static TH2I *cdc_windata_ped_roc28;
70 
71 static TH2I *cdc_raw_t_ring[29];
72 static TH1I *cdc_raw_t_badt;
73 static TH1I *cdc_raw_t_overflow;
74 
75 static TH2I *cdc_raw_amp_ring[29];
76 static TH1I *cdc_raw_amp_badt;
77 static TH1I *cdc_raw_amp_overflow;
78 
79 
80 
81 static TH2I *cdc_raw_intpp_ring[29];
82 static TH1I *cdc_raw_intpp_badt;
83 static TH1I *cdc_raw_intpp_overflow;
84 
85 
86 
87 static TH2I *cdc_raw_int_ring[29];
88 static TH1I *cdc_raw_int_badt;
89 static TH1I *cdc_raw_int_overflow;
90 
91 // Some hists are only made if run number is
92 // is > 3675. We need a flag to prevent any
93 // attempt to fill them which results in a
94 // seg. fault.
95 bool hists3675 = false;
96 
97 
98 //----------------------------------------------------------------------------------
99 
100 
101 // Routine used to create our JEventProcessor
102 extern "C"{
103  void InitPlugin(JApplication *app){
104  InitJANAPlugin(app);
105  app->AddProcessor(new JEventProcessor_CDC_expert());
106  }
107 }
108 
109 
110 //----------------------------------------------------------------------------------
111 
112 
114 
115  initialized_histograms = false;
116 }
117 
118 
119 //----------------------------------------------------------------------------------
120 
121 
123 }
124 
125 
126 //----------------------------------------------------------------------------------
127 
129 
130  // I moved all the histogram setup into the brun so that I can use different
131  // scales for the later runs using the new firmware. NSJ.
132 
133  return NOERROR;
134 }
135 
136 
137 //----------------------------------------------------------------------------------
138 
139 
140 jerror_t JEventProcessor_CDC_expert::brun(JEventLoop *eventLoop, int32_t runnumber) {
141  // This is called whenever the run number changes
142 
143  japp->RootWriteLock(); //ACQUIRE ROOT LOCK!!
144 
145  // Do not initialize ROOT objects twice!
146  if(initialized_histograms){
147  japp->RootUnLock();
148  return NOERROR;
149  }
150 
151  // max values for histogram scales, modified fa250-format readout
152 
153  // Int_t IMAX = 524288; //max for raw integral, fa250-format, 19 bits
154  Int_t IMAX = 400000; //max for raw integral
155  Int_t PMAX = 512; //max for pedestal, fa250-format max is 512
156  Int_t AMAX = 4096; //max for amplitude, fa250-format, 12 bits
157  Int_t RTMAX = 12000;
158  Int_t RTVSNMAX = 8192; //raw time vs straw histogram range ends at this value
159 
160  Char_t rtunits[8] = "0.125ns"; //raw time is in units of sample/64 = ns/8
161 
162  if (runnumber > 3675) { //new fa125 format firmware, from 11 Sept 2015
163 
164  // raw quantities for read out (125 format) are
165  // time field max 2047 scaled x 1, units 0.8ns
166  // time qf field max 1
167  // overflow count field max 7
168  // pedestal field max 255 scaled x 1/4 initially
169  // max amplitude 9 bits, field max 511 scaled x 1/8
170  // integral field max 16383 scaled x 1/14
171 
172 
173  // max values for histogram scales, fa125-format readout
174 
175  IMAX = 16384; //max for raw integral, fa125-format, 14 bits
176  PMAX = 256; //max for pedestal, fa125-format, 8 bits
177  AMAX = 512; //max for amplitude, fa125-format, 9 bits
178  RTMAX = 2048; //max for raw time, fa125-format, 11 bits
179  RTVSNMAX = 1024; //raw time vs straw histogram range ends at this value
180 
181  sprintf(rtunits,"0.8ns"); //raw time is in units of sample/10 = 0.8ns
182 
183  }
184 
185 
186  const Int_t EMAX = 21000; //max for E histograms, fC
187  // const Int_t EMAX = 21000000; //max for E histograms, fC
188  // E histograms filled with a_scale*gains*(integration-pedestal)
189 
190  const Int_t TMAX = 2000; //max for t histograms, ns
191  // t histograms filled with t_scale*(raw-t - offset) + tmin
192 
193 
194  const Int_t NSTRAWS = 3522;
195  const Float_t HALF = 0.5;
196  const Float_t NSTRAWSPH = 3522.5;
197 
198 
199  // create root folder for cdc and cd to it, store main dir
200  TDirectory *main = gDirectory;
201  gDirectory->mkdir("CDC_expert")->cd();
202 
203 
204 
205  // book histograms
206 
207  //number of straws in each ring, starts with 0 so that straws[1] is the number of straws in ring 1
208  const Int_t straws[29] = {0,42,42,54,54,66,66,80,80,93,93,106,106,123,123,135,135,146,146,158,158,170,170,182,182,197,197,209,209};
209 
210 
211  cdc_e = new TH1D("cdc_e","CDC charge (fC);charge (fC)",200,0,EMAX);
212  cdc_e_vs_n = new TH2D("cdc_e_vs_n","CDC charge (fC) vs straw number;straw;charge (fC)",NSTRAWS,HALF,NSTRAWSPH,100,0,EMAX);
213 
214  cdc_e_vs_t = new TH2D("cdc_e_vs_t","CDC charge (fC) vs time (ns);time (ns);charge (fC)",150,-250,TMAX,100,0,EMAX);
215 
216 
217  cdc_t = new TH1D("cdc_t","CDC time (ns);time (ns)",300,-250,TMAX);
218  cdc_t_vs_n = new TH2D("cdc_t_vs_n","CDC time (ns) vs straw number;straw;time (ns)",NSTRAWS,HALF,NSTRAWSPH,150,-250,TMAX);
219 
220 
221 
222 
223  cdc_raw_int_vs_t = new TH2I("cdc_raw_int_vs_t",Form("CDC integral (ADC units), pedestal subtracted, vs raw time (units of %s);time (%s);integral, pedestal subtracted (ADC units)",rtunits,rtunits),(Int_t)256,0,RTVSNMAX,100,0,IMAX);
224 
225 
226 
227  cdc_windata_ped_roc25 = new TH2I("cdc_windata_ped_roc25","CDC pedestal (ADC units) from raw window data vs slot*100+channel, ROC 25;slot*100 + channel;pedestal",1600,200+HALF,1800+HALF,(Int_t)PMAX/4,0,PMAX);
228  cdc_windata_ped_roc26 = new TH2I("cdc_windata_ped_roc26","CDC pedestal (ADC units) from raw window data vs slot*100+channel, ROC 26;slot*100 + channel;pedestal",1600,200+HALF,1800+HALF,(Int_t)PMAX/4,0,PMAX);
229  cdc_windata_ped_roc27 = new TH2I("cdc_windata_ped_roc27","CDC pedestal (ADC units) from raw window data vs slot*100+channel, ROC 27;slot*100 + channel;pedestal",1600,200+HALF,1800+HALF,(Int_t)PMAX/4,0,PMAX);
230  cdc_windata_ped_roc28 = new TH2I("cdc_windata_ped_roc28","CDC pedestal (ADC units) from raw window data vs slot*100+channel, ROC 28;slot*100 + channel;pedestal",1600,200+HALF,1800+HALF,(Int_t)PMAX/4,0,PMAX);
231 
232 
233 
234  if (runnumber > 3675) { //new fa125 format firmware, from 11 Sept 2015
235 
236  gDirectory->mkdir("bad_t","CDC Bad time flagged")->cd();
237 
238  hists3675 = true;
239 
240  cdc_o_badt = new TH2I("cdc_o_badt","CDC occupancy by straw,ring, events with bad time flagged;straw;ring",209,0.5,209.5,28,0.5,28.5);
241  cdc_ped_badt = new TH1I("cdc_ped_badt","CDC pedestal, events with bad time flagged;straw;pedestal",256,0,PMAX);
242  cdc_raw_t_badt = new TH1I("cdc_raw_t_badt",Form("CDC raw time (units of %s), events with bad time flagged;straw;raw time (%s)",rtunits,rtunits),256,0,RTMAX);
243  cdc_raw_amp_badt = new TH1I("cdc_raw_amp_badt","CDC amplitude (ADC units), events with bad time flagged;ADC units",256,0,AMAX);
244  cdc_raw_int_badt = new TH1I("cdc_raw_intpp_badt","CDC integral (ADC units), pedestal subtracted, events with bad time flagged;ADC units",100,0,IMAX);
245  cdc_raw_intpp_badt = new TH1I("cdc_raw_intpp_badt","CDC integral (ADC units), including pedestal, events with bad time flagged;ADC units",100,0,IMAX);
246 
247  gDirectory->cd("../");
248  gDirectory->mkdir("overflows","CDC overflow flagged")->cd();
249 
250  cdc_o_overflow = new TH2I("cdc_o_overflow","CDC overflow occupancy by straw,ring;straw;ring",209,0.5,209.5,28,0.5,28.5);
251  cdc_ped_overflow = new TH1I("cdc_ped_overflow","CDC pedestal, events with ADC overflow;pedestal",256,0,PMAX);
252  cdc_raw_t_overflow = new TH1I("cdc_raw_t_overflow",Form("CDC raw time (units of %s), events with ADC overflow;raw time (%s)",rtunits,rtunits),256,0,RTMAX);
253  cdc_raw_amp_overflow = new TH1I("cdc_raw_amp_overflow","CDC amplitude (ADC units), events with ADC overflow;ADC units",256,0,AMAX);
254  cdc_raw_int_overflow = new TH1I("cdc_raw_intpp_overflow","CDC integral (ADC units), pedestal subtracted, events with ADC overflow;ADC units",100,0,IMAX);
255  cdc_raw_intpp_overflow = new TH1I("cdc_raw_intpp_overflow","CDC integral (ADC units), including pedestal, events with ADC overflow;ADC units",100,0,IMAX);
256 
257  gDirectory->cd("../");
258 
259  }
260 
261  Int_t i;
262 
263 
264  gDirectory->mkdir("rings_e_vs_t","CDC rings: charge vs time")->cd();
265 
266  for (i=1; i<29; i++) {
267  cdc_e_vs_t_ring[i] = new TH2D(Form("cdc_e_vs_t_ring[%i]",i),"CDC charge (fC) vs time (ns);time (ns);charge (fC)",150,0,TMAX,100,0,EMAX);
268  }
269 
270  gDirectory->cd("../");
271 
272 
273  gDirectory->mkdir("rings_int_vs_raw_t","CDC rings: integral vs raw time (pedestal subtracted)")->cd();
274 
275  for (i=1; i<29; i++) {
276  cdc_raw_int_vs_t_ring[i] = new TH2I(Form("cdc_raw_int_vs_t_ring[%i]",i),Form("CDC integral (ADC units), pedestal subtracted, vs raw time (%s);raw time (%s);integral, pedestal subtracted (ADC units)",rtunits,rtunits),256,0,RTVSNMAX,100,0,IMAX);
277 
278  }
279 
280  gDirectory->cd("../");
281 
282 
283 
284  gDirectory->mkdir("rings_e","CDC rings: charge vs straw")->cd();
285 
286  for (i=1; i<29; i++) {
287  cdc_e_ring[i] = new TH2D(Form("cdc_e_ring[%i]",i),Form("CDC charge (fC), ring %i;straw;charge (fC)",i),straws[i],HALF,straws[i]+HALF,100,0,EMAX);
288  }
289 
290  gDirectory->cd("../");
291  gDirectory->mkdir("rings__t","CDC rings: time vs straw")->cd();
292 
293  for (i=1; i<29; i++) {
294  cdc_t_ring[i] = new TH2D(Form("cdc_t_ring[%i]",i),Form("CDC time (ns), ring %i;straw;time (ns)",i),straws[i],HALF,straws[i]+HALF,150,0,TMAX);
295  }
296 
297 
298  gDirectory->cd("../");
299  gDirectory->mkdir("rings_pedestal","CDC rings: pedestal vs straw")->cd();
300 
301  for (i=1; i<29; i++) {
302  cdc_ped_ring[i] = new TH2I(Form("cdc_ped_ring[%i]",i),Form("CDC pedestal (ADC units), ring %i;straw;pedestal",i),straws[i],HALF,straws[i]+HALF,(Int_t)PMAX/2,0,PMAX);
303  }
304 
305  gDirectory->cd("../");
306  gDirectory->mkdir("rings_windata_pedestal","CDC rings: pedestal from raw window data vs straw")->cd();
307 
308  for (i=1; i<29; i++) {
309  cdc_windata_ped_ring[i] = new TH2I(Form("cdc_windata_ped_ring[%i]",i),Form("CDC pedestal (ADC units) from raw window data, ring %i;straw;pedestal",i),straws[i],HALF,straws[i]+HALF,(Int_t)PMAX/2,0,PMAX);
310  }
311 
312 
313 
314 
315 
316  gDirectory->cd("../");
317  gDirectory->mkdir("rings_raw_t","CDC rings: raw time vs straw")->cd();
318 
319  for (i=1; i<29; i++) {
320  cdc_raw_t_ring[i] = new TH2I(Form("cdc_raw_t_ring[%i]",i),Form("CDC raw time (units of %s), ring %i;straw;raw time (%s)",rtunits,i,rtunits),straws[i],HALF,straws[i]+HALF,256,0,RTVSNMAX);
321  }
322 
323 
324  gDirectory->cd("../");
325  gDirectory->mkdir("rings_raw_amp","CDC rings: amplitude")->cd();
326 
327  for (i=1; i<29; i++) {
328  cdc_raw_amp_ring[i] = new TH2I(Form("cdc_raw_amp_ring[%i]",i),Form("CDC amplitude (ADC units), ring %i",i),straws[i],HALF,straws[i]+HALF,256,0,AMAX);
329  }
330 
331 
332 
333  gDirectory->cd("../");
334  gDirectory->mkdir("rings_raw_integral","CDC rings: integral vs straw (pedestal subtracted)")->cd();
335 
336  for (i=1; i<29; i++) {
337  cdc_raw_int_ring[i] = new TH2I(Form("cdc_raw_int_ring[%i]",i),Form("CDC integral (ADC units), pedestal subtracted, ring %i",i),straws[i],HALF,straws[i]+HALF,100,0,IMAX);
338  }
339 
340 
341  gDirectory->cd("../");
342  gDirectory->mkdir("rings_raw_integral_incl_ped","CDC rings: integral vs straw (including pedestal)")->cd();
343 
344  for (i=1; i<29; i++) {
345  cdc_raw_intpp_ring[i] = new TH2I(Form("cdc_raw_intpp_ring[%i]",i),Form("CDC integral (ADC units), including pedestal, ring %i",i),straws[i],HALF,straws[i]+HALF,100,0,IMAX);
346  }
347 
348 
349 
350  // back to main dir
351  main->cd();
352 
353  initialized_histograms = true;
354 
355  japp->RootUnLock(); //RELEASE ROOT LOCK!!
356 
357 
358  return NOERROR;
359 }
360 
361 
362 //----------------------------------------------------------------------------------
363 
364 
365 jerror_t JEventProcessor_CDC_expert::evnt(JEventLoop *eventLoop, uint64_t eventnumber) {
366  // This is called for every event. Use of common resources like writing
367  // to a file or filling a histogram should be mutex protected. Using
368  // loop-Get(...) to get reconstructed objects (and thereby activating the
369  // reconstruction algorithm) should be done outside of any mutex lock
370  // since multiple threads may call this method at the same time.
371 
372  float q,t; // dcdchits quantities charge, time
373 
374  uint32_t qf,ocount; // time quality factor and overflow count from new firmware
375  uint32_t tr,p,a; // dcdcdigihits raw quantities: time, pedestal, amplitude, quality factor, overflow count
376  uint32_t integral; // dcdcdigihits integral, includes pedestal
377  uint32_t integ; // dcdcdigihits integral minus pedestal
378 
379  uint16_t ring,straw; // ring and straw numbers from either dcdchits or dcdcdigihits
380  uint16_t n; // straw number, 1 to 3522
381 
382  Bool_t PED_SUB; // if this is false, integration window info is missing, so don't plot integrals
383 
384  uint32_t total_ped; //total pedestal during integration period
385  uint32_t nsamples_integral; ///< number of samples used in integral
386  uint32_t nsamples_pedestal; ///< number of samples used in pedestal
387 
388  uint32_t rocid;
389  uint32_t slot;
390  uint32_t channel;
391 
392 
393  const uint16_t NPEDSAMPLES=16;
394 
395  //add extra 0 at front to use offset[1] for ring 1
396  int straw_offset[29] = {0,0,42,84,138,192,258,324,404,484,577,670,776,882,1005,1128,1263,1398,1544,1690,1848,2006,2176,2346,2528,2710,2907,3104,3313};
397 
398 
399  const DTrigger* locTrigger = NULL;
400  eventLoop->GetSingle(locTrigger);
401  if(locTrigger->Get_L1FrontPanelTriggerBits() != 0)
402  return NOERROR;
403 
404  if (!locTrigger->Get_IsPhysicsEvent()){ // do not look at PS triggers
405  return NOERROR;
406  }
407 
408  //first set of histograms is for dcdchits, these are t and q after calibration
409  //second set is for dcdcdigihits, these are the raw quantities
410 
411  // get hit data for cdc
412  vector<const DCDCHit*> hits;
413  eventLoop->Get(hits);
414 
415  // get raw data for cdc
416  vector<const DCDCDigiHit*> digihits;
417  eventLoop->Get(digihits);
418 
419  //get WRD data for new format (until it is linked to CDCPulse)
420  vector<const Df125WindowRawData*> wrdvector;
421  eventLoop->Get(wrdvector);
422 
423  // FILL HISTOGRAMS
424  // Since we are filling histograms local to this plugin, it will not interfere with other ROOT operations: can use plugin-wide ROOT fill lock
425  japp->RootFillLock(this); //ACQUIRE ROOT FILL LOCK
426 
427  for(uint32_t i=0; i<hits.size(); i++) {
428 
429  const DCDCHit *hit = hits[i]; // avoids having to use the uglier “cdcdigihits[0]->” syntax
430 
431  if(hit->q>0.0) {
432 
433  q = hit->q; // in fC
434  t = hit->t; // in nanoseconds
435  ring = hit->ring;
436  straw = hit->straw;
437 
438  n = straw_offset[ring] + straw;
439 
440  if (q > 0.0) {
441  cdc_e->Fill(q);
442  cdc_e_vs_n->Fill(n,q);
443  }
444 
445  //if (t > 0.0) {
446  cdc_t->Fill(t);
447  cdc_t_vs_n->Fill(n,t);
448  //}
449 
450  cdc_e_vs_t->Fill(t,q);
451  cdc_e_vs_t_ring[ring]->Fill(t,q);
452 
453  cdc_e_ring[ring]->Fill(straw,q);
454  cdc_t_ring[ring]->Fill(straw,t);
455  }
456  }
457 
458 
459  for(uint32_t i=0; i<digihits.size(); i++) {
460 
461  const DCDCDigiHit *digihit = digihits[i]; // avoids having to use the uglier “cdcdigihits[0]->” syntax
462 
463  // Get pointers to the underlying objects of interest
464  const Df125PulseIntegral *pi = NULL;
465  const Df125PulsePedestal *pp = NULL;
466  const Df125WindowRawData *windat = NULL;
467  const Df125CDCPulse *cp = NULL;
468 
469 
470  vector<uint16_t> samples;
471  uint32_t winped=0;
472 
473  PED_SUB = kFALSE; //set this to true when we find the config params
474  total_ped = 0;
475 
476  rocid = 0;
477  slot = 0;
478  channel = 0;
479  qf = 0;
480  ocount = 0;
481  a = 0;
482 
483  //old firmware uses Df125PulseIntegral and Df125PulsePedestal
484  digihit->GetSingle(pi);
485  if (pi) {
486  rocid = pi->rocid;
487  slot = pi->slot;
488  channel = pi->channel;
489  pi->GetSingle(windat);
490  } else if (i < (uint32_t)wrdvector.size()) {
491  windat = wrdvector[i];
492  }
493 
494  nsamples_integral = pi ? pi->nsamples_integral : 0;
495  nsamples_pedestal = pi ? pi->nsamples_pedestal : 0;
496 
497  if ((nsamples_integral > 0) && (nsamples_pedestal > 0)) PED_SUB = kTRUE;
498 
499  digihit->GetSingle(pp);
500  if(pp) a = pp->pulse_peak;
501 
502  //new firmware uses Df125CDCPulseData
503  digihit->GetSingle(cp);
504  if (cp) {
505  rocid = cp->rocid;
506  slot = cp->slot;
507  channel = cp->channel;
508  a = cp->first_max_amp;
509  qf = cp->time_quality_bit;
510  ocount = cp->overflow_count;
511  }
512 
513 
514 
515  if (windat) {
516 
517  if (windat->samples.size()>=NPEDSAMPLES) {
518 
519  winped = 0;
520 
521  for (uint16_t j=0; j<NPEDSAMPLES; j++) winped += (uint32_t)windat->samples[j];
522 
523  winped = (uint32_t)winped/16.0;
524 
525  if (winped > 0) {
526 
527  if (rocid == 25) cdc_windata_ped_roc25->Fill(100*slot + channel,winped);
528  if (rocid == 26) cdc_windata_ped_roc26->Fill(100*slot + channel,winped);
529  if (rocid == 27) cdc_windata_ped_roc27->Fill(100*slot + channel,winped);
530  if (rocid == 28) cdc_windata_ped_roc28->Fill(100*slot + channel,winped);
531 
532  }
533 
534  }//sample size
535  } //windat
536 
537 
538 
539 
540  if((digihit->pulse_integral>0)||(digihit->pulse_time>0)) {
541 
542  ring = digihit->ring;
543  straw = digihit->straw;
544 
545  p = digihit->pedestal;
546  tr = digihit->pulse_time; // raw time in 0.8 ns units
547  integral = digihit->pulse_integral; // pulse integral in fadc units, pedestal not subtracted
548 
549  integ = 0;
550 
551  //ok to use p for pedestal subtraction here because if fa250 algo fails with p=0, integral=0 and amplitude=0 also
552 
553  if (PED_SUB) {
554  total_ped = p*nsamples_integral/nsamples_pedestal;
555  integ = integral - total_ped;
556  }
557 
558  // straw_offset[ring] + straw;
559 
560  if (PED_SUB) cdc_raw_int_vs_t->Fill(tr,integ);
561  if (PED_SUB) cdc_raw_int_vs_t_ring[ring]->Fill(tr,integ);
562 
563  cdc_ped_ring[ring]->Fill(straw,p);
564  cdc_raw_t_ring[ring]->Fill(straw,tr);
565  cdc_raw_amp_ring[ring]->Fill(straw,a); //no ped subtraction in case scaling factors differ
566  if (PED_SUB) cdc_raw_int_ring[ring]->Fill(straw,integ);
567  cdc_raw_intpp_ring[ring]->Fill(straw,integral);
568  if (winped) cdc_windata_ped_ring[ring]->Fill(straw,winped);
569 
570 
571  if (cp && hists3675) {
572  if (qf==1) { // rough time flag is set
573  cdc_o_badt->Fill(straw,ring);
574  cdc_ped_badt->Fill(p);
575  cdc_raw_t_badt->Fill(tr);
576  cdc_raw_amp_badt->Fill(a);
577  if (PED_SUB) cdc_raw_int_badt->Fill(integ);
578  cdc_raw_intpp_badt->Fill(integral);
579  }
580 
581 
582  if (ocount>0) { // overflow samples present
583  cdc_o_overflow->Fill(straw,ring);
584  cdc_ped_overflow->Fill(p);
585  cdc_raw_t_overflow->Fill(tr);
586  cdc_raw_amp_overflow->Fill(a);
587  if (PED_SUB) cdc_raw_int_overflow->Fill(integ);
588  cdc_raw_intpp_overflow->Fill(integral);
589  }
590  }
591 
592 
593  }
594 
595  }
596 
597 
598  japp->RootFillUnLock(this); //RELEASE ROOT FILL LOCK
599 
600  return NOERROR;
601 }
602 
603 
604 //----------------------------------------------------------------------------------
605 
606 
608  // This is called whenever the run number changes, before it is
609  // changed to give you a chance to clean up before processing
610  // events from the next run number.
611  return NOERROR;
612 }
613 
614 
615 //----------------------------------------------------------------------------------
616 
617 
619  // Called before program exit after event processing is finished.
620  return NOERROR;
621 }
622 
623 
624 //----------------------------------------------------------------------------------
625 //----------------------------------------------------------------------------------
static TH2D * cdc_e_vs_t
static TH2I * cdc_ped_ring[29]
uint32_t first_max_amp
from second word
Definition: Df125CDCPulse.h:68
uint32_t nsamples_integral
number of samples used in integral
jerror_t fini(void)
Called after last event of last event source has been processed.
static TH1D * cdc_t
static TH2I * cdc_raw_int_vs_t_ring[29]
static TH1I * cdc_raw_intpp_badt
uint32_t nsamples_pedestal
number of samples used in pedestal
static TH2I * cdc_o_overflow
static TH2D * cdc_e_ring[29]
const double PMAX
uint32_t pulse_peak
from Pulse Pedestal Data word
sprintf(text,"Post KinFit Cut")
static TH2I * cdc_windata_ped_ring[29]
uint32_t Get_L1FrontPanelTriggerBits(void) const
static TH2I * cdc_raw_int_ring[29]
uint32_t overflow_count
from first word
Definition: Df125CDCPulse.h:65
static TH1D * cdc_e
jerror_t init(void)
Called once at program start.
JApplication * japp
uint32_t pulse_time
identified pulse time as returned by FPGA algorithm
Definition: DCDCDigiHit.h:22
bool Get_IsPhysicsEvent(void) const
static TH2D * cdc_e_vs_t_ring[29]
static TH1I * cdc_raw_t_overflow
float t
Definition: DCDCHit.h:22
static TH1I * cdc_raw_intpp_overflow
InitPlugin_t InitPlugin
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
static TH1I * cdc_ped_overflow
uint32_t pulse_integral
identified pulse integral as returned by FPGA algorithm
Definition: DCDCDigiHit.h:21
static TH2I * cdc_windata_ped_roc25
vector< uint16_t > samples
static TH2I * cdc_raw_t_ring[29]
int ring
Definition: DCDCHit.h:18
static TH1I * cdc_raw_amp_overflow
static TH1I * cdc_raw_t_badt
static TH1I * cdc_raw_int_overflow
static TH1I * cdc_raw_amp_badt
static TH2D * cdc_e_vs_n
uint32_t time_quality_bit
from first word
Definition: Df125CDCPulse.h:64
static TH2I * cdc_windata_ped_roc27
float q
Definition: DCDCHit.h:20
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
static TH1I * cdc_raw_int_badt
const double TMAX
static TH2I * cdc_windata_ped_roc26
static TH2D * cdc_t_vs_n
static TH2I * cdc_raw_int_vs_t
uint32_t channel
Definition: DDAQAddress.h:34
static TH2I * cdc_windata_ped_roc28
uint32_t rocid
Definition: DDAQAddress.h:32
static TH2I * cdc_raw_amp_ring[29]
TCanvas * cp
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
uint32_t pedestal
pedestal info used by FPGA (if any)
Definition: DCDCDigiHit.h:23
static TH2I * cdc_o_badt
int straw
Definition: DCDCHit.h:19
static TH2I * cdc_raw_intpp_ring[29]
static TH1I * cdc_ped_badt
int main(int argc, char *argv[])
Definition: gendoc.cc:6
static TH2D * cdc_t_ring[29]
uint32_t slot
Definition: DDAQAddress.h:33