Bug Summary

File:plugins/monitoring/CDC_expert_2/JEventProcessor_CDC_expert_2.cc
Location:line 462, column 5
Description:Value stored to 'total_ped' is never read

Annotated Source Code

1// $Id$
2//
3// File: JEventProcessor_CDC_expert_2.cc
4// Created: 26 Feb 2016
5// Creator: Naomi Jarvis
6
7
8#include <stdint.h>
9#include <vector>
10
11#include <TMath.h>
12
13
14#include "JEventProcessor_CDC_expert_2.h"
15#include <JANA/JApplication.h>
16
17
18using namespace std;
19using namespace jana;
20
21
22#include "CDC/DCDCHit.h"
23#include "CDC/DCDCDigiHit.h"
24#include "DAQ/Df125WindowRawData.h"
25#include "DAQ/Df125CDCPulse.h"
26#include "DAQ/Df125Config.h"
27
28#include <TDirectory.h>
29#include <TH2.h>
30#include <TH1.h>
31
32
33// root hist pointers
34
35
36
37static TH1D *cdc_e = NULL__null;
38static TH2D *cdc_e_vs_n = NULL__null;
39
40static TH1D *cdc_t = NULL__null;
41static TH2D *cdc_t_vs_n = NULL__null;
42
43static TH1D *cdc_rt = NULL__null;
44static TH2D *cdc_rt_vs_n = NULL__null;
45
46static TH1D *cdc_amp = NULL__null;
47static TH2D *cdc_amp_vs_n = NULL__null;
48
49static TH1D *cdc_rt_qf0 = NULL__null;
50
51static TH1D *cdc_qf = NULL__null;
52static TH2D *cdc_qf_vs_n = NULL__null;
53static TH2D *cdc_qf_vs_a = NULL__null;
54static TH2D *cdc_qf_vs_rt = NULL__null;
55
56
57//static TH2D *cdc_e_ring[29];
58static TH2D *cdc_t_ring[29];
59
60static TH2D *cdc_e_vs_t;
61static TH2D *cdc_e_vs_t_ring[29];
62
63static TH2I *cdc_int_vs_raw_t;
64static TH2I *cdc_int_vs_raw_t_ring[29];
65
66static TH2I *cdc_o_overflow;
67static TH1I *cdc_ped_overflow;
68static TH1I *cdc_raw_t_overflow;
69
70static TH2I *cdc_o_badt;
71
72static TH2I *cdc_ped_ring[29];
73static TH1I *cdc_ped_badt;
74
75static TH2I *cdc_raw_t_ring[29];
76static TH1I *cdc_raw_t_badt;
77
78static TH2I *cdc_amp_ring[29];
79static TH1I *cdc_amp_badt;
80
81
82static TH2I *cdc_intpp_ring[29];
83//static TH2I *cdc_int_ring[29];
84
85static TH2I *cdc_initped_ring[29];
86
87static TH2I *cdc_initped_roc25;
88static TH2I *cdc_initped_roc26;
89static TH2I *cdc_initped_roc27;
90static TH2I *cdc_initped_roc28;
91
92static TH2I *cdc_ped_roc25;
93static TH2I *cdc_ped_roc26;
94static TH2I *cdc_ped_roc27;
95static TH2I *cdc_ped_roc28;
96
97
98
99
100//----------------------------------------------------------------------------------
101
102
103// Routine used to create our JEventProcessor
104extern "C"{
105 void InitPlugin(JApplication *app){
106 InitJANAPlugin(app);
107 app->AddProcessor(new JEventProcessor_CDC_expert_2());
108 }
109}
110
111
112//----------------------------------------------------------------------------------
113
114
115JEventProcessor_CDC_expert_2::JEventProcessor_CDC_expert_2() {
116}
117
118
119//----------------------------------------------------------------------------------
120
121
122JEventProcessor_CDC_expert_2::~JEventProcessor_CDC_expert_2() {
123}
124
125
126//----------------------------------------------------------------------------------
127
128jerror_t JEventProcessor_CDC_expert_2::init(void) {
129
130
131 // raw quantities for read out (fa125 new format) are
132 // time field max 2047 scaled x 1, units 0.8ns
133 // time qf field max 1
134 // overflow count field max 7
135 // pedestal field max 255 scaled x 1/1
136 // max amplitude 9 bits field max 511 scaled x 1/8
137 // integral field max 16383 scaled x 1/16
138
139
140 // max values for histogram scales
141
142 const Int_t IMAX = 100000; //max for raw integral
143 const Int_t IPPMAX = 150000; //max for raw integral + pedestal
144 const Int_t PMAX = 256; //max for pedestal, fa125-format, 8 bits
145 const Int_t AMAX = 4096; //max for amplitude, fa125-format, 9 bits * scale factor
146 const Int_t RTMAX = 1800; //max for raw time
147 const Int_t RTMIN = 160;
148 const Int_t RTBINS = 164; //bins
149
150 const Int_t RTVSNMAX = 1024; //raw time vs straw histogram range ends at this value
151
152 const Int_t EMAX = 21000; //max for E histograms, fC
153 // const Int_t EMAX = 21000000; //max for E histograms, fC
154 // E histograms filled with a_scale*gains*(integration-pedestal)
155
156 const Int_t TMAX = 1250; //max for t histograms, ns
157 // t histograms filled with t_scale*(raw-t - offset) + tmin
158 const Int_t TMIN = -250;
159 const Int_t TBINS = 250;
160
161
162 const Int_t NSTRAWS = 3522;
163 const Float_t HALF = 0.5;
164 const Float_t NSTRAWSPH = 3522.5;
165
166 //dead straws: K39 (row 11) and W38 (ring 23)
167
168 Char_t deadstraws[32] = "(#709 and #2384 disconnected)"; //dead
169 Char_t deadrow11[30] = "(#39 disconnected)"; //dead
170 Char_t deadrow23[30] = "(#38 disconnected)"; //dead
171
172
173 // create root folder for cdc and cd to it, store main dir
174 TDirectory *main = gDirectory(TDirectory::CurrentDirectory());
175
176 gDirectory(TDirectory::CurrentDirectory())->mkdir("CDC_expert_2")->cd();
177 TDirectory *xd = gDirectory(TDirectory::CurrentDirectory());
178
179
180 // book histograms
181
182 //number of straws in each ring, starts with 0 so that straws[1] is the number of straws in ring 1
183 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};
184
185
186 cdc_e = new TH1D("cdc_e","CDC charge (fC);charge (fC)",200,0,EMAX);
187 cdc_e_vs_n = new TH2D("cdc_e_vs_n",Form("CDC charge (fC) vs straw number;straw %s;charge (fC)",deadstraws),NSTRAWS,HALF,NSTRAWSPH,100,0,EMAX);
188
189 cdc_e_vs_t = new TH2D("cdc_e_vs_t","CDC charge (fC) vs time (ns);time (ns);charge (fC)",TBINS,TMIN,TMAX,100,0,EMAX);
190
191
192 cdc_t = new TH1D("cdc_t","CDC time (ns);time (ns)",TBINS*2,TMIN,TMAX);
193 cdc_t_vs_n = new TH2D("cdc_t_vs_n",Form("CDC time (ns) vs straw number;straw %s;time (ns)",deadstraws),NSTRAWS,HALF,NSTRAWSPH,TBINS,TMIN,TMAX);
194
195
196 cdc_rt = new TH1D("cdc_rt","CDC raw time (0.8ns);raw time (0.8ns)",RTMAX-RTMIN,RTMIN,RTMAX);
197 cdc_rt_qf0 = new TH1D("cdc_rt_qf0","CDC raw time with qf=0 (0.8ns);raw time (0.8ns)",RTMAX-RTMIN,RTMIN,RTMAX);
198 cdc_rt_vs_n = new TH2D("cdc_rt_vs_n",Form("CDC raw time (0.8ns) vs straw number;straw %s;raw time (0.8ns)",deadstraws),NSTRAWS,HALF,NSTRAWSPH,RTBINS,RTMIN,RTMAX);
199
200
201 cdc_amp = new TH1D("cdc_amp","CDC amplitude;amplitude",256,0,AMAX);
202 cdc_amp_vs_n = new TH2D("cdc_amp_vs_n",Form("CDC time (ns) vs straw number;straw %s;time (ns)",deadstraws),NSTRAWS,HALF,NSTRAWSPH,256,0,AMAX);
203
204
205
206
207
208
209 cdc_int_vs_raw_t = new TH2I("cdc_int_vs_raw_t",Form("CDC integral (ADC units), pedestal subtracted, vs raw time (0.8ns);raw time (0.8ns);integral, pedestal subtracted (ADC units)"),(Int_t)RTBINS,RTMIN,RTMAX,100,0,IMAX);
210
211
212 gDirectory(TDirectory::CurrentDirectory())->mkdir("pedestals_by_roc","CDC Pedestals for each ROC")->cd();
213
214 cdc_initped_roc25 = new TH2I("cdc_initped_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);
215 cdc_initped_roc26 = new TH2I("cdc_initped_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);
216 cdc_initped_roc27 = new TH2I("cdc_initped_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);
217 cdc_initped_roc28 = new TH2I("cdc_initped_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);
218
219 cdc_ped_roc25 = new TH2I("cdc_ped_roc25","CDC pedestal (ADC units) vs slot*100+channel, ROC 25;slot*100 + channel;pedestal",1600,200+HALF,1800+HALF,(Int_t)PMAX/4,0,PMAX);
220 cdc_ped_roc26 = new TH2I("cdc_ped_roc26","CDC pedestal (ADC units) vs slot*100+channel, ROC 26;slot*100 + channel;pedestal",1600,200+HALF,1800+HALF,(Int_t)PMAX/4,0,PMAX);
221 cdc_ped_roc27 = new TH2I("cdc_ped_roc27","CDC pedestal (ADC units) vs slot*100+channel, ROC 27;slot*100 + channel;pedestal",1600,200+HALF,1800+HALF,(Int_t)PMAX/4,0,PMAX);
222 cdc_ped_roc28 = new TH2I("cdc_ped_roc28","CDC pedestal (ADC units) vs slot*100+channel, ROC 28;slot*100 + channel;pedestal",1600,200+HALF,1800+HALF,(Int_t)PMAX/4,0,PMAX);
223
224 xd->cd();
225
226
227 gDirectory(TDirectory::CurrentDirectory())->mkdir("bad_t","CDC Bad time flagged")->cd();
228
229 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);
230 cdc_ped_badt = new TH1I("cdc_ped_badt","CDC pedestal, events with bad time flagged;straw;pedestal",256,0,PMAX);
231 cdc_raw_t_badt = new TH1I("cdc_raw_t_badt",Form("CDC raw time (0.8ns), events with bad time flagged;straw;raw time (0.8ns)"),RTBINS,RTMIN,RTMAX);
232 cdc_amp_badt = new TH1I("cdc_amp_badt","CDC amplitude (ADC units), events with bad time flagged;ADC units",256,0,AMAX);
233 //cdc_int_badt = new TH1I("cdc_int_badt","CDC integral (ADC units), pedestal subtracted, events with bad time flagged;ADC units",100,0,IMAX);
234 //cdc_intpp_badt = new TH1I("cdc_intpp_badt","CDC integral (ADC units), including pedestal, events with bad time flagged;ADC units",128,0,IPPMAX);
235
236 cdc_qf = new TH1D("cdc_qf","CDC time quality factor;time quality factor (0:good, 1:zero, 2:hi ped, 3: below TH, 4:late TCL, 5: neg ups, 9:hi ups)",10,0,10);
237 cdc_qf_vs_n = new TH2D("cdc_qf_vs_n","CDC time quality factor vs straw number;straw;time quality factor",NSTRAWS,HALF,NSTRAWSPH,10,0,10);
238 cdc_qf_vs_a = new TH2D("cdc_qf_vs_a","CDC time quality factor vs amplitude;amplitude;time quality factor",128,0,AMAX,10,0,10);
239 cdc_qf_vs_rt = new TH2D("cdc_qf_vs_raw_t","CDC time quality factor vs raw time;time;time quality factor",RTBINS,RTMIN,RTMAX,10,0,10);
240
241 xd->cd();
242
243
244 gDirectory(TDirectory::CurrentDirectory())->mkdir("overflows","CDC overflow flagged")->cd();
245
246 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);
247 cdc_ped_overflow = new TH1I("cdc_ped_overflow","CDC pedestal, events with ADC overflow;pedestal",256,0,PMAX);
248 cdc_raw_t_overflow = new TH1I("cdc_raw_t_overflow",Form("CDC raw time (0.8ns), events with ADC overflow;raw time (0.8ns)"),RTBINS,RTMIN,RTMAX);
249
250 xd->cd();
251
252
253 Int_t i;
254
255 gDirectory(TDirectory::CurrentDirectory())->mkdir("rings_e_vs_t","CDC rings: charge vs time")->cd();
256 for (i=1; i<29; i++) {
257 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)",TBINS,TMIN,TMAX,100,0,EMAX);
258 }
259 xd->cd();
260
261
262 gDirectory(TDirectory::CurrentDirectory())->mkdir("rings_int_vs_raw_t","CDC rings: integral vs raw time (pedestal subtracted)")->cd();
263 for (i=1; i<29; i++) {
264 cdc_int_vs_raw_t_ring[i] = new TH2I(Form("cdc_int_vs_raw_t_ring[%i]",i),Form("CDC integral (ADC units), pedestal subtracted, vs raw time (0.8ns);raw time (0.8ns);integral, pedestal subtracted (ADC units)"),RTBINS,RTMIN,RTMAX,100,0,IMAX);
265 }
266 xd->cd();
267
268
269 // gDirectory->mkdir("rings_e","CDC rings: charge vs straw")->cd();
270 // for (i=1; i<29; i++) {
271 // 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);
272 // }
273 // xd->cd();
274
275
276 gDirectory(TDirectory::CurrentDirectory())->mkdir("rings_t","CDC rings: time vs straw")->cd();
277 for (i=1; i<29; i++) {
278 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,TBINS,TMIN,TMAX);
279 }
280 cdc_t_ring[11]->GetXaxis()->SetTitle(Form("pedestal %s",deadrow11));
281 cdc_t_ring[23]->GetXaxis()->SetTitle(Form("pedestal %s",deadrow23));
282 xd->cd();
283
284
285 gDirectory(TDirectory::CurrentDirectory())->mkdir("rings_pedestal","CDC rings: pedestal vs straw")->cd();
286 for (i=1; i<29; i++) {
287 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);
288 }
289 cdc_ped_ring[11]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow11));
290 cdc_ped_ring[23]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow23));
291 xd->cd();
292
293
294 gDirectory(TDirectory::CurrentDirectory())->mkdir("rings_initpedestal","CDC rings: initial pedestal from raw window data vs straw")->cd();
295 for (i=1; i<29; i++) {
296 cdc_initped_ring[i] = new TH2I(Form("cdc_initped_ring[%i]",i),Form("CDC initial pedestal (ADC units) from raw window data, ring %i;straw;pedestal",i),straws[i],HALF,straws[i]+HALF,(Int_t)PMAX/2,0,PMAX);
297 }
298 cdc_initped_ring[11]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow11));
299 cdc_initped_ring[23]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow23));
300 xd->cd();
301
302
303
304 gDirectory(TDirectory::CurrentDirectory())->mkdir("rings_raw_t","CDC rings: raw time vs straw")->cd();
305 for (i=1; i<29; i++) {
306 cdc_raw_t_ring[i] = new TH2I(Form("cdc_raw_t_ring[%i]",i),Form("CDC raw time (0.8ns), ring %i;straw;raw time (0.8ns)",i),straws[i],HALF,straws[i]+HALF,256,0,RTVSNMAX);
307 }
308 cdc_raw_t_ring[11]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow11));
309 cdc_raw_t_ring[23]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow23));
310 xd->cd();
311
312
313 gDirectory(TDirectory::CurrentDirectory())->mkdir("rings_amp","CDC rings: amplitude")->cd();
314 for (i=1; i<29; i++) {
315 cdc_amp_ring[i] = new TH2I(Form("cdc_amp_ring[%i]",i),Form("CDC amplitude (ADC units), ring %i",i),straws[i],HALF,straws[i]+HALF,256,0,AMAX);
316 }
317 cdc_amp_ring[11]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow11));
318 cdc_amp_ring[23]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow23));
319 xd->cd();
320
321
322 // gDirectory->mkdir("rings_integral","CDC rings: integral vs straw (pedestal subtracted)")->cd();
323 // for (i=1; i<29; i++) {
324 // cdc_int_ring[i] = new TH2I(Form("cdc_int_ring[%i]",i),Form("CDC integral (ADC units), pedestal subtracted, ring %i",i),straws[i],HALF,straws[i]+HALF,128,0,IMAX);
325 // }
326 // xd->cd();
327
328
329 gDirectory(TDirectory::CurrentDirectory())->mkdir("rings_integral_incl_ped","CDC rings: integral vs straw (including pedestal)")->cd();
330 for (i=1; i<29; i++) {
331 cdc_intpp_ring[i] = new TH2I(Form("cdc_intpp_ring[%i]",i),Form("CDC integral (ADC units), including pedestal, ring %i",i),straws[i],HALF,straws[i]+HALF,100,0,IPPMAX);
332 }
333 cdc_intpp_ring[11]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow11));
334 cdc_intpp_ring[23]->GetXaxis()->SetTitle(Form("Straw number, %s",deadrow23));
335
336
337 main->cd(); // back to main dir
338
339 return NOERROR;
340
341
342}
343
344
345//----------------------------------------------------------------------------------
346
347
348jerror_t JEventProcessor_CDC_expert_2::brun(JEventLoop *eventLoop, int32_t runnumber) {
349 // This is called whenever the run number changes
350
351 return NOERROR;
352
353}
354
355
356//----------------------------------------------------------------------------------
357
358
359jerror_t JEventProcessor_CDC_expert_2::evnt(JEventLoop *eventLoop, uint64_t eventnumber) {
360 // This is called for every event. Use of common resources like writing
361 // to a file or filling a histogram should be mutex protected. Using
362 // loop-Get(...) to get reconstructed objects (and thereby activating the
363 // reconstruction algorithm) should be done outside of any mutex lock
364 // since multiple threads may call this method at the same time.
365
366 float q,t; // dcdchits quantities charge, time
367
368 uint32_t rocid;
369 uint32_t slot;
370 uint32_t channel;
371
372 uint16_t ring,straw; // ring and straw numbers from either dcdchits or dcdcdigihits
373 uint16_t n; // straw number, 1 to 3522
374
375 uint32_t qf,ocount; // time quality factor and overflow count from new firmware
376 uint32_t rt,p,a; // dcdcdigihits raw quantities: time, pedestal, amplitude, quality factor, overflow count
377 uint32_t integral; // dcdcdigihits integral, includes pedestal
378 uint32_t integ; // dcdcdigihits integral minus pedestal
379
380 uint16_t originalq; //last digit of le_time if qf=1
381
382 uint32_t total_ped; //total pedestal during integration period
383 uint32_t initped; //pedestal calculated from WRD at start of window
384
385 // default scaling factors will be overridden by Df125Config if present
386 uint16_t ISCALE = 16; //scaling factor for integral
387 uint16_t ASCALE = 8; //amplitude
388 uint16_t PSCALE = 1; //ped
389 uint16_t NW = 200;
390 uint16_t IE = 200;
391
392
393 const uint16_t NPEDSAMPLES=16; //number of samples to use for initial pedestal initped calculated from window raw data if present
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 //first set of histograms is for dcdchits, these are t and q after calibration
400 //second set is for dcdcdigihits, these are the raw quantities
401
402 // get hit data for cdc
403 vector<const DCDCHit*> hits;
404 eventLoop->Get(hits);
405
406 // get raw data for cdc
407 vector<const DCDCDigiHit*> digihits;
408 eventLoop->Get(digihits);
409
410
411 // FILL HISTOGRAMS
412 // Since we are filling histograms local to this plugin, it will not interfere with other ROOT operations: can use plugin-wide ROOT fill lock
413 japp->RootFillLock(this); //ACQUIRE ROOT FILL LOCK
414
415
416 for (uint32_t i=0; i<hits.size(); i++) {
417
418 const DCDCHit *hit = hits[i];
419
420 if (hit->q>0.0) {
421
422 q = hit->q; // in fC
423 t = hit->t; // in nanoseconds
424 ring = hit->ring;
425 straw = hit->straw;
426
427 n = straw_offset[ring] + straw;
428
429 if (q > 0.0) {
430 cdc_e->Fill(q);
431 cdc_e_vs_n->Fill(n,q);
432 }
433
434 cdc_t->Fill(t);
435 cdc_t_vs_n->Fill(n,t);
436
437 cdc_e_vs_t->Fill(t,q);
438 cdc_e_vs_t_ring[ring]->Fill(t,q);
439
440 //cdc_e_ring[ring]->Fill(straw,q);
441 cdc_t_ring[ring]->Fill(straw,t);
442 }
443 }
444
445
446
447 const DCDCDigiHit *digihit = NULL__null;
448 const Df125CDCPulse *cp = NULL__null;
449 const Df125WindowRawData *wrd = NULL__null;
450 const Df125Config *cf = NULL__null;
451
452 for (uint32_t i=0; i<digihits.size(); i++) {
453
454 digihit = digihits[i];
455
456 ring = digihit->ring;
457 straw = digihit->straw;
458
459 n = straw_offset[ring] + straw;
460
461
462 total_ped = 0;
Value stored to 'total_ped' is never read
463 originalq = 0;
464
465
466 //new firmware uses Df125CDCPulseData
467
468 cp = NULL__null;
469 digihit->GetSingle(cp);
470
471 if (!cp) continue; //no CDCPulseData (happens occasionally)
472
473 cp->GetSingle(cf);
474 if (cf) {
475 ISCALE = 1<<cf->IBIT;
476 ASCALE = 1<<cf->ABIT;
477 PSCALE = 1<<cf->PBIT;
478
479 NW = cf->NW;
480 IE = cf->IE;
481
482 }
483
484 rocid = cp->rocid;
485 slot = cp->slot;
486 channel = cp->channel;
487
488 rt = cp->le_time;
489 qf = cp->time_quality_bit;
490 ocount = cp->overflow_count;
491
492 a = ASCALE*cp->first_max_amp;
493 p = PSCALE*cp->pedestal;
494 integral = ISCALE*cp->integral;
495
496
497 int lastsample = NW-20-1; //eg sample 179 is the last sample integrated for NW=200
498 int timesample = int(0.1*rt);
499 if (timesample+IE < lastsample) lastsample = timesample+IE;
500
501 int pulselength = 1 + lastsample - timesample;
502
503 integ = integral - p*pulselength;
504
505 if (qf==0) {
506
507 originalq = 0;
508
509 cdc_rt_qf0->Fill(rt);
510
511 } else {
512
513 originalq = rt - 10*int(0.1*rt);
514
515 cdc_qf_vs_n->Fill(n,originalq);
516 cdc_qf_vs_a->Fill(a,originalq);
517 cdc_qf_vs_rt->Fill(rt,originalq);
518
519 cdc_o_badt->Fill(straw,ring);
520 cdc_ped_badt->Fill(p);
521 cdc_raw_t_badt->Fill(rt);
522 cdc_amp_badt->Fill(a);
523
524 //cdc_int_badt->Fill(integ);
525 //cdc_intpp_badt->Fill(integral);
526
527 }
528
529 cdc_qf->Fill(originalq);
530
531 cdc_rt->Fill(rt);
532 cdc_rt_vs_n->Fill(n,rt);
533
534 cdc_amp->Fill(a);
535 cdc_amp_vs_n->Fill(n,a);
536
537 cdc_int_vs_raw_t->Fill(rt,integ);
538 cdc_int_vs_raw_t_ring[ring]->Fill(rt,integ);
539
540 cdc_ped_ring[ring]->Fill(straw,p);
541 cdc_raw_t_ring[ring]->Fill(straw,rt);
542 cdc_amp_ring[ring]->Fill(straw,a); //no ped subtraction
543 //cdc_int_ring[ring]->Fill(straw,integ);
544 cdc_intpp_ring[ring]->Fill(straw,integral);
545
546
547
548 if (ocount>0) { // overflow samples present
549 cdc_o_overflow->Fill(straw,ring);
550 cdc_ped_overflow->Fill(p);
551 cdc_raw_t_overflow->Fill(rt);
552 }
553
554
555 if (rocid == 25) cdc_ped_roc25->Fill(100*slot + channel,p);
556 if (rocid == 26) cdc_ped_roc26->Fill(100*slot + channel,p);
557 if (rocid == 27) cdc_ped_roc27->Fill(100*slot + channel,p);
558 if (rocid == 28) cdc_ped_roc28->Fill(100*slot + channel,p);
559
560
561 // initial pedestals from window raw data samples if available
562
563 wrd = NULL__null;
564 cp->GetSingle(wrd);
565 if (!wrd) continue;
566
567
568 initped=0;
569
570 if (wrd->samples.size()>=NPEDSAMPLES) {
571
572 for (uint16_t j=0; j<NPEDSAMPLES; j++) initped += (uint32_t)wrd->samples[j];
573
574 initped = (uint32_t)initped/16.0;
575
576 if (initped > 0) {
577
578 if (rocid == 25) cdc_initped_roc25->Fill(100*slot + channel,initped);
579 if (rocid == 26) cdc_initped_roc26->Fill(100*slot + channel,initped);
580 if (rocid == 27) cdc_initped_roc27->Fill(100*slot + channel,initped);
581 if (rocid == 28) cdc_initped_roc28->Fill(100*slot + channel,initped);
582
583 }
584
585 }
586
587 if (initped) cdc_initped_ring[ring]->Fill(straw,initped);
588
589 } //end for each digihit
590
591
592 japp->RootFillUnLock(this); //RELEASE ROOT FILL LOCK
593
594
595 return NOERROR;
596}
597
598
599//----------------------------------------------------------------------------------
600
601
602jerror_t JEventProcessor_CDC_expert_2::erun(void) {
603 // This is called whenever the run number changes, before it is
604 // changed to give you a chance to clean up before processing
605 // events from the next run number.
606 return NOERROR;
607}
608
609
610//----------------------------------------------------------------------------------
611
612
613jerror_t JEventProcessor_CDC_expert_2::fini(void) {
614 // Called before program exit after event processing is finished.
615 return NOERROR;
616}
617
618
619//----------------------------------------------------------------------------------
620//----------------------------------------------------------------------------------