6 #include <calobase/RawTower.h>
7 #include <calobase/RawTowerContainer.h>
8 #include <calobase/RawTowerDefs.h>
10 #include <phparameter/PHParameters.h>
22 #include <boost/format.hpp>
40 , _calib_towers(nullptr)
41 , _raw_towers(nullptr)
43 , _calib_tower_node_prefix(
"CALIB")
44 , _raw_tower_node_prefix(
"RAW")
46 , _fit_type(kPowerLawDoubleExpWithGlobalFitConstraint)
58 std::cout <<
Name() <<
"::" <<
detector <<
"::" << __PRETTY_FUNCTION__
59 <<
" - print calibration parameters: " << endl;
71 std::cout <<
Name() <<
"::" <<
detector <<
"::" << __PRETTY_FUNCTION__
72 <<
"Process event entered" << std::endl;
75 map<int, double> parameters_constraints;
78 std::cout <<
"hey tim did we get here? " << std::endl;
86 <<
Name() <<
"::" <<
detector <<
"::" << __PRETTY_FUNCTION__
87 <<
"Extract global fit parameter for constraining individual fits"
94 vector<float> timtest;
95 vector<vector<float>> timtest2;
100 for (rtiter = begin_end.first; rtiter != begin_end.second; ++rtiter)
114 vec_signal_samples[
i] =
115 numeric_limits<double>::quiet_NaN();
122 timtest2.push_back(timtest);
128 std::cout<< timtest2.size() << std::endl;
134 vec_signal_samples[
i] /=
count;
138 double peak_sample = NAN;
139 double pedstal = NAN;
140 map<int, double> parameters_io;
143 peak_sample, pedstal,
151 parameters_constraints[1] = parameters_io[1];
152 parameters_constraints[2] = parameters_io[2];
153 parameters_constraints[3] = parameters_io[3];
154 parameters_constraints[5] = parameters_io[5];
155 parameters_constraints[6] = parameters_io[6];
180 std::cout <<
Name() <<
"::" <<
detector <<
"::" << __PRETTY_FUNCTION__
181 <<
": Failed to build signal template! Fit each channel "
182 "individually instead"
187 const double calib_const_scale =
189 const bool use_chan_calibration =
194 for (rtiter = begin_end.first; rtiter != begin_end.second; ++rtiter)
201 double calibration_const = calib_const_scale;
203 if (use_chan_calibration)
207 const int row = raw_tower->
get_row();
212 string calib_const_name(
218 vector<double> vec_signal_samples;
225 double peak_sample = NAN;
226 double pedstal = NAN;
242 map<int, double> parameters_io;
245 peak_sample, pedstal,
252 map<int, double> parameters_io(parameters_constraints);
255 peak_sample, pedstal,
260 cout << __PRETTY_FUNCTION__ <<
" - FATAL error - unkown fit type "
282 calib_tower->
set_energy(peak * calibration_const);
297 std::cout <<
Name() <<
"::" <<
detector <<
"::" << __PRETTY_FUNCTION__
299 <<
", output sum digitalized value = "
315 std::cerr <<
Name() <<
"::" <<
detector <<
"::" << __PRETTY_FUNCTION__
316 <<
"DST Node missing, doing nothing." << std::endl;
317 throw std::runtime_error(
318 "Failed to find DST node in RawTowerCalibration::CreateNodes");
326 std::cerr <<
Name() <<
"::" << detector <<
"::" << __PRETTY_FUNCTION__
330 " node in RawTowerCalibration::CreateNodes");
336 dstiter.
findFirst(
"PHCompositeNode", detector));
340 dstNode->addNode(DetNode);
353 DetNode->addNode(towerNode);