File: | plugins/monitoring/ST_online_lowlevel/JEventProcessor_ST_online_lowlevel.cc |
Location: | line 331, column 14 |
Description: | Value stored to 'pedestal' during its initialization is never read |
1 | // $Id$ |
2 | // |
3 | // File: JEventProcessor_ST_online_lowlevel.cc |
4 | // Created: Fri Jun 19 13:21:45 EDT 2015 |
5 | // Creator: mkamel (on Linux ifarm1401 2.6.32-431.el6.x86_64 x86_64) |
6 | // |
7 | #include "JEventProcessor_ST_online_lowlevel.h" |
8 | #include "TRIGGER/DTrigger.h" |
9 | |
10 | // Routine used to create our JEventProcessor |
11 | #include <JANA/JApplication.h> |
12 | #include <JANA/JFactory.h> |
13 | extern "C"{ |
14 | void InitPlugin(JApplication *app){ |
15 | InitJANAPlugin(app); |
16 | app->AddProcessor(new JEventProcessor_ST_online_lowlevel()); |
17 | } |
18 | } // "C" |
19 | |
20 | //------------------ |
21 | // JEventProcessor_ST_online_lowlevel (Constructor) |
22 | //------------------ |
23 | JEventProcessor_ST_online_lowlevel::JEventProcessor_ST_online_lowlevel() |
24 | { |
25 | |
26 | } |
27 | |
28 | //------------------ |
29 | // ~JEventProcessor_ST_online_lowlevel (Destructor) |
30 | //------------------ |
31 | JEventProcessor_ST_online_lowlevel::~JEventProcessor_ST_online_lowlevel() |
32 | { |
33 | |
34 | } |
35 | bool DSCHit_fadc_cmp(const DSCDigiHit *a, const DSCDigiHit *b) |
36 | { |
37 | if (a->sector == b->sector) return (a->pulse_time < b->pulse_time); |
38 | return (a->sector < b->sector); |
39 | } |
40 | |
41 | bool DSCHit_tdc_cmp(const DSCTDCDigiHit *a, const DSCTDCDigiHit *b) |
42 | { |
43 | if (a->sector == b->sector) return (a->time < b->time); |
44 | return (a->sector < b->sector); |
45 | } |
46 | |
47 | bool DSCHit_thit_cmp(const DSCHit *a, const DSCHit *b) |
48 | { |
49 | if (a->sector == b->sector) return (a->t < b->t); |
50 | return (a->sector < b->sector); |
51 | } |
52 | //------------------ |
53 | // init |
54 | //------------------ |
55 | jerror_t JEventProcessor_ST_online_lowlevel::init(void) |
56 | { |
57 | // This is called once at program startup. If you are creating |
58 | // and filling historgrams in this plugin, you should lock the |
59 | // ROOT mutex like this: |
60 | // |
61 | // japp->RootWriteLock(); |
62 | // ... fill historgrams or trees ... |
63 | // japp->RootUnLock(); |
64 | // |
65 | |
66 | //Create root folder for ST and cd to it, store main dir |
67 | TDirectory *main = gDirectory(ROOT::Internal::TDirectoryAtomicAdapter(TDirectory::CurrentDirectory ())); |
68 | gDirectory(ROOT::Internal::TDirectoryAtomicAdapter(TDirectory::CurrentDirectory ()))->mkdir("st_lowlevel")->cd(); |
69 | |
70 | st_num_events = new TH1I("st_num_events","ST Number of events",1, 0.5, 1.5); |
71 | //************************************************************************ |
72 | //********************** 1D occupancy Histos ***************************** |
73 | //************************************************************************* |
74 | h1_adc_sec = new TH1I("h1_adc_sec", "ST fADC250 DigiHit Occupancy; Channel Number; fADC250 Counts", NCHANNELS, 0.5, NCHANNELS + 0.5); |
75 | h1_tdc_sec = new TH1I("h1_tdc_sec", "ST TDC DigiHit Occupancy; Channel Number; TDC Counts", NCHANNELS, 0.5, NCHANNELS + 0.5); |
76 | h1_hit_sec = new TH1I("h1_hit_sec", "ST Hit Occupancy; Channel Number; Hit Counts", NCHANNELS, 0.5, NCHANNELS + 0.5); |
77 | //************************************************************************* |
78 | //********************** 2D Multiplicity Histos ************************** |
79 | //************************************************************************* |
80 | h2_st_adc_tdc_multi = new TH2I("h2_st_adc_tdc_multi", "ST Total Multiplicity: TDC vs ADC; f1TDC Multiplicity; fADC250 Multiplicity", TDC_MULTI_BINS, TDC_MULTI_MIN + 0.5, TDC_MULTI_MAX + 0.5, ADC_MULTI_BINS, ADC_MULTI_MIN + 0.5, ADC_MULTI_MAX + 0.5); |
81 | h2_st_adc_hit_multi = new TH2I("h2_st_adc_hit_multi", "ST Total Multiplicity: HIT vs ADC; Hit Multiplicity; fADC250 Multiplicity", TDC_MULTI_BINS, TDC_MULTI_MIN + 0.5, TDC_MULTI_MAX + 0.5, ADC_MULTI_BINS, ADC_MULTI_MIN + 0.5, ADC_MULTI_MAX + 0.5); |
82 | //************************************************************************** |
83 | //**** 2D Raw ADC data + TDC time if there is an adc hit Histos *********** |
84 | //************************************************************************** |
85 | h2_raw_pi_sector = new TH2I("h2_raw_pi_sector", "ST fADC250 Pulse Integral; Channel Number; Pulse Integral(au)", NCHANNELS, 0.5, NCHANNELS + 0.5, PI_BINS, PI_MIN, PI_MAX); |
86 | h2_raw_ped_sector = new TH2I("h2_raw_ped_sector", "ST fADC250 Pulse Pedestal; Channel Number;Pulse Pedestal(au)", NCHANNELS, 0.5, NCHANNELS + 0.5, PED_BINS, PED_MIN, PED_MAX); |
87 | h2_raw_pt_sector = new TH2I("h2_raw_pt_sector", "ST fADC250 Pulse Time; Channel Number; Pulse Time(ns)", NCHANNELS, 0.5, NCHANNELS + 0.5, PT_BINS, PT_MIN, PT_MAX); |
88 | h2_tdcTime_sec = new TH2I("h2_tdcTime_sec", "ST TDC Sector vs Time (While ADC hit); Channel Number; TDC Time(ns)", NCHANNELS, 0.5, NCHANNELS + 0.5, TDC_DHIT_BINS, TDC_DHIT_MIN, TDC_DHIT_MAX); |
89 | //*************************************************************************** |
90 | //***************** 2D ADC/TDC data offsets applied ************************ |
91 | //*************************************************************************** |
92 | h2_adc_pp_sector = new TH2I("h2_adc_pp_sector","Pulse peak vs sector;Channel number; Pulse Peak (channels) ",NCHANNELS, 0.5, NCHANNELS + 0.5,300,0,3000); |
93 | h2_adc_pcpi_sector = new TH2I("h2_adc_pcpi_sector", "ST fADC250 Pedstal corrected Pulse Integral; Channel Number; fADC250 Pulse Integral (au)", NCHANNELS, 0.5, NCHANNELS + 0.5, PI_BINS, PI_MIN, PI_MAX); |
94 | h2_adc_pt_sector = new TH2I("h2_adc_pt_sector", "ST fADC250 Pulse Time; Channel Number; fADC250 Pulse Time (ns)", NCHANNELS, 0.5, NCHANNELS + 0.5, 320, -80., 80); |
95 | h2_adc_ped_sector = new TH2I("h2_adc_ped_sector", "ST fADC250 Pedestal; Channel Number; fADC250 Pedestal", NCHANNELS, 0.5, NCHANNELS + 0.5, 100, 1000., 7000.); |
96 | h2_st_time_vs_pcpi = new TH2I("h2_st_time_vs_pcpi","Ped Corrected Pulse Integral vs #delta (t_{TDC} - t_{ADC});Pulse Integral(cahnnels) ;#delta (t_{TDC} - t_{ADC}) (ns)",PI_BINS, PI_MIN, PI_MAX,32, -4., 4.); |
97 | h2_st_time_vs_pp = new TH2I("h2_st_time_vs_pp","Pulse Peak vs #delta (t_{TDC} - t_{ADC});Pulse Peak (cahnnels);#delta (t_{TDC} - t_{ADC}) (ns)",300,0,3000,32, -4., 4.); |
98 | //*************************************************************************** |
99 | //********************** Raw TDC data Histos ******************************* |
100 | //*************************************************************************** |
101 | h2_raw_tdcTime_sec = new TH2I("h2_raw_tdcTime_sec", "ST TDC Sector vs Time; Channel Number; TDC Time(ns)", NCHANNELS, 0.5, NCHANNELS + 0.5, TDC_DHIT_BINS, TDC_DHIT_MIN, TDC_DHIT_MAX); |
102 | //*************************************************************************** |
103 | // ****************** Raw Hit data Histos *********************************** |
104 | //*************************************************************************** |
105 | h2_t_sec = new TH2I("h2_t_sec", "ST Hit Sector vs Time (walk corrected); Channel Number; TDC Time(ns)", NCHANNELS, 0.5, NCHANNELS + 0.5, T_HIT_BINS, T_HIT_MIN, T_HIT_MAX); |
106 | h2_tTDC_sec = new TH2I("h2_tTDC_sec", "ST Hit Sector vs Time(No walk corrected); Channel Number; TDC Time(ns)", NCHANNELS, 0.5, NCHANNELS + 0.5, T_HIT_BINS, T_HIT_MIN, T_HIT_MAX); |
107 | h2_tfADC_sec= new TH2I("h2_tfADC_sec", "ST Hit Sector vs ADC-Time; Channel Number; ADC Time(ns)", NCHANNELS, 0.5, NCHANNELS + 0.5, T_HIT_BINS, T_HIT_MIN, T_HIT_MAX); |
108 | h2_dE_sec = new TH2I("h2_dE_sec", "ST Hit Sector vs dE; Channel Number; dE(GeV)", NCHANNELS, 0.5, NCHANNELS + 0.5, 80, 0.0, 0.004); |
109 | //*************************************************************************** |
110 | //======================== Creat root folder for waveforms and cd to it====== |
111 | //*************************************************************************** |
112 | gDirectory(ROOT::Internal::TDirectoryAtomicAdapter(TDirectory::CurrentDirectory ()))->mkdir("waveforms")->cd(); |
113 | //*************************************************************************** |
114 | //******************* Waveform Histos ************************************** |
115 | //*************************************************************************** |
116 | for(unsigned int i = 0; i < NCHANNELS; i++) |
117 | { |
118 | h_amp_vs_sampl_chan[i] = new TH1I(Form("amp_vs_sampl_chan_%i", i+1), Form("Channel %i, #phi #in [%i^{#circ}, %i^{#circ}]; fADC250 Sample Number; fADC250 Pulse Height (au)", i+1, 0+12*i, 12+12*i), 100, 0, 100); |
119 | h_amp_vs_sampl_chan150[i] = new TH1I(Form("amp_vs_sampl_chan150_%i", i+1), Form("Channel %i, #phi #in [%i^{#circ}, %i^{#circ}]; fADC250 Sample Number; fADC250 Pulse Height (au)", i+1, 0+12*i, 12+12*i), 100, 0, 100); |
120 | |
121 | h_amp_vs_sampl_chan1000[i] = new TH1I(Form("amp_vs_sampl_chan1000_%i", i+1), Form("Channel %i, #phi #in [%i^{#circ}, %i^{#circ}]; fADC250 Sample Number; fADC250 Pulse Height (au)", i+1, 0+12*i, 12+12*i), 100, 0, 100); |
122 | |
123 | h_amp_vs_sampl_chan2000[i] = new TH1I(Form("amp_vs_sampl_chan2000_%i", i+1), Form("Channel %i, #phi #in [%i^{#circ}, %i^{#circ}]; fADC250 Sample Number; fADC250 Pulse Height (au)", i+1, 0+12*i, 12+12*i), 100, 0, 100); |
124 | |
125 | h_amp_vs_sampl_chan3000[i] = new TH1I(Form("amp_vs_sampl_chan3000_%i", i+1), Form("Channel %i, #phi #in [%i^{#circ}, %i^{#circ}]; fADC250 Sample Number; fADC250 Pulse Height (au)", i+1, 0+12*i, 12+12*i), 100, 0, 100); |
126 | |
127 | h_amp_vs_sampl_chan4000[i] = new TH1I(Form("amp_vs_sampl_chan4000_%i", i+1), Form("Channel %i, #phi #in [%i^{#circ}, %i^{#circ}]; fADC250 Sample Number; fADC250 Pulse Height (au)", i+1, 0+12*i, 12+12*i), 100, 0, 100); |
128 | // ========================Define Boolians Arrays to be false================== |
129 | bool_sec[i] = false; |
130 | bool_sec150[i] = false; |
131 | bool_sec1000[i] = false; |
132 | bool_sec2000[i] = false; |
133 | bool_sec3000[i] = false; |
134 | bool_sec4000[i] = false; |
135 | // ============================================================================ |
136 | } |
137 | // cd back to main directory |
138 | main->cd(); |
139 | |
140 | return NOERROR; |
141 | } |
142 | |
143 | //------------------ |
144 | // brun |
145 | //------------------ |
146 | jerror_t JEventProcessor_ST_online_lowlevel::brun(JEventLoop *eventLoop, int32_t runnumber) |
147 | { |
148 | // load scale factors |
149 | map<string,double> scale_factors; |
150 | if (eventLoop->GetCalib("/START_COUNTER/digi_scales", scale_factors)) |
151 | jout << "Error loading /START_COUNTER/digi_scales !" << endl; |
152 | // t_scale (SC_ADC_SCALE) |
153 | if (scale_factors.find("SC_ADC_TSCALE") != scale_factors.end()) |
154 | t_scale = scale_factors["SC_ADC_TSCALE"]; |
155 | else |
156 | jerr << "Unable to get SC_ADC_TSCALE from /START_COUNTER/digi_scales !" |
157 | << endl; |
158 | |
159 | // load base time offset |
160 | map<string,double> base_time_offset; |
161 | // t_base (SC_BASE_TIME_OFFSET) |
162 | if (eventLoop->GetCalib("/START_COUNTER/base_time_offset",base_time_offset)) |
163 | jout << "Error loading /START_COUNTER/base_time_offset !" << endl; |
164 | if (base_time_offset.find("SC_BASE_TIME_OFFSET") != base_time_offset.end()) |
165 | t_base = base_time_offset["SC_BASE_TIME_OFFSET"]; |
166 | else |
167 | jerr << "Unable to get SC_BASE_TIME_OFFSET from /START_COUNTER/base_time_offset !" << endl; |
168 | // t_tdc_base (SC_TDC_BASE_TIME_OFFSET) |
169 | if (base_time_offset.find("SC_TDC_BASE_TIME_OFFSET") != base_time_offset.end()) |
170 | t_tdc_base = base_time_offset["SC_TDC_BASE_TIME_OFFSET"]; |
171 | else |
172 | jerr << "Unable to get SC_BASE_TIME_OFFSET from /START_COUNTER/base_time_offset !" << endl; |
173 | // load constant tables |
174 | // a_pedestals (pedestals) |
175 | if (eventLoop->GetCalib("/START_COUNTER/pedestals", a_pedestals)) |
176 | jout << "Error loading /START_COUNTER/pedestals !" << endl; |
177 | // adc_time_offsets (adc_timing_offsets) |
178 | if (eventLoop->GetCalib("/START_COUNTER/adc_timing_offsets", adc_time_offsets)) |
179 | jout << "Error loading /START_COUNTER/adc_timing_offsets !" << endl; |
180 | // tdc_time_offsets (tdc_timing_offsets) |
181 | if (eventLoop->GetCalib("/START_COUNTER/tdc_timing_offsets", tdc_time_offsets)) jout << "Error loading /START_COUNTER/tdc_timing_offsets !" << endl; |
182 | // This is called whenever the run number changes |
183 | return NOERROR; |
184 | } |
185 | |
186 | //------------------ |
187 | // evnt |
188 | //------------------ |
189 | jerror_t JEventProcessor_ST_online_lowlevel::evnt(JEventLoop *loop, uint64_t eventnumber) |
190 | { |
191 | // Get the data objects first so we minimize the time we hold the ROOT mutex lock |
192 | vector<const DSCDigiHit*> dscdigihits; // ST fADC250 DigiHits |
193 | vector<const DSCTDCDigiHit*> dsctdcdigihits; // ST f1TDC DigiHits |
194 | vector<const DSCHit*> dschits; // ST hits |
195 | const DTTabUtilities* TTabUtilities = NULL__null; |
196 | |
197 | const DTrigger* locTrigger = NULL__null; |
198 | loop->GetSingle(locTrigger); |
199 | if(locTrigger->Get_L1FrontPanelTriggerBits() != 0) |
200 | return NOERROR; |
201 | |
202 | loop->Get(dscdigihits); |
203 | loop->Get(dsctdcdigihits); |
204 | loop->Get(dschits); |
205 | loop->GetSingle(TTabUtilities); |
206 | uint32_t ADC_hits = dscdigihits.size(); |
207 | uint32_t TDC_hits = dsctdcdigihits.size(); |
208 | uint32_t Hits = dschits.size(); |
209 | |
210 | // FILL HISTOGRAMS |
211 | // Since we are filling histograms local to this plugin, it will not interfere with other ROOT operations: can use plugin-wide ROOT fill lock |
212 | japp->RootFillLock(this); //ACQUIRE ROOT FILL LOCK |
213 | |
214 | if( (dscdigihits.size()>0) || (dsctdcdigihits.size()>0) || (dschits.size()>0) ) |
215 | st_num_events->Fill(1); |
216 | //******** Fill 2D multiplicity histos ******************************** |
217 | h2_st_adc_tdc_multi->Fill(TDC_hits, ADC_hits); //ADC single hit object |
218 | h2_st_adc_hit_multi->Fill(Hits, ADC_hits); |
219 | //========================== DSCDigiHits ** ADC Hits================= |
220 | //******************************************************************* |
221 | for(uint32_t i = 0; i < ADC_hits; i++) { |
222 | //*************************************************************** |
223 | //=========== Wave Form online O'Scope ========================== |
224 | // ************************************************************** |
225 | // Define some objects |
226 | const Df250PulseIntegral *pulseintegral = nullptr; |
227 | const Df250WindowRawData *windowrawdata = nullptr; |
228 | // Define a vector to store the adc samples |
229 | vector<uint16_t> samples; // Declare empty vector |
230 | // Get the sector values |
231 | Int_t hit_sector_adc = dscdigihits[i]->sector; |
232 | Int_t hit_sector_adc_index = hit_sector_adc - 1; |
233 | |
234 | dscdigihits[i]->GetSingle(pulseintegral); |
235 | dscdigihits[i]->GetSingle(windowrawdata); |
236 | // Obtain the pedestal and raw window data |
237 | if (pulseintegral != nullptr) { |
238 | pulseintegral->GetSingle(windowrawdata); |
239 | } |
240 | // Histogram the raw window data |
241 | if (windowrawdata != nullptr) { |
242 | adc_pp = dscdigihits[i]->pulse_peak; |
243 | if ((100 < adc_pp) && (adc_pp <= 150)) { |
244 | if (!bool_sec150[hit_sector_adc_index]) { |
245 | |
246 | bool_sec150[hit_sector_adc_index] = true; |
247 | if (bool_sec150[hit_sector_adc_index]) { |
248 | for (uint32_t j = 0; j < windowrawdata->samples.size(); j++) { |
249 | samples.push_back(windowrawdata->samples[j]); |
250 | h_amp_vs_sampl_chan150[hit_sector_adc_index]->Fill(j, samples[j]); |
251 | } |
252 | } |
253 | } |
254 | } |
255 | if ((150 < adc_pp) && (adc_pp <= 1000)) { |
256 | if (!bool_sec[hit_sector_adc_index]) { |
257 | bool_sec[hit_sector_adc_index] = true; |
258 | if (bool_sec[hit_sector_adc_index]) { |
259 | for (uint32_t j = 0; j < windowrawdata->samples.size(); j++) { |
260 | samples.push_back(windowrawdata->samples[j]); |
261 | h_amp_vs_sampl_chan[hit_sector_adc_index]->Fill(j, samples[j]); |
262 | } |
263 | } |
264 | } |
265 | } |
266 | if ( (1000 < adc_pp) && (adc_pp <= 2000)) { |
267 | if (!bool_sec1000[hit_sector_adc_index]) { |
268 | bool_sec1000[hit_sector_adc_index] = true; |
269 | if (bool_sec1000[hit_sector_adc_index]) { |
270 | for (uint32_t j = 0; j < windowrawdata->samples.size(); j++) { |
271 | samples.push_back(windowrawdata->samples[j]); |
272 | h_amp_vs_sampl_chan1000[hit_sector_adc_index]->Fill(j, samples[j]); |
273 | } |
274 | } |
275 | } |
276 | } |
277 | if ( (2000 < adc_pp) && (adc_pp <= 3000)) { |
278 | if (!bool_sec2000[hit_sector_adc_index]) { |
279 | bool_sec2000[hit_sector_adc_index] = true; |
280 | if (bool_sec2000[hit_sector_adc_index]) { |
281 | for (uint32_t j = 0; j < windowrawdata->samples.size(); j++) { |
282 | samples.push_back(windowrawdata->samples[j]); |
283 | h_amp_vs_sampl_chan2000[hit_sector_adc_index]->Fill(j, samples[j]); |
284 | } |
285 | } |
286 | } |
287 | } |
288 | if ( (3000 < adc_pp) && (adc_pp <= 4000)) { |
289 | if (!bool_sec3000[hit_sector_adc_index]) { |
290 | bool_sec3000[hit_sector_adc_index] = true; |
291 | if (bool_sec3000[hit_sector_adc_index]) { |
292 | for (uint32_t j = 0; j < windowrawdata->samples.size(); j++) { |
293 | samples.push_back(windowrawdata->samples[j]); |
294 | h_amp_vs_sampl_chan3000[hit_sector_adc_index]->Fill(j, samples[j]); |
295 | } |
296 | } |
297 | } |
298 | } |
299 | if ( (4000 < adc_pp)) { |
300 | if (!bool_sec4000[hit_sector_adc_index]) { |
301 | bool_sec4000[hit_sector_adc_index] = true; |
302 | if (bool_sec4000[hit_sector_adc_index]) { |
303 | for (uint32_t j = 0; j < windowrawdata->samples.size(); j++) { |
304 | samples.push_back(windowrawdata->samples[j]); |
305 | h_amp_vs_sampl_chan4000[hit_sector_adc_index]->Fill(j, samples[j]); |
306 | } |
307 | } |
308 | } |
309 | } |
310 | } // Windowrawdata cut |
311 | //**************************************************************************** |
312 | // ================= Get the raw data variables from ADC digihit object====== |
313 | //**************************************************************************** |
314 | int hit_channel = dscdigihits[i]->sector - 1; // channel hit (ranging from 0 to NCHANNELS-1) |
315 | int adc_sector = dscdigihits[i]->sector ; // channel hit (ranging from 1 to NCHANNELS) |
316 | uint32_t avg_pedestal = (dscdigihits[i]->nsamples_pedestal == 0 ) ? 0.0 : dscdigihits[i]->pedestal/dscdigihits[i]->nsamples_pedestal; // average single-sample pedestal (should be around 100 chan1) |
317 | uint32_t pulse_time = dscdigihits[i]->pulse_time*ADC_PT_RES; // converted pulse time to ns |
318 | uint32_t pulse_integral= dscdigihits[i]->pulse_integral; // pulse integral |
319 | //Occupancy Histo |
320 | h1_adc_sec->Fill(adc_sector); |
321 | // Fill the 2D histo |
322 | h2_raw_pi_sector->Fill(adc_sector,pulse_integral); |
323 | h2_raw_ped_sector->Fill(adc_sector,avg_pedestal); |
324 | h2_raw_pt_sector->Fill(adc_sector,pulse_time); |
325 | //************************************************************************ |
326 | //=================Apply the calibration constants======================== |
327 | //************************************************************************ |
328 | // maybe throw away bad hits? |
329 | // Initialize pedestal to one found in CCDB, but override it |
330 | // with one found in event if is available |
331 | double pedestal = a_pedestals[hit_channel]; |
Value stored to 'pedestal' during its initialization is never read | |
332 | double single_sample_ped = (double)dscdigihits[i]->pedestal; |
333 | double nsamples_integral = (double)dscdigihits[i]->nsamples_integral; |
334 | double nsamples_pedestal = (double)dscdigihits[i]->nsamples_pedestal; |
335 | pedestal = single_sample_ped * nsamples_integral/nsamples_pedestal; |
336 | |
337 | // Apply calibration constants here |
338 | adc_ped = pedestal; |
339 | adc_pi = dscdigihits[i]->pulse_integral; |
340 | adc_pcpi = adc_pi - adc_ped; |
341 | adc_pp = dscdigihits[i]->pulse_peak; |
342 | adc_t = dscdigihits[i]->pulse_time * t_scale - adc_time_offsets[hit_channel] + t_base; // Convert to ns |
343 | //Fill 2D Histos |
344 | h2_adc_pp_sector->Fill(adc_sector,adc_pp); |
345 | h2_adc_pcpi_sector->Fill(adc_sector,adc_pcpi); |
346 | h2_adc_pt_sector->Fill(adc_sector,adc_t); |
347 | h2_adc_ped_sector->Fill(adc_sector,adc_ped); |
348 | //****************************************************************************** |
349 | // Aquire the TDC DigiHits******* get the tdc hits when there is an adc hit***** |
350 | //****************************************************************************** |
351 | for(uint32_t i = 0; i < TDC_hits; i++) { |
352 | //sort(dsctdcdigihits.begin(), dsctdcdigihits.end(), DSCHit_tdc_cmp); |
353 | const DSCTDCDigiHit *tdc_dhit = dsctdcdigihits[i]; |
354 | float tdc_dhit_time = TTabUtilities->Convert_DigiTimeToNs_F1TDC(tdc_dhit);//tdc_dhit->time*TDC_RES; |
355 | int tdc_sector = tdc_dhit->sector; |
356 | if (adc_sector == tdc_sector) { |
357 | h2_tdcTime_sec->Fill(tdc_sector,tdc_dhit_time); |
358 | tdc_t = TTabUtilities->Convert_DigiTimeToNs_F1TDC(tdc_dhit) - tdc_time_offsets[tdc_sector] + t_tdc_base; |
359 | st_time = tdc_t - adc_t; |
360 | h2_st_time_vs_pcpi->Fill(adc_pcpi,st_time); |
361 | h2_st_time_vs_pp->Fill(adc_pp,st_time); |
362 | } |
363 | }// End TDC loop |
364 | }// End ADC loop |
365 | //************************************************************************ |
366 | //========================== DSCTDCDigiHits ** TDC Hits================= |
367 | //************************************************************************ |
368 | for(uint32_t i = 0; i < TDC_hits; i++) |
369 | { |
370 | const DSCTDCDigiHit *tdc_dhit = dsctdcdigihits[i]; |
371 | float tdc_dhit_time = TTabUtilities->Convert_DigiTimeToNs_F1TDC(tdc_dhit); |
372 | int tdc_sec = tdc_dhit->sector; |
373 | //Fill tdc occupancy histo |
374 | h1_tdc_sec->Fill(tdc_sec); |
375 | //Fill 2D histo |
376 | h2_raw_tdcTime_sec->Fill(tdc_sec,tdc_dhit_time); |
377 | |
378 | }// End TDC loop |
379 | //******************************************************************************* |
380 | //========================== DSCHits ** Hits after hit factory================= |
381 | //******************************************************************************* |
382 | for(uint32_t i = 0; i < dschits.size(); i++) |
383 | { |
384 | const DSCHit *hit = dschits[i]; |
385 | int hit_sector = hit->sector; |
386 | float dE = hit->dE; // Energy loss in GeV |
387 | float t = hit->t; // best time (walk-corrected tdc) |
388 | float t_TDC = hit->t_TDC; // time from TDC, no walk correction |
389 | float t_fADC = hit->t_fADC; // time from fADC |
390 | |
391 | h1_hit_sec->Fill(hit_sector); |
392 | //Fill 2D histos |
393 | h2_t_sec->Fill(hit_sector,t); // walk corrected tdc time vs sector |
394 | h2_tTDC_sec->Fill(hit_sector,t_TDC); // No walk correction TDC time vs sector |
395 | h2_tfADC_sec->Fill(hit_sector,t_fADC);// ADC time vs Sector |
396 | h2_dE_sec->Fill(hit_sector,dE); // dE vs sector |
397 | |
398 | }// End Hit loop |
399 | // Lock ROOT mutex so other threads won't interfere |
400 | japp->RootFillUnLock(this); //RELEASE ROOT FILL LOCK |
401 | |
402 | return NOERROR; |
403 | } |
404 | |
405 | //------------------ |
406 | // erun |
407 | //------------------ |
408 | jerror_t JEventProcessor_ST_online_lowlevel::erun(void) |
409 | { |
410 | // This is called whenever the run number changes, before it is |
411 | // changed to give you a chance to clean up before processing |
412 | // events from the next run number. |
413 | return NOERROR; |
414 | } |
415 | |
416 | //------------------ |
417 | // fini |
418 | //------------------ |
419 | jerror_t JEventProcessor_ST_online_lowlevel::fini(void) |
420 | { |
421 | // Called before program exit after event processing is finished. |
422 | return NOERROR; |
423 | } |