9 #include <Event/Event.h>
10 #include <Event/packet.h>
34 double N_lan = par[1];
36 double width = par[3];
38 double result = ped + N_lan*TMath::Landau(x, peak, width);
45 , s_outfilename(
"testout.root")
48 , m_packet_high(21352)
77 TH1F *h_waveform =
new TH1F(
"h_waveform",
"",
nsamples, -0.5,
nsamples - 0.5);
80 Event *_event = findNode::getClass<Event>(topNode,
"PRDF");
81 if (_event ==
nullptr)
83 std::cout <<
"CaloUnpackPRDF::Process_Event - Event not found" << std::endl;
95 int nchannels = packet->
iValue(0,
"CHANNELS");
107 std::vector<float> waveform;
109 for (
int samp = 0; samp <
nsamples; samp++)
111 h_waveform->SetBinContent(samp + 1, packet->
iValue(samp,
channel));
114 maxbin = h_waveform->GetMaximumBin();
115 if (maxbin > 12){
continue;}
116 if (maxbin <= 5) {
continue;}
117 if (h_waveform->GetMaximum() < 2000){
continue;}
122 pedestal = 0.5 * (h_waveform->GetBinContent(maxbin - 6) + h_waveform->GetBinContent(maxbin - 5));
127 if (h_waveform->GetBinContent(
j) - pedestal > 0)
129 sum += h_waveform->GetBinContent(
j) -
pedestal;
134 if (((h_waveform->GetBinContent(
j+1)) - pedestal) > 0)
136 h_waveform->SetBinContent(
j + 1, ((h_waveform->GetBinContent(
j+1)) - pedestal)/
sum);
140 h_waveform->SetBinContent(
j + 1,0);
144 if (h_waveform->GetBinContent(h_waveform->GetMaximumBin()) > 0.33){
continue;}
149 if ( h_waveform->GetBinContent(
k) > 1.05 * h_waveform->GetBinContent(
k-1))
154 if (pileup){
continue;}
156 f_rising_func->SetParameters(0, 0.1, static_cast<double>(h_waveform->GetBinCenter(maxbin)), 1);
157 f_rising_func->FixParameter(0, 0);
158 f_rising_func->SetParLimits(2,static_cast<double>(h_waveform->GetBinCenter(maxbin - 1)), static_cast<double>(h_waveform->GetBinCenter(maxbin + 1)));
159 f_rising_func->SetParLimits(3, 0.5, 3);
160 f_rising_func->SetRange(static_cast<float>(h_waveform->GetBinCenter(maxbin-3)), static_cast<float>(h_waveform->GetBinCenter(maxbin+1)));
161 h_waveform->Fit(
"f_rising_func",
"NRQ");
162 hm = f_rising_func->GetParameter(2) - 1.5*f_rising_func->GetParameter(3);
165 bool skipwaveform =
false;
166 for (
int i = h_waveform->GetMaximumBin() + 5;
i <
nsamples ;
i++)
168 if (h_waveform->GetMaximum() <
binscale*h_waveform->GetBinContent(
i))
174 if (skipwaveform){
continue;}