10#include "TFitResult.h"
46 static const char*
const WILDCARD =
"%";
99 JParser<> zap(
"Auxiliary program to fit time-over-threshold distributions.");
101 zap[
'f'] =
make_field(inputFile,
"input file (output from JCalibrateToT).");
104 zap[
'P'] =
make_field(
pmtFile,
"specify PMT file name that can be given to JTriggerEfficiency.") =
"";
106 zap[
'O'] =
make_field(option,
"ROOT fit options, see TH1::Fit") =
"";
114 catch(
const exception &error) {
144 if (option.find(
'R') == string::npos) { option +=
'R'; }
145 if (option.find(
'S') == string::npos) { option +=
'S'; }
149 TFile* in = TFile::Open(inputFile.c_str(),
"exist");
151 if (in ==
NULL || !in->IsOpen()) {
152 FATAL(
"File: " << inputFile <<
" not opened." <<
endl);
159 TH1D chi2(
"chi2",
NULL, 100, 0.0, 5.0);
194 const double ny = h2s->GetYaxis()->GetNbins();
195 const double ymin = h2s->GetYaxis()->GetXmin();
196 const double ymax = h2s->GetYaxis()->GetXmax();
209 DEBUG(
"Processing histogram " << name <<
endl);
215 for (
int iy = h2s->GetNbinsY();
iy >= 1; --
iy) {
217 const double w = h1.GetBinWidth (
iy);
218 const double y = h2s->GetBinContent(
ix,
iy);
220 h1.SetBinContent(
iy, y/w);
221 h1.SetBinError (
iy, sqrt(y)/w);
226 const double weight = h1.Integral(h1.FindBin(range.
getLowerLimit()),
229 if (weight <=
Wmin) {
231 WARNING(
"Insufficient histogram entries for PMT " <<
id <<
232 "(" << weight <<
" < " <<
Wmin <<
"); skip fit." <<
endl);
253 for (
int i = h1.GetBinCenter(
ny-1);
254 i > h1.GetBinCenter(h1.FindBin(parameters.
mean_ns + parameters.
sigma_ns));
257 const double x = h1.GetBinCenter (i);
258 const double y = h1.GetBinContent(i);
260 const double gradient = ( (h1.GetBinContent(i-1) - h1.GetBinContent(i+1)) /
261 (h1.GetBinCenter (i+1) - h1.GetBinCenter (i-1)) );
296 JFitToT fit(parameters, range);
308 WARNING(
"Invalid initial gain for PMT " <<
id <<
"; set default values." <<
endl);
326 FATAL(
"Invalid TFitResultPtr " << h1.GetName() <<
endl);
331 WARNING(
"Fit failure for PMT " <<
id <<
"; set initialization values." <<
endl);
333 h1.GetListOfFunctions()->Clear();
346 (option.find(
"0") == string::npos && option.find(
"N") == string::npos)) {
355 JFitToT::getNumberOfModelParameters());
356 f1->SetParameters(fit.GetParameters());
360 h1.GetListOfFunctions()->Add(f1);
401 const JMeta* meta = in.next();
403 buffer.push_back(*meta);
KM3NeT DAQ constants, bit handling, etc.
Data structure for detector geometry and calibration.
Recording of objects on file according a format that follows from the file name extension.
int main(int argc, char **argv)
General purpose messaging.
#define DEBUG(A)
Message macros.
PMT analogue signal processor.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
#define MAKE_CSTRING(A)
Make C-string.
#define MAKE_STRING(A)
Make string.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Auxiliary class to define a range between two values.
Scanning of objects from a single file according a format that follows from the extension of each fil...
ROOT TTree parameter settings of various packages.
Auxiliary class for map of PMT parameters.
Data structure for PMT parameters.
double sigma_ns
time-over-threshold standard deviation of threshold-band hits [ns]
double gainSpread
gain spread [unit]
double mean_ns
mean time-over-threshold of threshold-band hits [ns]
double saturation
saturation [ns]
Utility class to parse parameter values.
Template definition of a multi-dimensional oscillation probability interpolation table.
void load()
Load oscillation probability table.
static const char *const _2SToT
Histogram naming.
static const double FITTOT_GAINSPREAD_MAX
Default maximal gain spread.
static const std::string FITTOT_FNAME
static const std::string FITTOT_SUFFIX
static const double FITTOT_GAIN_MAX
Default maximal gain.
static const double FITTOT_GAIN_MIN
Default minimal gain.
static const double FITTOT_GAINSPREAD_MIN
Default minimal gain spread.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
const double TIME_OVER_THRESHOLD_NS
Specification for time-over-threshold corresponding to a one photo-electron pulse.
std::string replace(const std::string &input, const std::string &target, const std::string &replacement)
Replace tokens in string.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool setParLimits(TF1 &f1, const Int_t index, Double_t xmin, Double_t xmax)
Set fit parameter limits.
KM3NeT DAQ data structures and auxiliaries.
static const char WILDCARD
Auxiliary data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
Type definition of range.
Fit parameters for two-fold coincidence rate due to K40.
Double_t gainSpread
PMT gain spread.
const Double_t getModelParameter(const int i) const
Get model parameter.
Parametrisation of time-over-threshold distribution.
Double_t getValue(const Double_t *x, const Double_t *par)
Get rate as a function of the fit parameters.
const JPMTAnalogueSignalProcessor & getCPU() const
Access method for the analogue signal processor.
void store(const char *file_name) const
Store to output file.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...