Bug Summary

File:plugins/monitoring/BCAL_LED_time/JEventProcessor_BCAL_LED_time.cc
Location:line 517, column 3
Description:Value stored to 'ledup_mean' is never read

Annotated Source Code

1// $Id$
2//
3// File: JEventProcessor_BCAL_LED_time.cc
4//
5
6
7#include "JEventProcessor_BCAL_LED_time.h"
8
9
10//----------------------------------------------------------------------------------
11
12// string make_filename( const string& basename, int index, const string& ext )
13// {
14// ostringstream result;
15// result << basename << index << ext;
16// return result.str();
17// }
18
19
20// Routine used to create our JEventProcessor
21extern "C"{
22 void InitPlugin(JApplication *app){
23 InitJANAPlugin(app);
24 app->AddProcessor(new JEventProcessor_BCAL_LED_time());
25 }
26
27}
28
29
30//----------------------------------------------------------------------------------
31
32
33JEventProcessor_BCAL_LED_time::JEventProcessor_BCAL_LED_time() {
34}
35
36
37//----------------------------------------------------------------------------------
38
39
40JEventProcessor_BCAL_LED_time::~JEventProcessor_BCAL_LED_time() {
41}
42
43
44//----------------------------------------------------------------------------------
45
46jerror_t JEventProcessor_BCAL_LED_time::init(void) {
47
48 // lock all root operations
49 japp->RootWriteLock();
50
51 // First thread to get here makes all histograms. If one pointer is
52 // already not NULL, assume all histograms are defined and return now
53 if(bcal_time_vevent != NULL__null){
54 japp->RootUnLock();
55 return NOERROR;
56 }
57
58 //NOtrig=0; FPtrig=0; GTPtrig=0; FPGTPtrig=0; trigUS=0; trigDS=0; trigCosmic=0;
59 //low_down_1_counter=0; low_down_2_counter=0; low_down_3_counter=0; low_down_4_counter=0; low_up_1_counter=0; low_up_2_counter=0; low_up_3_counter=0; low_up_4_counter=0; high_down_1_counter=0; high_down_2_counter=0; high_down_3_counter=0; high_down_4_counter=0; high_up_1_counter=0;
60 //high_up_2_counter=0; high_up_3_counter=0; high_up_4_counter=0;
61 //unidentified = 0; ledcounter = 0;
62
63 adccount1 = 1100;
64 adccount2 = 1200;
65
66
67 maxnumberofevents=700000000.0;//Assuming 1Hz LED trigger, 300M for a beam run with 30KHz trigger and 700M for 70KHz
68 //maxnumberofevents=10000.0;//using LED event conter
69 nbins=24002;//Assuming 1Hz LED trigger, 10K for a beam run with 30KHz trigger and 24K for 70KHz
70 //nbins=375002;//Based on cosmic run with 800Hz trigger and 1Hz LED trigger
71 //nbins=3750002;//Based on cosmic run with 800Hz trigger and 10Hz LED trigger
72
73
74 //overflow=0; underflow=0; negatives=0; zeros=0;
75
76 // create root folder for bcal and cd to it, store main dir
77 TDirectory *main = gDirectory(TDirectory::CurrentDirectory());
78 gDirectory(TDirectory::CurrentDirectory())->mkdir("BCAL_LED_time")->cd();
79 //gStyle->SetOptStat(111110);
80
81
82
83 bcal_time_vevent = new TProfile("bcal_time_vevent","Avg BCAL time vs event;event num;time (all chan avg)",nbins,0.0,maxnumberofevents);
84
85 up_time_vevent = new TProfile("up_time_vevent","Avg BCAL time vs event;event num;time (all upstream chan avg)",nbins,0.0,maxnumberofevents);
86 down_time_vevent = new TProfile("down_time_vevent","Avg BCAL time vs event;event num;time (all downstream chan avg)",nbins,0.0,maxnumberofevents);
87
88 column1_time_vevent = new TProfile("column1_time_vevent","Avg BCAL time vs event;event num;time (all column 1 chan avg)",nbins,0.0,maxnumberofevents);
89 column2_time_vevent = new TProfile("column2_time_vevent","Avg BCAL time vs event;event num;time (all column 2 chan avg)",nbins,0.0,maxnumberofevents);
90 column3_time_vevent = new TProfile("column3_time_vevent","Avg BCAL time vs event;event num;time (all column 3 chan avg)",nbins,0.0,maxnumberofevents);
91 column4_time_vevent = new TProfile("column4_time_vevent","Avg BCAL time vs event;event num;time (all column 4 chan avg)",nbins,0.0,maxnumberofevents);
92
93 column1_up_peak_vevent = new TProfile("column1_up_peak_vevent","Avg BCAL peak vs event;event num;peak (all column 1 up chan avg)",nbins,0.0,maxnumberofevents);
94 column2_up_peak_vevent = new TProfile("column2_up_peak_vevent","Avg BCAL peak vs event;event num;peak (all column 2 up chan avg)",nbins,0.0,maxnumberofevents);
95 column3_up_peak_vevent = new TProfile("column3_up_peak_vevent","Avg BCAL peak vs event;event num;peak (all column 3 up chan avg)",nbins,0.0,maxnumberofevents);
96 column4_up_peak_vevent = new TProfile("column4_up_peak_vevent","Avg BCAL peak vs event;event num;peak (all column 4 up chan avg)",nbins,0.0,maxnumberofevents);
97 column1_down_peak_vevent = new TProfile("column1_down_peak_vevent","Avg BCAL peak vs event;event num;peak (all column 1 down chan avg)",nbins,0.0,maxnumberofevents);
98 column2_down_peak_vevent = new TProfile("column2_down_peak_vevent","Avg BCAL peak vs event;event num;peak (all column 2 down chan avg)",nbins,0.0,maxnumberofevents);
99 column3_down_peak_vevent = new TProfile("column3_down_peak_vevent","Avg BCAL peak vs event;event num;peak (all column 3 down chan avg)",nbins,0.0,maxnumberofevents);
100 column4_down_peak_vevent = new TProfile("column4_down_peak_vevent","Avg BCAL peak vs event;event num;peak (all column 4 down chan avg)",nbins,0.0,maxnumberofevents);
101
102 column1_up_time_vevent1 = new TProfile("column1_up_time_vevent1","Avg BCAL time vs event;event num;time (all column 1 up chan avg)",nbins,0.0,maxnumberofevents);
103 column1_down_time_vevent1 = new TProfile("column1_down_time_vevent1","Avg BCAL time vs event;event num;time (all column 1 down chan avg)",nbins,0.0,maxnumberofevents);
104 column1_up_time_vevent2 = new TProfile("column1_up_time_vevent2","Avg BCAL time vs event;event num;time (all column 1 up chan avg)",nbins,0.0,maxnumberofevents);
105 column1_down_time_vevent2 = new TProfile("column1_down_time_vevent2","Avg BCAL time vs event;event num;time (all column 1 up chan avg)",nbins,0.0,maxnumberofevents);
106 column1_up_time_vevent3 = new TProfile("column1_up_time_vevent3","Avg BCAL time vs event;event num;time (all column 1 up chan avg)",nbins,0.0,maxnumberofevents);
107 column1_down_time_vevent3 = new TProfile("column1_down_time_vevent3","Avg BCAL time vs event;event num;time (all column 1 up chan avg)",nbins,0.0,maxnumberofevents);
108 column1_up_time_vevent4 = new TProfile("column1_up_time_vevent4","Avg BCAL time vs event;event num;time (all column 1 up chan avg)",nbins,0.0,maxnumberofevents);
109 column1_down_time_vevent4 = new TProfile("column1_down_time_vevent4","Avg BCAL time vs event;event num;time (all column 1 up chan avg)",nbins,0.0,maxnumberofevents);
110
111 column2_up_time_vevent1 = new TProfile("column2_up_time_vevent1","Avg BCAL time vs event;event num;time (all column 2 up chan avg)",nbins,0.0,maxnumberofevents);
112 column2_down_time_vevent1 = new TProfile("column2_down_time_vevent1","Avg BCAL time vs event;event num;time (all column 2 down chan avg)",nbins,0.0,maxnumberofevents);
113 column2_up_time_vevent2 = new TProfile("column2_up_time_vevent2","Avg BCAL time vs event;event num;time (all column 2 up chan avg)",nbins,0.0,maxnumberofevents);
114 column2_down_time_vevent2 = new TProfile("column2_down_time_vevent2","Avg BCAL time vs event;event num;time (all column 2 up chan avg)",nbins,0.0,maxnumberofevents);
115 column2_up_time_vevent3 = new TProfile("column2_up_time_vevent3","Avg BCAL time vs event;event num;time (all column 2 up chan avg)",nbins,0.0,maxnumberofevents);
116 column2_down_time_vevent3 = new TProfile("column2_down_time_vevent3","Avg BCAL time vs event;event num;time (all column 2 up chan avg)",nbins,0.0,maxnumberofevents);
117 column2_up_time_vevent4 = new TProfile("column2_up_time_vevent4","Avg BCAL time vs event;event num;time (all column 2 up chan avg)",nbins,0.0,maxnumberofevents);
118 column2_down_time_vevent4 = new TProfile("column2_down_time_vevent4","Avg BCAL time vs event;event num;time (all column 2 up chan avg)",nbins,0.0,maxnumberofevents);
119
120 column3_up_time_vevent1 = new TProfile("column3_up_time_vevent1","Avg BCAL time vs event;event num;time (all column 3 up chan avg)",nbins,0.0,maxnumberofevents);
121 column3_down_time_vevent1 = new TProfile("column3_down_time_vevent1","Avg BCAL time vs event;event num;time (all column 3 down chan avg)",nbins,0.0,maxnumberofevents);
122 column3_up_time_vevent2 = new TProfile("column3_up_time_vevent2","Avg BCAL time vs event;event num;time (all column 3 up chan avg)",nbins,0.0,maxnumberofevents);
123 column3_down_time_vevent2 = new TProfile("column3_down_time_vevent2","Avg BCAL time vs event;event num;time (all column 3 up chan avg)",nbins,0.0,maxnumberofevents);
124 column3_up_time_vevent3 = new TProfile("column3_up_time_vevent3","Avg BCAL time vs event;event num;time (all column 3 up chan avg)",nbins,0.0,maxnumberofevents);
125 column3_down_time_vevent3 = new TProfile("column3_down_time_vevent3","Avg BCAL time vs event;event num;time (all column 3 up chan avg)",nbins,0.0,maxnumberofevents);
126 column3_up_time_vevent4 = new TProfile("column3_up_time_vevent4","Avg BCAL time vs event;event num;time (all column 3 up chan avg)",nbins,0.0,maxnumberofevents);
127 column3_down_time_vevent4 = new TProfile("column3_down_time_vevent4","Avg BCAL time vs event;event num;time (all column 3 up chan avg)",nbins,0.0,maxnumberofevents);
128
129 column4_up_time_vevent1 = new TProfile("column4_up_time_vevent1","Avg BCAL time vs event;event num;time (all column 4 up chan avg)",nbins,0.0,maxnumberofevents);
130 column4_down_time_vevent1 = new TProfile("column4_down_time_vevent1","Avg BCAL time vs event;event num;time (all column 4 down chan avg)",nbins,0.0,maxnumberofevents);
131 column4_up_time_vevent2 = new TProfile("column4_up_time_vevent2","Avg BCAL time vs event;event num;time (all column 4 up chan avg)",nbins,0.0,maxnumberofevents);
132 column4_down_time_vevent2 = new TProfile("column4_down_time_vevent2","Avg BCAL time vs event;event num;time (all column 4 up chan avg)",nbins,0.0,maxnumberofevents);
133 column4_up_time_vevent3 = new TProfile("column4_up_time_vevent3","Avg BCAL time vs event;event num;time (all column 4 up chan avg)",nbins,0.0,maxnumberofevents);
134 column4_down_time_vevent3 = new TProfile("column4_down_time_vevent3","Avg BCAL time vs event;event num;time (all column 4 up chan avg)",nbins,0.0,maxnumberofevents);
135 column4_up_time_vevent4 = new TProfile("column4_up_time_vevent4","Avg BCAL time vs event;event num;time (all column 4 up chan avg)",nbins,0.0,maxnumberofevents);
136 column4_down_time_vevent4 = new TProfile("column4_down_time_vevent4","Avg BCAL time vs event;event num;time (all column 4 up chan avg)",nbins,0.0,maxnumberofevents);
137
138
139
140 low_up_1 = new TProfile("low_bias_up_column_1_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-4,1536);
141 low_up_2 = new TProfile("low_bias_up_column_2_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-3,1537);
142 low_up_3 = new TProfile("low_bias_up_column_3_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-2,1538);
143 low_up_4 = new TProfile("low_bias_up_column_4_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-1,1539);
144
145 low_down_1 = new TProfile("low_bias_down_column_1_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-4,1536);
146 low_down_2 = new TProfile("low_bias_down_column_2_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-3,1537);
147 low_down_3 = new TProfile("low_bias_down_column_3_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-2,1538);
148 low_down_4 = new TProfile("low_bias_down_column_4_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-1,1539);
149
150 low_up = new TProfile("low_bias_up_time_vchannel","Low bias up - Diff time vs channel;channel ID;time",768,0,768);
151 low_down = new TProfile("low_bias_down_time_vchannel","Low bias down - Diff time vs channel;channel ID;time",768,0,768);
152
153 high_up_1 = new TProfile("high_bias_up_column_1_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-4,1536);
154 high_up_2 = new TProfile("high_bias_up_column_2_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-3,1537);
155 high_up_3 = new TProfile("high_bias_up_column_3_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-2,1538);
156 high_up_4 = new TProfile("high_bias_up_column_4_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-1,1539);
157
158 high_down_1 = new TProfile("high_bias_down_column_1_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-4,1536);
159 high_down_2 = new TProfile("high_bias_down_column_2_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-3,1537);
160 high_down_3 = new TProfile("high_bias_down_column_3_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-2,1538);
161 high_down_4 = new TProfile("high_bias_down_column_4_time_vchannel","Avg BCAL time vs channel;channel ID;time",386,-1,1539);
162
163 high_up = new TProfile("high_bias_up_time_vchannel","High bias up - Diff time vs channel;channel ID;time",768,0,768);
164 high_down = new TProfile("high_bias_down_time_vchannel","High bias down - Diff time vs channel;channel ID;time",768,0,768);
165
166#if ROOT_VERSION_CODE(((6) << 16) + ((8) << 8) + (6)) >= ROOT_VERSION(6,0,0)(((6) << 16) + ((0) << 8) + (0))
167
168 bcal_time_vevent->SetCanExtend(TH1::kXaxis);
169
170 up_time_vevent->SetCanExtend(TH1::kXaxis);
171 down_time_vevent->SetCanExtend(TH1::kXaxis);
172
173 column1_time_vevent->SetCanExtend(TH1::kXaxis);
174 column2_time_vevent->SetCanExtend(TH1::kXaxis);
175 column3_time_vevent->SetCanExtend(TH1::kXaxis);
176 column4_time_vevent->SetCanExtend(TH1::kXaxis);
177
178 column1_up_peak_vevent->SetCanExtend(TH1::kXaxis);
179 column2_up_peak_vevent->SetCanExtend(TH1::kXaxis);
180 column3_up_peak_vevent->SetCanExtend(TH1::kXaxis);
181 column4_up_peak_vevent->SetCanExtend(TH1::kXaxis);
182 column1_down_peak_vevent->SetCanExtend(TH1::kXaxis);
183 column2_down_peak_vevent->SetCanExtend(TH1::kXaxis);
184 column3_down_peak_vevent->SetCanExtend(TH1::kXaxis);
185 column4_down_peak_vevent->SetCanExtend(TH1::kXaxis);
186
187 //////////////////////////////////////////////////////////////////////
188#else
189 bcal_time_vevent->SetBit(TH1::kCanRebin);
190
191 up_time_vevent->SetBit(TH1::kCanRebin);
192 down_time_vevent->SetBit(TH1::kCanRebin);
193
194 column1_time_vevent->SetBit(TH1::kCanRebin);
195 column2_time_vevent->SetBit(TH1::kCanRebin);
196 column3_time_vevent->SetBit(TH1::kCanRebin);
197 column4_time_vevent->SetBit(TH1::kCanRebin);
198
199 column1_up_peak_vevent->SetBit(TH1::kCanRebin);
200 column2_up_peak_vevent->SetBit(TH1::kCanRebin);
201 column3_up_peak_vevent->SetBit(TH1::kCanRebin);
202 column4_up_peak_vevent->SetBit(TH1::kCanRebin);
203 column1_down_peak_vevent->SetBit(TH1::kCanRebin);
204 column2_down_peak_vevent->SetBit(TH1::kCanRebin);
205 column3_down_peak_vevent->SetBit(TH1::kCanRebin);
206 column4_down_peak_vevent->SetBit(TH1::kCanRebin);
207
208 /////////////////////////////////////////////////////////
209#endif
210
211 h2_ledboth_Tall_vs_event = new TProfile("h2_ledboth_Tall_vs_event", "LED uboth - Tup and Tdown vs event", 20000,0,200000000);
212 h2_ledboth_sector_vs_event = new TProfile("h2_ledboth_sector_vs_event", "LED both - sector vs event", 20000,0,200000000);
213 h1_ledall_layer = new TH1I("h1_ledall_layer", "LED ALL - layer", 5,0,5);
214 h1_led0_layer = new TH1I("h1_led0_layer", "LED No bit - layer", 5,0,5);
215
216 h1_ledup_layer = new TH1I("h1_ledup_layer", "LED up - layer", 5,0,5);
217 h1_ledup_sector = new TH1I("h1_ledup_sector", "LED up - sector", 50,0,5);
218 h2_ledup_z_vs_cellid = new TH2I("h2_ledup_z_vs_cellid", "LED up - z vs Chan ID", 800,0,800,500,-100,400);
219 h1_ledup_sector_config = new TH1I("h1_ledup_sector_config", "LED up - sector -config", 5,0,5);
220 h1_ledup_z_all = new TH1I("h1_ledup_z_all", "LED up - z all channels", 500,-100,400);
221 h1_ledup_Tdiff_all = new TH1I("h1_ledup_Tdiff_all", "LED up - Tdiff all channels", 400,-50,50);
222 h1_ledup_Tup_all = new TH1I("h1_ledup_Tup_all", "LED up - Tup all channels", 410,0,410);
223 h1_ledup_Tdown_all = new TH1I("h1_ledup_Tdown_all", "LED up - Tdown all channels", 410,0,410);
224 h2_ledup_Tup_vs_z = new TH2I("h2_ledup_Tup_vs_z", "LED up - Tup vs z", 100,-100,400,410,0,410);
225 h2_ledup_Tdown_vs_z = new TH2I("h2_ledup_Tdown_vs_z", "LED up - Tdown vs z", 100,-100,400,410,0,410);
226 h2_ledup_Tup_vs_event = new TProfile("h2_ledup_Tup_vs_event", "LED up - Tup vs event", 20000,0,200000000);
227 h2_ledup_Tdown_vs_event = new TProfile("h2_ledup_Tdown_vs_event", "LED up - Tdown vs event", 20000,0,200000000);
228 h2_ledup_Tall_vs_event = new TProfile("h2_ledup_Tall_vs_event", "LED up - Tup and Tdown vs event", 20000,0,200000000);
229 h2_ledup_sector_vs_event = new TProfile("h2_ledup_sector_vs_event", "LED up - sector vs event", 20000,0,200000000);
230
231 h1_leddown_layer = new TH1I("h1_leddown_layer", "LED down - layer", 5,0,5);
232 h1_leddown_sector = new TH1I("h1_leddown_sector", "LED down - sector", 50,0,5);
233 h2_leddown_z_vs_cellid = new TH2I("h2_leddown_z_vs_cellid", "LED down - z vs Chan ID", 800,0,800,500,-100,400);
234 h1_leddown_sector_config = new TH1I("h1_leddown_sector_config", "LED down - sector -config", 5,0,5);
235 h1_leddown_z_all = new TH1I("h1_leddown_z_all", "LED down - z all channels", 500,-100,400);
236 h1_leddown_Tdiff_all = new TH1I("h1_leddown_Tdiff_all", "LED down - Tdiff all channels", 400,-50,50);
237 h1_leddown_Tup_all = new TH1I("h1_leddown_Tup_all", "LED down - Tup all channels", 410,0,410);
238 h1_leddown_Tdown_all = new TH1I("h1_leddown_Tdown_all", "LED down - Tdown all channels", 410,0,410);
239 h2_leddown_Tup_vs_z = new TH2I("h2_leddown_Tup_vs_z", "LED down - Tup vs z", 100,-100,400,410,0,410);
240 h2_leddown_Tdown_vs_z = new TH2I("h2_leddown_Tdown_vs_z", "LED down - Tdown vs z", 100,-100,400,410,0,410);
241 h2_leddown_Tup_vs_event = new TProfile("h2_leddown_Tup_vs_event", "LED down - Tup vs event", 20000,0,200000000);
242 h2_leddown_Tdown_vs_event = new TProfile("h2_leddown_Tdown_vs_event", "LED down - Tdown vs event", 20000,0,200000000);
243 h2_leddown_Tall_vs_event = new TProfile("h2_leddown_Tall_vs_event", "LED down - Tup and Tdown vs event", 20000,0,200000000);
244 h2_leddown_sector_vs_event = new TProfile("h2_leddown_sector_vs_event", "LED down - sector vs event", 20000,0,200000000);
245
246 // back to main dir
247 main->cd();
248
249 // unlock
250 japp->RootUnLock();
251
252
253 return NOERROR;
254}
255
256
257//----------------------------------------------------------------------------------
258
259
260jerror_t JEventProcessor_BCAL_LED_time::brun(JEventLoop *eventLoop, int32_t runnumber) {
261 // This is called whenever the run number changes
262 return NOERROR;
263}
264
265
266//----------------------------------------------------------------------------------
267
268
269jerror_t JEventProcessor_BCAL_LED_time::evnt(JEventLoop *loop, uint64_t eventnumber) {
270 // This is called for every event. Use of common resources like writing
271 // to a file or filling a histogram should be mutex protected. Using
272 // loop-Get(...) to get reconstructed objects (and thereby activating the
273 // reconstruction algorithm) should be done outside of any mutex lock
274 // since multiple threads may call this method at the same time.
275
276 int chcounter[1536] = { 0 } ;
277
278
279 vector<const DBCALDigiHit*> bcaldigihits;
280
281 vector <const DBCALHit*> hitVector;
282
283 vector<const DBCALHit*> dbcalhits;
284 vector<const DBCALPoint*> dbcalpoints;
285
286
287 bool LED_US=0, LED_DS=0;
288 bool LED_0=0;
289
290 const DL1Trigger *trig = NULL__null;
291 try {
292 loop->GetSingle(trig);
293 } catch (...) {}
294 if (trig) {
295
296 if (trig->trig_mask){
297 // GTP tigger
298 //GTPtrig++;
299 }
300 if (trig->fp_trig_mask){
301 // Front panel trigger
302 //FPtrig++;
303 }
304 if (trig->trig_mask && trig->fp_trig_mask){
305 // Both GTP and front panel trigger
306 //FPGTPtrig++;
307 }
308 if (trig->trig_mask & 0x1){
309 // Cosmic trigger fired
310 //trigCosmic++;
311 }
312 if (trig->fp_trig_mask & 0x100){
313 // Upstream LED trigger fired
314 //trigUS++;
315 LED_US=1;
316
317 }
318 if (trig->fp_trig_mask & 0x200){
319 // Downstream LED trigger fired
320 //trigDS++;
321 LED_DS=1;
322
323 }
324 } else {
325 //NOtrig++;
326 }
327 // Lock ROOT
328 japp->RootWriteLock();
329
330 float ledup_sector = 0;
331 int ledup_sector_int = 0;
332 float ledup_mean = 0;
333 int ledup_events = 0;
334 float leddown_sector = 0;
335 int leddown_sector_int = 0;
336 float leddown_mean = 0;
337 int leddown_events = 0;
338 // fill layer histogram
339 loop->Get(dbcalhits);
340 loop->Get(bcaldigihits);
341 loop->Get(dbcalpoints);
342
343 // tag events that did not latch properly. Steal code from Sean's skim program
344
345 double total_bcal_energy = 0.;
346 for(unsigned int i=0; i<dbcalhits.size(); i++) {
347 total_bcal_energy += dbcalhits[i]->E;
348 }
349 if (!(LED_US || LED_DS)) {
350 LED_0 = (dbcalhits.size() >= 200) || (total_bcal_energy > 12.);
351 }
352
353 // use timing difference to decide which trigger should have fired.
354
355 float Tdiff = 0;
356 for( unsigned int i=0; i<dbcalpoints.size(); i++) {
357 dbcalpoints[i]->Get(hitVector);
358 const DBCALHit *Hit1 = hitVector[0];
359 const DBCALHit *Hit2 = hitVector[1];
360 float Tup = 0;
361 float Tdown = 0;
362 if (Hit1->end == DBCALGeometry::kUpstream && Hit2->end == DBCALGeometry::kDownstream) {
363 Tup = Hit1->t_raw;
364 Tdown = Hit2->t_raw;
365 Tdiff += Tdown - Tup;
366 }
367 else if (Hit2->end == DBCALGeometry::kUpstream && Hit1->end == DBCALGeometry::kDownstream){
368 Tup = Hit2->t_raw;
369 Tdown = Hit1->t_raw;
370 Tdiff += Tdown - Tup;
371 }
372 }
373
374 if (LED_0) {
375 if (Tdiff > 0) {
376 LED_US = 1;
377 }
378 else if (Tdiff < 0) { // eliminate Tdiff=0 default
379 LED_DS = 1;
380 }
381 cout << " total_bcal_energy=" << total_bcal_energy << " bcalhits=" << dbcalhits.size() << endl;
382 cout << "LED_US=" << LED_US << " LED_DS=" << LED_DS << " LED_0=" << LED_0 << " Tdiff=" << Tdiff << endl;
383 }
384
385 if (! (LED_US || LED_DS)) {
386 cout << " *** No bit set " << endl;
387 cout << " total_bcal_energy=" << total_bcal_energy << " bcalhits=" << dbcalhits.size() << endl;
388 cout << "LED_US=" << LED_US << " LED_DS=" << LED_DS << " LED_0=" << LED_0 << " Tdiff=" << Tdiff << endl;
389 }
390
391 if (LED_US || LED_DS) {
392
393 float apedsubtime[1536] = { 0. };
394 int apedsubpeak[1536] = { 0 };
395
396 for( unsigned int i=0; i<dbcalpoints.size(); i++) {
397
398 int module = dbcalpoints[i]->module();
399 int layer = dbcalpoints[i]->layer();
400 int sector = dbcalpoints[i]->sector();
401 int cell_id = (module-1)*16 + (layer-1)*4 + sector-1;
402 h1_ledall_layer->Fill(layer);
403 if (LED_0) h1_led0_layer->Fill(layer);
404
405 /*if (layer != 3) {
406 // cout << "*** reject " << " module=" << module << " layer=" << layer << " sector=" << sector << " cell_id=" << cell_id << endl;
407 continue;
408 }*/
409
410 float z = dbcalpoints[i]->z();
411 dbcalpoints[i]->Get(hitVector);
412 const DBCALHit *Hit1 = hitVector[0];
413 const DBCALHit *Hit2 = hitVector[1];
414 // float Aup = dbcalpoints[i]->E_US();
415 // float Adown = dbcalpoints[i]->E_DS();
416 float Aup = 0;
417 float Adown = 0;
418 float Tup = 0;
419 float Tdown = 0;
420 float Tdiff = 0;
421 if (Hit1->end == DBCALGeometry::kUpstream && Hit2->end == DBCALGeometry::kDownstream) {
422 Aup = Hit1->pulse_peak;
423 Adown = Hit2->pulse_peak;
424 Tup = Hit1->t_raw;
425 Tdown = Hit2->t_raw;
426 Tdiff = Tdown - Tup;
427 }
428 else if (Hit2->end == DBCALGeometry::kUpstream && Hit1->end == DBCALGeometry::kDownstream){
429 Aup = Hit2->pulse_peak;
430 Adown = Hit1->pulse_peak;
431 Tup = Hit2->t_raw;
432 Tdown = Hit1->t_raw;
433 Tdiff = Tdown - Tup;
434 }
435
436 // cout << "i=" << i << " m=" << module << " l=" << layer << " s=" << sector << " id=" << cell_id << " Aup=" << Aup << " Adown=" << Adown << " Tup=" << Tup << " Tdown=" << Tdown << " Tdif=" << Tdiff << endl;
437
438 // fill histograms for all channels
439 if (LED_US) {
440 h1_ledup_layer->Fill(layer);
441 h1_ledup_sector->Fill(sector);
442 h1_ledup_z_all->Fill(z);;
443 h2_ledup_z_vs_cellid->Fill(cell_id,z);
444 h1_ledup_Tdiff_all->Fill(Tdiff);;
445 h1_ledup_Tup_all->Fill(Tup);;
446 h1_ledup_Tdown_all->Fill(Tdown);;
447 h2_ledup_Tup_vs_z->Fill(z,Tup);
448 h2_ledup_Tdown_vs_z->Fill(z,Tdown);
449 h2_ledup_Tup_vs_event->Fill(eventnumber,Tup);
450 h2_ledup_Tdown_vs_event->Fill(eventnumber,Tdown);
451 }
452 else if (LED_DS) {
453 h1_leddown_layer->Fill(layer);
454 h1_leddown_sector->Fill(sector);
455 h1_leddown_z_all->Fill(z);
456 h2_leddown_z_vs_cellid->Fill(cell_id,z);
457 h1_leddown_Tdiff_all->Fill(Tdiff);;
458 h1_leddown_Tup_all->Fill(Tup);;
459 h1_leddown_Tdown_all->Fill(Tdown);;
460 h2_leddown_Tup_vs_z->Fill(z,Tup);
461 h2_leddown_Tdown_vs_z->Fill(z,Tdown);
462 h2_leddown_Tup_vs_event->Fill(eventnumber,Tup);
463 h2_leddown_Tdown_vs_event->Fill(eventnumber,Tdown);
464 }
465
466 // make cuts on z for all hits
467 // if ( LED_DS && (z>280 && z<400)) {
468 // cut on Tdiff instead
469 if ( LED_DS && (Tdiff>-30 && Tdiff<-15)) {
470 apedsubpeak[cell_id] = Adown;
471 apedsubtime[cell_id] = Tdown;
472 chcounter[cell_id]++;
473 apedsubpeak[cell_id+768] = Aup;
474 apedsubtime[cell_id+768] = Tup;
475 chcounter[cell_id+768]++;
476 h2_ledboth_Tall_vs_event->Fill(eventnumber,Tup);
477 h2_ledboth_Tall_vs_event->Fill(eventnumber,Tdown);
478 h2_leddown_Tall_vs_event->Fill(eventnumber,Tup);
479 h2_leddown_Tall_vs_event->Fill(eventnumber,Tdown);
480 h2_leddown_sector_vs_event->Fill(eventnumber,sector);
481 h2_ledboth_sector_vs_event->Fill(eventnumber,sector);
482
483 // compute sums
484 leddown_sector += sector;
485 leddown_mean += Aup + Adown;
486 leddown_events++;
487 // cout << "DS - eventnumber=" << eventnumber << " Aup=" << Aup << " Adown=" << Adown << " Tup=" << Tup << " Tdown=" << Tdown << " Tdiff=" << Tdiff << endl;
488
489 } // if condition on z
490
491 //if (LED_US && (z>-100 && z<0)) {
492 if (LED_US && (Tdiff>15 && Tdiff<30)) {
493 apedsubpeak[cell_id] = Adown;
494 apedsubtime[cell_id] = Tdown;
495 chcounter[cell_id]++;
496 apedsubpeak[cell_id+768] = Aup;
497 apedsubtime[cell_id+768] = Tup;
498 chcounter[cell_id+768]++;
499 h2_ledboth_Tall_vs_event->Fill(eventnumber,Tup);
500 h2_ledboth_Tall_vs_event->Fill(eventnumber,Tdown);
501 h2_ledup_Tall_vs_event->Fill(eventnumber,Tup);
502 h2_ledup_Tall_vs_event->Fill(eventnumber,Tdown);
503 h2_ledup_sector_vs_event->Fill(eventnumber,sector);
504 h2_ledboth_sector_vs_event->Fill(eventnumber,sector);
505
506 // compute sums
507 ledup_sector += sector;
508 ledup_mean += Aup + Adown;
509 ledup_events++;
510 // cout << "US - eventnumber=" << eventnumber << " Aup=" << Aup << " Adown=" << Adown << " Tup=" << Tup << " Tdown=" << Tdown << " Tdiff=" << Tdiff << endl;
511 } // if condition on z
512
513 }//loop over bcalhits
514
515 // compute averages
516 ledup_sector_int = ledup_events > 0? ledup_sector/ledup_events + 0.5 : 0;
517 ledup_mean = ledup_events > 0? ledup_mean/(2*ledup_events): 0;
Value stored to 'ledup_mean' is never read
518 leddown_sector_int = leddown_events > 0? leddown_sector/leddown_events + 0.5: 0;
519 leddown_mean = leddown_events > 0? leddown_mean/(2*leddown_events) : 0;
520 if (LED_US) h1_ledup_sector_config->Fill(ledup_sector_int);
521 if (LED_DS) h1_leddown_sector_config->Fill(leddown_sector_int);
522
523 // cout << " ledup_events=" << ledup_events << " ledup_sector_int=" << ledup_sector_int << " ledup_mean=" << ledup_mean << endl;
524 // cout << " leddown_events=" << leddown_events << " ledown_sector=" << leddown_sector_int << " leddown_mean=" << leddown_mean << endl << endl;
525
526
527 // float sector_delta=0.2;
528 for (int chid = 0; chid < 1536; chid++) {
529 // if (chcounter[chid] > 1) continue;
530 if (chcounter[chid] != 1) continue;
531 bcal_time_vevent->Fill(eventnumber,apedsubtime[chid]);
532
533 // fill peak histograms for US/Ds to check for low/high configurations
534 if (LED_US) {
535 up_time_vevent->Fill(eventnumber,apedsubtime[chid]);
536 if (ledup_sector_int == 1 && chid%4+1 == 1) {column1_up_peak_vevent->Fill(eventnumber,apedsubpeak[chid]);}
537 else if (ledup_sector_int == 2 && chid%4+1 == 2) {column2_up_peak_vevent->Fill(eventnumber,apedsubpeak[chid]);}
538 else if (ledup_sector_int == 3 && chid%4+1 == 3) {column3_up_peak_vevent->Fill(eventnumber,apedsubpeak[chid]);}
539 else if (ledup_sector_int == 4 && chid%4+1 == 4) {column4_up_peak_vevent->Fill(eventnumber,apedsubpeak[chid]);}
540 }
541
542 else if (LED_DS) {
543 down_time_vevent->Fill(eventnumber,apedsubtime[chid]);
544 if (leddown_sector_int == 1 && chid%4+1 == 1) {column1_down_peak_vevent->Fill(eventnumber,apedsubpeak[chid]);}
545 else if (leddown_sector_int == 2 && chid%4+1 == 2) {column2_down_peak_vevent->Fill(eventnumber,apedsubpeak[chid]);}
546 else if (leddown_sector_int == 3 && chid%4+1 == 3) {column3_down_peak_vevent->Fill(eventnumber,apedsubpeak[chid]);}
547 else if (leddown_sector_int == 4 && chid%4+1 == 4) {column4_down_peak_vevent->Fill(eventnumber,apedsubpeak[chid]);}
548 }
549
550 // times are used for the undifferentiated histograms.
551 if (ledup_sector_int == 1 && chid%4+1 == 1) {column1_time_vevent->Fill(eventnumber,apedsubtime[chid]);}
552 else if (ledup_sector_int == 2 && chid%4+1 == 2) {column2_time_vevent->Fill(eventnumber,apedsubtime[chid]);}
553 else if (ledup_sector_int == 3 && chid%4+1 == 3) {column3_time_vevent->Fill(eventnumber,apedsubtime[chid]);}
554 else if (ledup_sector_int == 4 && chid%4+1 == 4) {column4_time_vevent->Fill(eventnumber,apedsubtime[chid]);}
555 }//loop over bcalhits
556
557 //Deduce LED pulsing configuration based on average pulse time in BCAL, each side & each column then fill correponding profile.
558 double column1up = 0;
559 double column2up = 0;
560 double column3up = 0;
561 double column4up = 0;
562
563 double column1down = 0;
564 double column2down = 0;
565 double column3down = 0;
566 double column4down = 0;
567
568 column1up = column1_up_peak_vevent->GetBinContent(column1_up_peak_vevent->FindBin(eventnumber));
569 column2up = column2_up_peak_vevent->GetBinContent(column2_up_peak_vevent->FindBin(eventnumber));
570 column3up = column3_up_peak_vevent->GetBinContent(column3_up_peak_vevent->FindBin(eventnumber));
571 column4up = column4_up_peak_vevent->GetBinContent(column4_up_peak_vevent->FindBin(eventnumber));
572
573 column1down = column1_down_peak_vevent->GetBinContent(column1_down_peak_vevent->FindBin(eventnumber));
574 column2down = column2_down_peak_vevent->GetBinContent(column2_down_peak_vevent->FindBin(eventnumber));
575 column3down = column3_down_peak_vevent->GetBinContent(column3_down_peak_vevent->FindBin(eventnumber));
576 column4down = column4_down_peak_vevent->GetBinContent(column4_down_peak_vevent->FindBin(eventnumber));
577
578 // cout << " adccount1=" << adccount1 << " column1up=" << column1up << " column2up=" << column2up << " column3up=" << column3up << " column4up=" << column4up << endl;
579 // cout << " adccount1=" << adccount1 << " column1down=" << column1down << " column2down=" << column2down << " column3down=" << column3down << " column4down=" << column4down << endl << endl;
580
581 // Now categorize according to configuration
582
583 for (int chid = 0; chid < 1536; chid++) {
584 // if (chcounter[chid] > 1) continue;
585 if (chcounter[chid] != 1) continue;
586 if (LED_US) {
587 if (ledup_sector_int == 1 && chid%4+1 == 1) {
588 if (column1up < adccount1) {
589 if (chid < 768) low_up->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
590 // cout << " UP HIST module=" << module << " layer=" << layer << " sector=" << sector << " LED_US=" << LED_US << " LED_DS=" << LED_DS << " Tdiff=" << apedsubtime[chid]-apedsubtime[chid+768] << endl;
591 low_up_1->Fill(chid,apedsubtime[chid]);
592 if (chid < 768) {
593 column1_down_time_vevent2->Fill(eventnumber,apedsubtime[chid]);
594 }
595 else if (chid > 767) {
596 column1_up_time_vevent2->Fill(eventnumber,apedsubtime[chid]);
597 }
598 }
599 else {
600 if (chid < 768) high_up->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
601 high_up_1->Fill(chid,apedsubtime[chid]);
602 if (chid < 768) {
603 column1_down_time_vevent4->Fill(eventnumber,apedsubtime[chid]);
604 }
605 else if (chid > 767) {
606 column1_up_time_vevent4->Fill(eventnumber,apedsubtime[chid]);
607 }
608 }
609 }
610 else if (ledup_sector_int == 2 && chid%4+1 == 2) {
611 if (column2up < adccount1) {
612 if (chid < 768) low_up->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
613 low_up_2->Fill(chid,apedsubtime[chid]);
614 if (chid < 768) {
615 column2_down_time_vevent2->Fill(eventnumber,apedsubtime[chid]);
616 }
617 else if (chid > 767) {
618 column2_up_time_vevent2->Fill(eventnumber,apedsubtime[chid]);
619 }
620 }
621 else {
622 if (chid < 768) high_up->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
623 high_up_2->Fill(chid,apedsubtime[chid]);
624 if (chid < 768) {
625 column2_down_time_vevent4->Fill(eventnumber,apedsubtime[chid]);
626 }
627 else if (chid > 767) {
628 column2_up_time_vevent4->Fill(eventnumber,apedsubtime[chid]);
629 }
630 }
631 }
632 else if (ledup_sector_int == 3 && chid%4+1 == 3) {
633 if (column3up < adccount1) {
634 if (chid < 768) low_up->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
635 low_up_3->Fill(chid,apedsubtime[chid]);
636 if (chid < 768) {
637 column3_down_time_vevent2->Fill(eventnumber,apedsubtime[chid]);
638 }
639 else if (chid > 767) {
640 column3_up_time_vevent2->Fill(eventnumber,apedsubtime[chid]);
641 }
642 }
643 else {
644 if (chid < 768) high_up->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
645 high_up_3->Fill(chid,apedsubtime[chid]);
646 if (chid < 768) {
647 column3_down_time_vevent4->Fill(eventnumber,apedsubtime[chid]);
648 }
649 else if (chid > 767) {
650 column3_up_time_vevent4->Fill(eventnumber,apedsubtime[chid]);
651 }
652 }
653 }
654 else if (ledup_sector_int == 4 && chid%4+1 == 4) {
655 if (column4up < adccount1) {
656 if (chid < 768) low_up->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
657 low_up_4->Fill(chid,apedsubtime[chid]);
658 if (chid < 768) {
659 column4_down_time_vevent2->Fill(eventnumber,apedsubtime[chid]);
660 }
661 else if (chid > 767) {
662 column4_up_time_vevent2->Fill(eventnumber,apedsubtime[chid]);
663 }
664 }
665 else {
666 if (chid < 768) high_up->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
667 high_up_4->Fill(chid,apedsubtime[chid]);
668 if (chid < 768) {
669 column4_down_time_vevent4->Fill(eventnumber,apedsubtime[chid]);
670 }
671 else if (chid > 767) {
672 column4_up_time_vevent4->Fill(eventnumber,apedsubtime[chid]);
673 }
674 }
675 }
676 }
677 else if (LED_DS) {
678 if (leddown_sector_int == 1 && chid%4+1 == 1) {
679 if (column1down < adccount1) {
680 if (chid < 768) {
681 low_down->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
682 // cout << " DS HIST chid=" << chid << " module=" << module << " layer=" << layer << " sector=" << sector << " LED_US=" << LED_US << " LED_DS=" << LED_DS << " Tdiff=" << apedsubtime[chid]-apedsubtime[chid+768] << endl;
683 }
684 low_down_1->Fill(chid,apedsubtime[chid]);
685 // if (eventnumber >31500000 && eventnumber <46000000) cout << " chid=" << chid << " column1down=" << column1down << " apedsub=" << apedsubtime[chid] << endl;
686 if (chid < 768) {
687 column1_down_time_vevent1->Fill(eventnumber,apedsubtime[chid]);
688 }
689 else if (chid > 767) {
690 column1_up_time_vevent1->Fill(eventnumber,apedsubtime[chid]);
691 }
692 }
693 else {
694 if (chid < 768) {
695 high_down->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
696 // cout << " DS HIST chid=" << chid << " module=" << module << " layer=" << layer << " sector=" << sector << " LED_US=" << LED_US << " LED_DS=" << LED_DS << " Tdiff=" << apedsubtime[chid]-apedsubtime[chid+768] << endl;
697 }
698 high_down_1->Fill(chid,apedsubtime[chid]);
699 if (chid < 768) {
700 column1_down_time_vevent3->Fill(eventnumber,apedsubtime[chid]);
701 }
702 else if (chid > 767) {
703 column1_up_time_vevent3->Fill(eventnumber,apedsubtime[chid]);
704 }
705 }
706 }
707 else if (leddown_sector_int == 2 && chid%4+1 == 2) {
708 if (column2down < adccount1) {
709 if (chid < 768) low_down->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
710 low_down_2->Fill(chid,apedsubtime[chid]);
711 if (chid < 768) {
712 column2_down_time_vevent1->Fill(eventnumber,apedsubtime[chid]);
713 }
714 else if (chid > 767) {
715 column2_up_time_vevent1->Fill(eventnumber,apedsubtime[chid]);
716 }
717 }
718 else {
719 if (chid < 768) high_down->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
720 high_down_2->Fill(chid,apedsubtime[chid]);
721 if (chid < 768) {
722 column2_down_time_vevent3->Fill(eventnumber,apedsubtime[chid]);
723 }
724 else if (chid > 767) {
725 column2_up_time_vevent3->Fill(eventnumber,apedsubtime[chid]);
726 }
727 }
728 }
729 else if (leddown_sector_int == 3 && chid%4+1 == 3) {
730 if (column3down < adccount1) {
731 if (chid < 768) low_down->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
732 low_down_3->Fill(chid,apedsubtime[chid]);
733 if (chid < 768) {
734 column3_down_time_vevent1->Fill(eventnumber,apedsubtime[chid]);
735 }
736 else if (chid > 767) {
737 column3_up_time_vevent1->Fill(eventnumber,apedsubtime[chid]);
738 }
739 }
740 else {
741 if (chid < 768) high_down->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
742 high_down_3->Fill(chid,apedsubtime[chid]);
743 if (chid < 768) {
744 column3_down_time_vevent3->Fill(eventnumber,apedsubtime[chid]);
745 }
746 else if (chid > 767) {
747 column3_up_time_vevent3->Fill(eventnumber,apedsubtime[chid]);
748 }
749 }
750 }
751 else if (leddown_sector_int == 4 && chid%4+1 == 4) {
752 if (column4down < adccount1) {
753 if (chid < 768) low_down->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
754 low_down_4->Fill(chid,apedsubtime[chid]);
755 if (chid < 768) {
756 column4_down_time_vevent1->Fill(eventnumber,apedsubtime[chid]);
757 }
758 else if (chid > 767) {
759 column4_up_time_vevent1->Fill(eventnumber,apedsubtime[chid]);
760 }
761 }
762 else {
763 if (chid < 768) high_down->Fill(chid,apedsubtime[chid]-apedsubtime[chid+768]); // fill in time difference hists
764 high_down_4->Fill(chid,apedsubtime[chid]);
765 if (chid < 768) {
766 column4_down_time_vevent3->Fill(eventnumber,apedsubtime[chid]);
767 }
768 else if (chid > 767) {
769 column4_up_time_vevent3->Fill(eventnumber,apedsubtime[chid]);
770 }
771 }
772 }
773 }
774
775 } //loop over bcalhits
776
777 }//if LEDUP || LEDDOWN
778 // Unlock ROOT
779 japp->RootUnLock();
780
781
782 return NOERROR;
783}
784
785
786//----------------------------------------------------------------------------------
787
788
789jerror_t JEventProcessor_BCAL_LED_time::erun(void) {
790 // This is called whenever the run number changes, before it is
791 // changed to give you a chance to clean up before processing
792 // events from the next run number.
793
794
795/* printf("\nTrigger statistics");
796 printf("------------------------\n");
797 printf("%20s: %10i\n","no triggers",NOtrig);
798 printf("%20s: %10i\n","Front Panel",FPtrig);
799 printf("%20s: %10i\n","GTP",GTPtrig);
800 printf("%20s: %10i\n","FP && GTP",FPGTPtrig);
801 printf("%20s: %10i\n","US LED",trigUS);
802 printf("%20s: %10i\n","DS LED",trigDS);
803 printf("%20s: %10i\n","BCAL",trigCosmic);
804 ledcounter = low_down_1_counter + low_down_2_counter + low_down_3_counter + low_down_4_counter + low_up_1_counter + low_up_2_counter + low_up_3_counter + low_up_4_counter + high_down_1_counter + high_down_2_counter + high_down_3_counter + high_down_4_counter + high_up_1_counter + high_up_2_counter + high_up_3_counter + high_up_4_counter + unidentified;
805 printf("%20s: %10i\n","low_down_1_counter",low_down_1_counter);
806 printf("%20s: %10i\n","low_down_2_counter",low_down_2_counter);
807 printf("%20s: %10i\n","low_down_3_counter",low_down_3_counter);
808 printf("%20s: %10i\n","low_down_4_counter",low_down_4_counter);
809
810 printf("%20s: %10i\n","low_up_1_counter",low_up_1_counter);
811 printf("%20s: %10i\n","low_up_2_counter",low_up_2_counter);
812 printf("%20s: %10i\n","low_up_3_counter",low_up_3_counter);
813 printf("%20s: %10i\n","low_up_4_counter",low_up_4_counter);
814
815 printf("%20s: %10i\n","high_down_1_counter",high_down_1_counter);
816 printf("%20s: %10i\n","high_down_2_counter",high_down_2_counter);
817 printf("%20s: %10i\n","high_down_3_counter",high_down_3_counter);
818 printf("%20s: %10i\n","high_down_4_counter",high_down_4_counter);
819
820 printf("%20s: %10i\n","high_up_1_counter",high_up_1_counter);
821 printf("%20s: %10i\n","high_up_2_counter",high_up_2_counter);
822 printf("%20s: %10i\n","high_up_3_counter",high_up_3_counter);
823 printf("%20s: %10i\n","high_up_4_counter",high_up_4_counter);
824
825 printf("%20s: %10i\n","Unidentified",unidentified);*/
826
827 return NOERROR;
828}
829
830
831//----------------------------------------------------------------------------------
832
833
834jerror_t JEventProcessor_BCAL_LED_time::fini(void) {
835 // Called before program exit after event processing is finished.
836
837// //Write mean pulse time to output file
838 ofstream foutlowdown ; foutlowdown.open("LED_lowbias_downstream.txt");
839 ofstream foutlowup; foutlowup.open("LED_lowbias_upstream.txt");
840 ofstream fouthighdown; fouthighdown.open("LED_highbias_downstream.txt");
841 ofstream fouthighup; fouthighup.open("LED_highbias_upstream.txt");
842
843 for(int k=0 ;k < 768;k += 4)
844 {
845 double lowdownmean1down = low_down_1->GetBinContent(low_down_1->FindBin(k));
846 double lowdownmean1up = low_down_1->GetBinContent(low_down_1->FindBin(768+k));
847 double lowdownmean2down = low_down_2->GetBinContent(low_down_2->FindBin(k+1));
848 double lowdownmean2up = low_down_2->GetBinContent(low_down_2->FindBin(769+k));
849 double lowdownmean3down = low_down_3->GetBinContent(low_down_3->FindBin(k+2));
850 double lowdownmean3up = low_down_3->GetBinContent(low_down_3->FindBin(770+k));
851 double lowdownmean4down = low_down_4->GetBinContent(low_down_4->FindBin(k+3));
852 double lowdownmean4up = low_down_4->GetBinContent(low_down_4->FindBin(771+k));
853
854 double lowupmean1down = low_up_1->GetBinContent(low_up_1->FindBin(k));
855 double lowupmean1up = low_up_1->GetBinContent(low_up_1->FindBin(768+k));
856 double lowupmean2down = low_up_2->GetBinContent(low_up_2->FindBin(k+1));
857 double lowupmean2up = low_up_2->GetBinContent(low_up_2->FindBin(769+k));
858 double lowupmean3down = low_up_3->GetBinContent(low_up_3->FindBin(k+2));
859 double lowupmean3up = low_up_3->GetBinContent(low_up_3->FindBin(770+k));
860 double lowupmean4down = low_up_4->GetBinContent(low_up_4->FindBin(k+3));
861 double lowupmean4up = low_up_4->GetBinContent(low_up_4->FindBin(771+k));
862
863 double highdownmean1down = high_down_1->GetBinContent(high_down_1->FindBin(k));
864 double highdownmean1up = high_down_1->GetBinContent(high_down_1->FindBin(768+k));
865 double highdownmean2down = high_down_2->GetBinContent(high_down_2->FindBin(k+1));
866 double highdownmean2up = high_down_2->GetBinContent(high_down_2->FindBin(769+k));
867 double highdownmean3down = high_down_3->GetBinContent(high_down_3->FindBin(k+2));
868 double highdownmean3up = high_down_3->GetBinContent(high_down_3->FindBin(770+k));
869 double highdownmean4down = high_down_4->GetBinContent(high_down_4->FindBin(k+3));
870 double highdownmean4up = high_down_4->GetBinContent(high_down_4->FindBin(771+k));
871
872 double highupmean1down = high_up_1->GetBinContent(high_up_1->FindBin(k));
873 double highupmean1up = high_up_1->GetBinContent(high_up_1->FindBin(768+k));
874 double highupmean2down = high_up_2->GetBinContent(high_up_2->FindBin(k+1));
875 double highupmean2up = high_up_2->GetBinContent(high_up_2->FindBin(769+k));
876 double highupmean3down = high_up_3->GetBinContent(high_up_3->FindBin(k+2));
877 double highupmean3up = high_up_3->GetBinContent(high_up_3->FindBin(770+k));
878 double highupmean4down = high_up_4->GetBinContent(high_up_4->FindBin(k+3));
879 double highupmean4up = high_up_4->GetBinContent(high_up_4->FindBin(771+k));
880
881 //TString sep = " ";
882 foutlowdown << lowdownmean1down << endl << lowdownmean1up << endl << lowdownmean2down << endl << lowdownmean2up << endl << lowdownmean3down << endl << lowdownmean3up << endl << lowdownmean4down << endl << lowdownmean4up << endl;
883 foutlowup << lowupmean1down << endl << lowupmean1up << endl << lowupmean2down << endl << lowupmean2up << endl << lowupmean3down << endl << lowupmean3up << endl << lowupmean4down << endl << lowupmean4up << endl;
884 fouthighdown << highdownmean1down << endl << highdownmean1up << endl << highdownmean2down << endl << highdownmean2up << endl << highdownmean3down << endl << highdownmean3up << endl << highdownmean4down << endl << highdownmean4up << endl;
885 fouthighup << highupmean1down << endl << highupmean1up << endl << highupmean2down << endl << highupmean2up << endl << highupmean3down << endl << highupmean3up << endl << highupmean4down << endl << highupmean4up << endl;
886
887 }
888
889 foutlowdown.close();
890 foutlowup.close();
891 fouthighdown.close();
892 fouthighup.close();
893
894
895return NOERROR;
896}
897
898
899//----------------------------------------------------------------------------------
900//----------------------------------------------------------------------------------