Bug Summary

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