23 for (
int k = 0;
k < 4;
k++)
24 state.push_back(
true);
27 if (!m_outputFileText.empty()) {
28 cout <<
"Castor LED results will be saved to " << m_outputFileText.c_str() << endl;
29 m_outFile.open(m_outputFileText.c_str());
32 if (!m_outputFileROOT.empty()) {
33 cout <<
"Castor LED histograms will be saved to " << m_outputFileROOT.c_str() << endl;
38 m_nevtsample = 9999999;
54 m_logFile.open(
"CastorLedAnalysis.log");
59 castorHists.ALLLEDS =
new TH1F(
"Castor All LEDs",
"HF All Leds", 10, 0, 9);
60 castorHists.LEDRMS =
new TH1F(
"Castor All LED RMS",
"HF All LED RMS", 100, 0, 3);
61 castorHists.LEDMEAN =
new TH1F(
"Castor All LED Means",
"HF All LED Means", 100, 0, 9);
62 castorHists.CHI2 =
new TH1F(
"Castor Chi2 by ndf for Landau fit",
"HF Chi2/ndf Landau", 200, 0., 50.);
65 m_outputFileXML.open(m_outputFileX.c_str());
66 snprintf(
output,
sizeof output,
"<?xml version='1.0' encoding='UTF-8'?>");
67 m_outputFileXML <<
output << endl;
69 m_outputFileXML <<
output << endl << endl;
71 m_outputFileXML <<
output << endl;
73 m_outputFileXML <<
output << endl;
74 snprintf(
output,
sizeof output,
" <EXTENSION_TABLE_NAME>HCAL_LED_TIMING</EXTENSION_TABLE_NAME>");
75 m_outputFileXML <<
output << endl;
76 snprintf(
output,
sizeof output,
" <NAME>HCAL LED Timing</NAME>");
77 m_outputFileXML <<
output << endl;
79 m_outputFileXML <<
output << endl;
81 m_outputFileXML <<
output << endl;
82 snprintf(
output,
sizeof output,
" <RUN_TYPE>hcal-led-timing-test</RUN_TYPE>");
83 m_outputFileXML <<
output << endl;
84 snprintf(
output,
sizeof output,
" <RUN_NUMBER>%06i</RUN_NUMBER>", runNum);
85 m_outputFileXML <<
output << endl;
86 snprintf(
output,
sizeof output,
" <RUN_BEGIN_TIMESTAMP>2007-07-09 00:00:00.0</RUN_BEGIN_TIMESTAMP>");
87 m_outputFileXML <<
output << endl;
88 snprintf(
output,
sizeof output,
" <COMMENT_DESCRIPTION></COMMENT_DESCRIPTION>");
89 m_outputFileXML <<
output << endl;
91 m_outputFileXML <<
output << endl;
93 m_outputFileXML <<
output << endl;
95 m_outputFileXML <<
output << endl;
97 m_outputFileXML <<
output << endl;
99 m_outputFileXML <<
output << endl;
101 m_outputFileXML <<
output << endl;
102 snprintf(
output,
sizeof output,
" <INTERVAL_OF_VALIDITY_BEGIN>2147483647</INTERVAL_OF_VALIDITY_BEGIN>");
103 m_outputFileXML <<
output << endl;
104 snprintf(
output,
sizeof output,
" <INTERVAL_OF_VALIDITY_END>0</INTERVAL_OF_VALIDITY_END>");
105 m_outputFileXML <<
output << endl;
107 m_outputFileXML <<
output << endl;
108 snprintf(
output,
sizeof output,
" <TAG id='2' mode='auto'>");
109 m_outputFileXML <<
output << endl;
110 snprintf(
output,
sizeof output,
" <TAG_NAME>laser_led_%06i<TAG_NAME>", runNum);
111 m_outputFileXML <<
output << endl;
112 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HCAL</DETECTOR_NAME>");
113 m_outputFileXML <<
output << endl;
114 snprintf(
output,
sizeof output,
" <COMMENT_DESCRIPTION></COMMENT_DESCRIPTION>");
115 m_outputFileXML <<
output << endl;
117 m_outputFileXML <<
output << endl;
119 m_outputFileXML <<
output << endl;
121 m_outputFileXML <<
output << endl;
123 m_outputFileXML <<
output << endl;
125 m_outputFileXML <<
output << endl;
126 snprintf(
output,
sizeof output,
" <DATA_SET idref='-1' />");
127 m_outputFileXML <<
output << endl;
129 m_outputFileXML <<
output << endl;
131 m_outputFileXML <<
output << endl;
133 m_outputFileXML <<
output << endl;
140 for (_meol = castorHists.LEDTRENDS.begin(); _meol != castorHists.LEDTRENDS.end(); _meol++) {
141 for (
int i = 0;
i < 15;
i++)
142 _meol->second[
i].first->Delete();
145 castorHists.ALLLEDS->Delete();
146 castorHists.LEDRMS->Delete();
147 castorHists.LEDMEAN->Delete();
148 castorHists.CHI2->Delete();
154 m_file =
new TFile(m_outputFileROOT.c_str(),
"RECREATE");
155 m_file->mkdir(
"Castor");
171 if (!m_outputFileText.empty()) {
172 if (m_fitflag == 0 || m_fitflag == 2)
173 m_outFile <<
"Det Eta,Phi,D Mean Error" << std::endl;
174 else if (m_fitflag == 1 || m_fitflag == 3)
175 m_outFile <<
"Det Eta,Phi,D Peak Error" << std::endl;
176 else if (m_fitflag == 4)
177 m_outFile <<
"Det Eta,Phi,D Mean Error Peak Error MeanEv Error PeakEv Error" 180 for (_meol = toolT.begin(); _meol != toolT.end(); _meol++) {
182 _meol->second[10].first->Scale(1. / evt_curr);
183 if (m_fitflag == 0 || m_fitflag == 4) {
184 time1 = _meol->second[10].first->GetMean();
185 dtime1 = _meol->second[10].first->GetRMS() /
sqrt((
float)evt_curr * (m_endTS - m_startTS + 1));
187 if (m_fitflag == 1 || m_fitflag == 4) {
189 for (
int j = 0; j < 10; j++)
190 _meol->second[10].first->SetBinError(j + 1, _meol->second[j].first->GetRMS() /
sqrt((
float)evt_curr));
192 if (m_fitflag == 1 || m_fitflag == 3 || m_fitflag == 4) {
193 _meol->second[10].first->Fit(
"landau",
"Q");
195 TF1*
fit = _meol->second[10].first->GetFunction(
"landau");
197 time2 = fit->GetParameter(1);
198 dtime2 = fit->GetParError(1);
200 if (m_fitflag == 2 || m_fitflag == 4) {
201 time3 = _meol->second[12].first->GetMean();
202 dtime3 = _meol->second[12].first->GetRMS() /
sqrt((
float)_meol->second[12].first->GetEntries());
204 if (m_fitflag == 3 || m_fitflag == 4) {
205 time4 = _meol->second[13].first->GetMean();
206 dtime4 = _meol->second[13].first->GetRMS() /
sqrt((
float)_meol->second[13].first->GetEntries());
208 for (
int i = 0;
i < 10;
i++) {
209 _meol->second[
i].first->GetXaxis()->SetTitle(
"Pulse height (fC)");
210 _meol->second[
i].first->GetYaxis()->SetTitle(
"Counts");
213 _meol->second[10].first->GetXaxis()->SetTitle(
"Time slice");
214 _meol->second[10].first->GetYaxis()->SetTitle(
"Averaged pulse (fC)");
215 if (m_hiSaveflag > 0)
216 _meol->second[10].first->Write();
217 _meol->second[10].second.first[0].push_back(time1);
218 _meol->second[10].second.first[1].push_back(dtime1);
219 _meol->second[11].second.first[0].push_back(time2);
220 _meol->second[11].second.first[1].push_back(dtime2);
221 _meol->second[12].first->GetXaxis()->SetTitle(
"Mean TS");
222 _meol->second[12].first->GetYaxis()->SetTitle(
"Counts");
223 if (m_fitflag == 2 && m_hiSaveflag > 0)
224 _meol->second[12].first->Write();
225 _meol->second[12].second.first[0].push_back(time3);
226 _meol->second[12].second.first[1].push_back(dtime3);
227 _meol->second[13].first->GetXaxis()->SetTitle(
"Peak TS");
228 _meol->second[13].first->GetYaxis()->SetTitle(
"Counts");
229 if (m_fitflag > 2 && m_hiSaveflag > 0)
230 _meol->second[13].first->Write();
231 _meol->second[13].second.first[0].push_back(time4);
232 _meol->second[13].second.first[1].push_back(dtime4);
233 _meol->second[14].first->GetXaxis()->SetTitle(
"Peak TS error");
234 _meol->second[14].first->GetYaxis()->SetTitle(
"Counts");
235 if (m_fitflag > 2 && m_hiSaveflag > 0)
236 _meol->second[14].first->Write();
237 _meol->second[15].first->GetXaxis()->SetTitle(
"Chi2/NDF");
238 _meol->second[15].first->GetYaxis()->SetTitle(
"Counts");
239 if (m_fitflag > 2 && m_hiSaveflag > 0)
240 _meol->second[15].first->Write();
241 _meol->second[16].first->GetXaxis()->SetTitle(
"Integrated Signal");
242 _meol->second[16].first->Write();
247 if (!m_outputFileText.empty()) {
248 if (m_fitflag == 0) {
249 m_outFile << detid <<
" " << time1 <<
" " << dtime1 << std::endl;
251 m_outputFileXML <<
output << endl;
252 snprintf(
output,
sizeof output,
" <VERSION>version:1</VERSION>");
253 m_outputFileXML <<
output << endl;
255 m_outputFileXML <<
output << endl;
256 snprintf(
output,
sizeof output,
" <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME>");
257 m_outputFileXML <<
output << endl;
259 m_outputFileXML <<
output << endl;
261 m_outputFileXML <<
output << endl;
263 m_outputFileXML <<
output << endl;
265 m_outputFileXML <<
output << endl;
267 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HB</DETECTOR_NAME>");
269 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HE</DETECTOR_NAME>");
271 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HO</DETECTOR_NAME>");
273 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HF</DETECTOR_NAME>");
274 m_outputFileXML <<
output << endl;
275 snprintf(
output,
sizeof output,
" <HCAL_CHANNEL_ID>%10i</HCAL_CHANNEL_ID>", detid.
rawId());
276 m_outputFileXML <<
output << endl;
278 m_outputFileXML <<
output << endl;
280 m_outputFileXML <<
output << endl;
281 snprintf(
output,
sizeof output,
" <MEAN_TIME>%7f</MEAN_TIME>", time1);
282 m_outputFileXML <<
output << endl;
283 snprintf(
output,
sizeof output,
" <OFFSET_TIME> 0</OFFSET_TIME>");
284 m_outputFileXML <<
output << endl;
285 snprintf(
output,
sizeof output,
" <ERROR_STAT>%7f</ERROR_STAT>", dtime1);
286 m_outputFileXML <<
output << endl;
287 snprintf(
output,
sizeof output,
" <ANALYSIS_FLAG>%2i</ANALYSIS_FLAG>", m_fitflag + 1);
288 m_outputFileXML <<
output << endl;
289 snprintf(
output,
sizeof output,
" <STATUS_WORD> 0</STATUS_WORD>");
290 m_outputFileXML <<
output << endl;
292 m_outputFileXML <<
output << endl;
294 m_outputFileXML <<
output << endl;
296 }
else if (m_fitflag == 1) {
297 m_outFile << detid <<
" " << time2 <<
" " << dtime2 << std::endl;
299 m_outputFileXML <<
output << endl;
300 snprintf(
output,
sizeof output,
" <VERSION>version:1</VERSION>");
301 m_outputFileXML <<
output << endl;
303 m_outputFileXML <<
output << endl;
304 snprintf(
output,
sizeof output,
" <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME>");
305 m_outputFileXML <<
output << endl;
307 m_outputFileXML <<
output << endl;
309 m_outputFileXML <<
output << endl;
311 m_outputFileXML <<
output << endl;
313 m_outputFileXML <<
output << endl;
315 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HB</DETECTOR_NAME>");
317 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HE</DETECTOR_NAME>");
319 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HO</DETECTOR_NAME>");
321 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HF</DETECTOR_NAME>");
322 m_outputFileXML <<
output << endl;
323 snprintf(
output,
sizeof output,
" <HCAL_CHANNEL_ID>%10i</HCAL_CHANNEL_ID>", detid.
rawId());
324 m_outputFileXML <<
output << endl;
326 m_outputFileXML <<
output << endl;
328 m_outputFileXML <<
output << endl;
329 snprintf(
output,
sizeof output,
" <MEAN_TIME>%7f</MEAN_TIME>", time2);
330 m_outputFileXML <<
output << endl;
331 snprintf(
output,
sizeof output,
" <OFFSET_TIME> 0</OFFSET_TIME>");
332 m_outputFileXML <<
output << endl;
333 snprintf(
output,
sizeof output,
" <ERROR_STAT>%7f</ERROR_STAT>", dtime2);
334 m_outputFileXML <<
output << endl;
335 snprintf(
output,
sizeof output,
" <ANALYSIS_FLAG>%2i</ANALYSIS_FLAG>", m_fitflag + 1);
336 m_outputFileXML <<
output << endl;
337 snprintf(
output,
sizeof output,
" <STATUS_WORD> 0</STATUS_WORD>");
338 m_outputFileXML <<
output << endl;
340 m_outputFileXML <<
output << endl;
342 m_outputFileXML <<
output << endl;
345 else if (m_fitflag == 2) {
346 m_outFile << detid <<
" " << time3 <<
" " << dtime3 << std::endl;
348 m_outputFileXML <<
output << endl;
349 snprintf(
output,
sizeof output,
" <VERSION>version:1</VERSION>");
350 m_outputFileXML <<
output << endl;
352 m_outputFileXML <<
output << endl;
353 snprintf(
output,
sizeof output,
" <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME>");
354 m_outputFileXML <<
output << endl;
356 m_outputFileXML <<
output << endl;
358 m_outputFileXML <<
output << endl;
360 m_outputFileXML <<
output << endl;
362 m_outputFileXML <<
output << endl;
364 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HB</DETECTOR_NAME>");
366 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HE</DETECTOR_NAME>");
368 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HO</DETECTOR_NAME>");
370 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HF</DETECTOR_NAME>");
371 m_outputFileXML <<
output << endl;
372 snprintf(
output,
sizeof output,
" <HCAL_CHANNEL_ID>%10i</HCAL_CHANNEL_ID>", detid.
rawId());
373 m_outputFileXML <<
output << endl;
375 m_outputFileXML <<
output << endl;
377 m_outputFileXML <<
output << endl;
378 snprintf(
output,
sizeof output,
" <MEAN_TIME>%7f</MEAN_TIME>", time3);
379 m_outputFileXML <<
output << endl;
380 snprintf(
output,
sizeof output,
" <OFFSET_TIME> 0</OFFSET_TIME>");
381 m_outputFileXML <<
output << endl;
382 snprintf(
output,
sizeof output,
" <ERROR_STAT>%7f</ERROR_STAT>", dtime3);
383 m_outputFileXML <<
output << endl;
384 snprintf(
output,
sizeof output,
" <ANALYSIS_FLAG>%2i</ANALYSIS_FLAG>", m_fitflag + 1);
385 m_outputFileXML <<
output << endl;
386 snprintf(
output,
sizeof output,
" <STATUS_WORD> 0</STATUS_WORD>");
387 m_outputFileXML <<
output << endl;
389 m_outputFileXML <<
output << endl;
391 m_outputFileXML <<
output << endl;
392 }
else if (m_fitflag == 3) {
393 m_outFile << detid <<
" " << time4 <<
" " << dtime4 << std::endl;
395 m_outputFileXML <<
output << endl;
396 snprintf(
output,
sizeof output,
" <VERSION>version:1</VERSION>");
397 m_outputFileXML <<
output << endl;
399 m_outputFileXML <<
output << endl;
400 snprintf(
output,
sizeof output,
" <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME>");
401 m_outputFileXML <<
output << endl;
403 m_outputFileXML <<
output << endl;
405 m_outputFileXML <<
output << endl;
407 m_outputFileXML <<
output << endl;
409 m_outputFileXML <<
output << endl;
411 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HB</DETECTOR_NAME>");
413 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HE</DETECTOR_NAME>");
415 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HO</DETECTOR_NAME>");
417 snprintf(
output,
sizeof output,
" <DETECTOR_NAME>HF</DETECTOR_NAME>");
418 m_outputFileXML <<
output << endl;
419 snprintf(
output,
sizeof output,
" <HCAL_CHANNEL_ID>%10i</HCAL_CHANNEL_ID>", detid.
rawId());
420 m_outputFileXML <<
output << endl;
422 m_outputFileXML <<
output << endl;
424 m_outputFileXML <<
output << endl;
425 snprintf(
output,
sizeof output,
" <MEAN_TIME>%7f</MEAN_TIME>", time4);
426 m_outputFileXML <<
output << endl;
427 snprintf(
output,
sizeof output,
" <OFFSET_TIME> 0</OFFSET_TIME>");
428 m_outputFileXML <<
output << endl;
429 snprintf(
output,
sizeof output,
" <ERROR_STAT>%7f</ERROR_STAT>", dtime4);
430 m_outputFileXML <<
output << endl;
431 snprintf(
output,
sizeof output,
" <ANALYSIS_FLAG>%2i</ANALYSIS_FLAG>", m_fitflag + 1);
432 m_outputFileXML <<
output << endl;
433 snprintf(
output,
sizeof output,
" <STATUS_WORD> 0</STATUS_WORD>");
434 m_outputFileXML <<
output << endl;
436 m_outputFileXML <<
output << endl;
438 m_outputFileXML <<
output << endl;
441 else if (m_fitflag == 4) {
442 m_outFile << detid <<
" " << time1 <<
" " << dtime1 <<
" " << time2 <<
" " << dtime2 <<
" " << time3
443 <<
" " << dtime3 <<
" " << time4 <<
" " << dtime4 << std::endl;
452 char LedSampleNum[20];
454 sprintf(LedSampleNum,
"LedSample_%d",
sample);
456 m_file->mkdir(LedSampleNum);
457 m_file->cd(LedSampleNum);
460 GetLedConst(castorHists.LEDTRENDS);
465 for (_meol = toolT.begin(); _meol != toolT.end(); _meol++) {
468 sprintf(name,
"LED timing trend, eta=%d phi=%d depth=%d", detid.
ieta(), detid.
iphi(), detid.
depth());
469 int bins = _meol->second[10 + m_fitflag].second.first[0].size();
472 _meol->second[10 + m_fitflag].second.second.push_back(
new TH1F(name, name, bins, lo, hi));
474 std::vector<double>::iterator sample_it;
477 for (sample_it = _meol->second[10 + m_fitflag].second.first[0].begin();
478 sample_it != _meol->second[10 + m_fitflag].second.first[0].end();
480 _meol->second[10 + m_fitflag].second.second[0]->SetBinContent(++j, *sample_it);
483 for (sample_it = _meol->second[10 + m_fitflag].second.first[1].begin();
484 sample_it != _meol->second[10 + m_fitflag].second.first[1].end();
486 _meol->second[10 + m_fitflag].second.second[0]->SetBinError(++j, *sample_it);
488 sprintf(name,
"Sample (%d events)", m_nevtsample);
489 _meol->second[10 + m_fitflag].second.second[0]->GetXaxis()->SetTitle(name);
490 _meol->second[10 + m_fitflag].second.second[0]->GetYaxis()->SetTitle(
"Peak position");
491 _meol->second[10 + m_fitflag].second.second[0]->Write();
498 if (evt % m_nevtsample != 0)
502 if (
sample > 1 && m_fitflag != 4) {
504 m_file->cd(
"Castor");
505 LedTrendings(castorHists.LEDTRENDS);
510 m_file->cd(
"Castor");
511 castorHists.ALLLEDS->Write();
512 castorHists.LEDRMS->Write();
513 castorHists.LEDMEAN->Write();
518 cout <<
"Castor histograms written to " << m_outputFileROOT.c_str() << endl;
524 sample = (evt - 1) / m_nevtsample + 1;
525 evt_curr = evt % m_nevtsample;
527 evt_curr = m_nevtsample;
532 throw(
int) castor.
size();
535 _meol = castorHists.LEDTRENDS.find(digi.
id());
536 if (_meol == castorHists.LEDTRENDS.end()) {
537 SetupLEDHists(2, digi.
id(), castorHists.LEDTRENDS);
539 LedCastorHists(digi.
id(), digi, castorHists.LEDTRENDS, cond);
546 if (evt % m_nevtsample == 0)
551 string type =
"HBHE";
557 _meol = toolT.find(detid);
558 if (_meol == toolT.end()) {
560 map<int, LEDBUNCH>
insert;
562 for (
int i = 0;
i < 10;
i++) {
564 "%s Pulse height, eta=%d phi=%d depth=%d TS=%d",
570 insert[
i].first =
new TH1F(name, name, 200, 0., 2000.);
572 sprintf(name,
"%s LED Mean pulse, eta=%d phi=%d depth=%d", type.c_str(), detid.
ieta(), detid.
iphi(), detid.
depth());
573 insert[10].first =
new TH1F(name, name, 10, -0.5, 9.5);
574 sprintf(name,
"%s LED Pulse, eta=%d phi=%d depth=%d", type.c_str(), detid.
ieta(), detid.
iphi(), detid.
depth());
575 insert[11].first =
new TH1F(name, name, 10, -0.5, 9.5);
576 sprintf(name,
"%s Mean TS, eta=%d phi=%d depth=%d", type.c_str(), detid.
ieta(), detid.
iphi(), detid.
depth());
577 insert[12].first =
new TH1F(name, name, 200, 0., 10.);
578 sprintf(name,
"%s Peak TS, eta=%d phi=%d depth=%d", type.c_str(), detid.
ieta(), detid.
iphi(), detid.
depth());
579 insert[13].first =
new TH1F(name, name, 200, 0., 10.);
580 sprintf(name,
"%s Peak TS error, eta=%d phi=%d depth=%d", type.c_str(), detid.
ieta(), detid.
iphi(), detid.
depth());
581 insert[14].first =
new TH1F(name, name, 200, 0., 0.05);
582 sprintf(name,
"%s Fit chi2, eta=%d phi=%d depth=%d", type.c_str(), detid.
ieta(), detid.
iphi(), detid.
depth());
583 insert[15].first =
new TH1F(name, name, 100, 0., 50.);
585 name,
"%s Integrated Signal, eta=%d phi=%d depth=%d", type.c_str(), detid.
ieta(), detid.
iphi(), detid.
depth());
586 insert[16].first =
new TH1F(name, name, 500, 0., 5000.);
596 map<int, LEDBUNCH> _mei;
597 _meol = toolT.find(detid);
598 _mei = _meol->second;
600 if ((evt - 1) % m_nevtsample == 0 && state[0]) {
601 for (
int k = 0;
k < (
int)state.size();
k++)
603 for (
int i = 0;
i < 16;
i++)
616 for (
int TS = m_startTS; TS < m_endTS && TS < ledDigi.
size(); TS++) {
617 int capid = ledDigi[TS].capid();
619 int adc = (
int)(ledDigi[TS].
adc() - m_ped->getValue(capid));
624 double fC = m_coder->charge(*m_shape, adc, capid);
628 _mei[TS].first->Fill(ta);
629 _mei[10].first->AddBinContent(TS + 1, ta);
632 _mei[11].first->Reset();
633 _mei[11].first->SetBinContent(TS + 1, ta);
648 for (
int i = 0;
i < 10;
i++)
649 sum = sum + _mei[11].
first->GetBinContent(
i + 1);
651 if (m_fitflag == 2 || m_fitflag == 4) {
652 float timmean = _mei[11].first->GetMean();
653 float timmeancorr = BinsizeCorr(timmean);
654 _mei[12].first->Fill(timmeancorr);
656 _mei[16].first->Fill(
657 _mei[11].
first->Integral());
658 if (m_fitflag == 3 || m_fitflag == 4) {
659 _mei[11].first->Fit(
"landau",
"Q");
660 TF1*
fit = _mei[11].first->GetFunction(
"landau");
661 _mei[13].first->Fill(fit->GetParameter(1));
662 _mei[14].first->Fill(fit->GetParError(1));
663 _mei[15].first->Fill(fit->GetChisquare() / fit->GetNDF());
675 static const float tstrue[32] = {0.003, 0.03425, 0.06548, 0.09675, 0.128, 0.15925, 0.1905, 0.22175,
676 0.253, 0.28425, 0.3155, 0.34675, 0.378, 0.40925, 0.4405, 0.47175,
677 0.503, 0.53425, 0.5655, 0.59675, 0.628, 0.65925, 0.6905, 0.72175,
678 0.753, 0.78425, 0.8155, 0.84675, 0.878, 0.90925, 0.9405, 0.97175};
679 static const float tsreco[32] = {-0.00422, 0.01815, 0.04409, 0.07346, 0.09799, 0.12192, 0.15072, 0.18158,
680 0.21397, 0.24865, 0.28448, 0.31973, 0.35449, 0.39208, 0.43282, 0.47244,
681 0.5105, 0.55008, 0.58827, 0.62828, 0.6717, 0.70966, 0.74086, 0.77496,
682 0.80843, 0.83472, 0.86044, 0.8843, 0.90674, 0.92982, 0.95072, 0.9726};
684 int inttime = (
int)time;
685 float restime = time - inttime;
686 for (
int i = 0;
i <= 32;
i++) {
692 lolim = tsreco[
i - 1];
693 tsdown = tstrue[
i - 1];
695 tsdown = tstrue[31] - 1.;
700 tsup = tstrue[0] + 1.;
701 if (restime >= lolim && restime < uplim) {
702 corrtime = (tsdown * (uplim - restime) + tsup * (restime - lolim)) / (uplim - lolim);
T getUntrackedParameter(std::string const &, T const &) const
~CastorLedAnalysis()
Destructor.
HcalSubdetector subdet() const
get the subdetector
const CastorPedestal * getPedestal(const HcalGenericDetId &fId) const
int zside() const
get the z-side of the cell (1/-1)
void LedSetup(const std::string &m_outputFileROOT)
constexpr uint32_t rawId() const
get the raw id
std::vector< T >::const_iterator const_iterator
void LedTrendings(std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
void GetLedConst(std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
CastorLedAnalysis(const edm::ParameterSet &ps)
Constructor.
int depth() const
get the tower depth
void LedCastorHists(const HcalDetId &detid, const CastorDataFrame &ledDigi, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT, const CastorDbService &cond)
const CastorQIEShape * getCastorShape() const
int ieta() const
get the cell ieta
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
float BinsizeCorr(float time)
int ietaAbs() const
get the absolute value of the cell ieta
const_iterator end() const
int iphi() const
get the cell iphi
void SetupLEDHists(int id, const HcalDetId detid, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
void processLedEvent(const CastorDigiCollection &castor, const CastorDbService &cond)
const HcalCastorDetId & id() const
int size() const
total number of samples in the digi
const_iterator begin() const
const CastorQIECoder * getCastorCoder(const HcalGenericDetId &fId) const