8 #include <onlmon/OnlMon.h>
9 #include <onlmon/OnlMonDB.h>
10 #include <onlmon/OnlMonServer.h>
11 #include <onlmon/pseudoRunningMean.h>
13 #include <Event/msg_profile.h>
14 #include <calobase/TowerInfoDefs.h>
15 #include <caloreco/CaloWaveformFitting.h>
17 #include <Event/Event.h>
18 #include <Event/EventTypes.h>
19 #include <Event/msg_profile.h>
49 std::vector<runningMean *>::iterator rm_it;
67 gRandom->SetSeed(rand());
83 printf(
"doing the Init\n");
95 double ADCcorrmax = 2e4;
97 double hitscorrmax = 1000;
98 h_ADC_corr =
new TH2F(
"h_ADC_corr",
";ADC avg sum (south); ADC avg sum (north)", nADCcorr, 0, ADCcorrmax, nADCcorr, 0, ADCcorrmax);
99 h_hits_corr =
new TH2F(
"h_hits_corr",
";ADC avg sum (south); ADC avg sum (north)", nhitscorr, 0, hitscorrmax, nhitscorr, 0, hitscorrmax);
101 h_event =
new TH1F(
"h_event",
"", 1, 0, 1);
120 for (
int i = 0;
i < 6;
i++)
153 for (
int ichannel = 0; ichannel <
nChannels; ichannel++)
155 h_ADC_channel[ichannel] =
new TH1F(Form(
"h_ADC_channel%d", ichannel),
";ADC;Counts", 1000, 0, 15e3);
165 if (getenv(
"SEPDCALIB"))
167 sepdtemplate = getenv(
"SEPDCALIB");
173 sepdtemplate +=
std::string(
"/testbeam_sepd_template.root");
184 std::vector<runningMean *>::iterator rm_it;
204 for (
int s = 0;
s < 3;
s++)
206 baseline += p->
iValue(
s, channel);
212 for (
int s = 3;
s < p->
iValue(0,
"SAMPLES");
s++)
215 signal += p->
iValue(
s, channel) - baseline;
222 std::vector<float> result;
223 result.push_back(signal);
231 std::vector<float> waveform;
232 for (
int s = 0;
s < p->
iValue(0,
"SAMPLES");
s++)
234 waveform.push_back(p->
iValue(
s, channel));
236 std::vector<std::vector<float>> multiple_wfs;
237 multiple_wfs.push_back(waveform);
239 std::vector<std::vector<float>> fitresults_sepd;
242 std::vector<float> result;
243 result = fitresults_sepd.at(0);
250 std::vector<float> waveform;
251 for (
int s = 0;
s < p->
iValue(0,
"SAMPLES");
s++)
253 waveform.push_back(p->
iValue(
s, channel));
255 std::vector<std::vector<float>> multiple_wfs;
256 multiple_wfs.push_back(waveform);
258 std::vector<std::vector<float>> fitresults_sepd;
261 std::vector<float> result;
262 result = fitresults_sepd.at(0);
271 unsigned int ChannelNumber = 0;
278 long double sumADC_s = 0;
279 long double sumADC_n = 0;
295 int nPacketChannels = p->
iValue(0,
"CHANNELS");
305 for (
int c = 0;
c < p->
iValue(0,
"CHANNELS");
c++)
315 float signalFast = resultFast.at(0);
316 float timeFast = resultFast.at(1);
317 float pedestalFast = resultFast.at(2);
325 for (
int s = 0;
s < p->
iValue(0,
"SAMPLES");
s++)
332 if (ChMap == -1)
continue;
350 float signal = signalFast;
360 phi_in = (phi_bin >=
nPhi0 / 2) ? phi_bin -
nPhi0 / 2 : phi_bin +
nPhi0 / 2;
366 std::cout <<
"Excess of channel range! Wrong mapping -- return -1 " << std::endl;
375 phi_in = (phi_bin >=
nPhi / 2) ? phi_bin -
nPhi / 2 : phi_bin +
nPhi / 2;
381 std::cout <<
"Excess of channel range! Wrong mapping -- return -1 " << std::endl;
390 std::cout <<
"r_bin not assigned ... " << std::endl;
400 phi_in = (phi_bin >=
nPhi0 / 2) ? phi_bin -
nPhi0 / 2 : phi_bin +
nPhi0 / 2;
406 std::cout <<
"Excess of channel range! Wrong mapping -- return -1 " << std::endl;
415 phi_in = (phi_bin >=
nPhi / 2) ? phi_bin -
nPhi / 2 : phi_bin +
nPhi / 2;
421 std::cout <<
"Excess of channel range! Wrong mapping -- return -1 " << std::endl;
430 std::cout <<
"r_bin not assigned ... " << std::endl;
436 std::cout <<
"z_bin not assigned ... " << std::endl;
444 ChannelNumber += 128;
457 h_ADC_corr->Fill(sumADC_s / sumhit_s, sumADC_n / sumhit_n);
478 chmap = ch - nch / 2;
481 chmap = 2 * (ch - 16 * nch) + 31 * (nch / 2) - 1;
484 else if (nch % 2 == 1)
486 if ((ch - 16) % 32 == 0)
490 chmap = 2 * (ch - 16 * nch) + 31 * ((nch - 1) / 2);
495 std::cout <<
"WRONG Channel map !!!! " << std::endl;