7 if(configfile!=
"") m_variables.Initialise(configfile);
11 bool use_stopwatch =
false;
12 m_variables.Get(
"use_stopwatch", use_stopwatch);
28 std::cout<<
" Dump of all hits before calibration."<<std::endl;
38 std::cout<<
" Dump of all hits after calibration. "<<std::endl;
61 if(
m_verbose>
DEBUG1)std::cout<<
" Apply calibration to PMT with ID "<<PMTid<<std::endl;
66 std::cout<<
" apply calibration, masked : "<<location->second.masked<<
" and charge scaling "<<location->second.chargeScaling<<std::endl;
67 masked=location->second.masked;
68 charge*=location->second.chargeScaling;
74 for (
auto& sample : samples )
77 for(
int hit=sample.m_first_unique;hit<sample.m_PMTid.size();hit++)
79 bool masked=sample.m_masked[hit];
85 sample.m_masked[hit]=masked;
96 std::ifstream input(calibrationFileName);
100 std::cout<<
"Failed to open "<<calibrationFileName<<
" to read in calibration information "<<std::endl;
105 std::string headerName ;
107 float calibrationVersion;
109 if(headerName.compare(
"HKDAQCalibration")!=0)
112 std::cout<<
" Calibration data header does not start with HKDAQCalibration - no calibration possible "<<std::endl;
117 input >>headerVersion;
118 input >>calibrationVersion;
122 std::ios oldState(
nullptr);
123 oldState.copyfmt(std::cout);
124 std::cout<<
" Calibration information read from "<<calibrationFileName<<std::endl<<
125 " File format "<<std::fixed<<std::setprecision( 2 )<<headerVersion<<
" calibrationVersion "<<calibrationVersion <<std::endl<<
126 " PMT Channel ID : masked? : charge scaling factor "<<std::endl;
127 std::cout.copyfmt(oldState);
146 std::cout<<element.first<<
" "<<element.second.masked<<
" "<<element.second.chargeScaling<<std::endl;
155 std::cout<<
" loop over "<<samples.size()<<
" values "<<std::endl;
156 for (
auto sample : samples)
158 std::cout<<
" loop over "<<sample.m_PMTid.size()<<
" hits "<<std::endl;
160 for(
int hit=sample.m_first_unique;hit<sample.m_PMTid.size();hit++)
162 bool masked=sample.m_masked[hit];
164 sample.m_charge[hit],
173 std::cout<<PMTid<<
" "<<charge<<
" "<<time<<
" mask "<<masked<<std::endl;
std::string m_calibration_file_name
File name for file containg calibration information.
std::string Result(std::string method_name, std::string output_file="")
bool Finalise()
Clean up resources.
float short_time_t
Type for relative hit times within a SubSample. Unit = ns.
util::Stopwatch * m_stopwatch
The stopwatch, if we're using one.
void Start()
Start the stopwatch.
StopwatchTimes Stop()
Stop the stopwatch, returning the CPU time.
void DumpHit(const int &PMTid, float &charge, TimeDelta::short_time_t &time, bool &masked)
bool Initialise(std::string configfile, DataModel &data)
std::string m_stopwatch_file_name
Image filename to save the histogram to, if required.
std::map< PMTChannelID, calibrationData > calibrationInformation
Calibration data store.
Calibrate()
Constructor. Sets validCalibrationDataFound false.
void DumpHits(std::vector< SubSample > &samples)
void ApplyCalibration(std::vector< SubSample > &samples)
void readCalibration(std::string calibrationFileName)
bool Execute()
Applly the calibration to the contents of m_data . Calls ApplyCalibration to do the work...
void Log(const std::string &message, const int message_level)
Format messages in the same way as for tools.
Calibration data format for use at run time.
static bool validCalibrationDataFound
Remember whether a valid calibration data file has been read in or not.
int m_verbose
Verbosity level, as defined in tool parameter file.