8 #include <onlmon/OnlMon.h>
9 #include <onlmon/OnlMonServer.h>
10 #include <onlmon/pseudoRunningMean.h>
12 #include <caloreco/CaloWaveformFitting.h>
13 #include <calobase/TowerInfoDefs.h>
15 #include <Event/Event.h>
16 #include <Event/EventTypes.h>
17 #include <Event/msg_profile.h>
78 const char *cemccalib = getenv(
"CEMCCALIB");
81 std::cout <<
"CEMCCALIB environment variable not set" << std::endl;
85 std::ifstream calib(fullfile);
89 printf(
"CemcMon::Init()\n");
92 h2_cemc_hits =
new TH2F(
"h2_cemc_hits",
"", 96, 0, 96, 256, 0, 256);
93 h2_cemc_rm =
new TH2F(
"h2_cemc_rm",
"" , 96, 0, 96, 256, 0, 256);
94 h2_cemc_mean =
new TH2F(
"h2_cemc_mean",
"", 96, 0, 96, 256, 0, 256);
95 h1_cemc_adc =
new TH1F(
"h1_cemc_adc",
"",1000,0.5,pow(2,14));
97 h1_event =
new TH1F(
"h1_event",
"", 1, 0, 1);
100 h2_waveform_twrAvg =
new TH2F(
"h2_waveform_twrAvg",
"", 16, 0.5, 16.5, 10000,0,15000);
117 for (
int ih = 0; ih <
Nsector; ih++)
133 cemc_occupancy =
new TH2F(h_id.c_str(),
"cemc_occupancy plot", 48*2 , -48 , 48, 32*8, -0.5, 255.5 );
140 h_id =
"cemc_runningmean";
141 cemc_runningmean =
new TH2F(h_id.c_str(),
"Cemc Running Mean Run 0 Event 0", 48*2 , -48 , 48, 32*8, -0.5, 255.5 );
148 cemc_signal =
new TH1F(
"cemc_signal",
"Signal Distribution", 512 , -200., 4000);
173 for (
int ih = 0; ih <
Nsector; ih++)
179 for (
int i = 0;
i < 64;
i++)
191 if (getenv(
"CEMCCALIB"))
193 cemctemplate = getenv(
"CEMCCALIB");
199 cemctemplate +=
std::string(
"/testbeam_cemc_template.root");
211 std::vector<runningMean*>::iterator rm_it;
230 for (
int s = 0;
s< 3;
s++)
232 baseline += p->
iValue(
s,channel);
238 for (
int s = 3;
s< p->
iValue(0,
"SAMPLES");
s++)
241 signal += p->
iValue(
s,channel) - baseline;
248 std::vector<float> result;
249 result.push_back(signal);
259 std::vector<float> waveform;
262 waveform.push_back(p->
iValue(
s,channel));
264 std::vector<std::vector<float>> multiple_wfs;
265 multiple_wfs.push_back(waveform);
267 std::vector<std::vector<float>> fitresults_cemc;
270 std::vector<float> result;
271 result = fitresults_cemc.at(0);
278 std::vector<float> waveform;
282 waveform.push_back(p->
iValue(
s,channel));
284 std::vector<std::vector<float>> multiple_wfs;
285 multiple_wfs.push_back(waveform);
287 std::vector<std::vector<float>> fitresults_cemc;
290 std::vector<float> result;
291 result = fitresults_cemc.at(0);
299 float sectorAvg[
Nsector] = {0};
300 unsigned int towerNumber = 0;
314 int nChannels = p->
iValue(0,
"CHANNELS");
319 for (
int c = 0;
c < nChannels;
c++)
326 float signalFast = resultFast.at(0);
327 float timeFast = resultFast.at(1);
328 float pedestalFast = resultFast.at(2);
330 for (
int s = 0;
s < p->
iValue(0,
"SAMPLES");
s++)
345 int sectorNumber = phi_bin / 8 + 1;
349 int bin =
h2_cemc_mean->FindBin(eta_bin + 0.5, phi_bin + 0.5);
351 sectorAvg[sectorNumber - 1] += signalFast;
389 int sectorNumber = phi_bin / 8 + 1;
395 int bin =
h2_cemc_mean->FindBin(eta_bin + 0.5, phi_bin + 0.5);
397 sectorAvg[sectorNumber -1] += 0.;
399 float signalFast = 0.0;
421 int sectorNumber = phi_bin / 8 + 1;
423 int bin =
h2_cemc_mean->FindBin(eta_bin + 0.5, phi_bin + 0.5);
425 sectorAvg[sectorNumber -1] += 0;
427 float signalFast = 0;
440 for (
int isec = 0; isec <
Nsector; isec++)
442 sectorAvg[isec] /= 48;