38 bool overwriteDetector;
43 JParser<> zap(
"Auxiliary program to update the PMT status in the detector file based on the fraction of short time-over-threshold values.");
45 zap[
'f'] =
make_field(inputFile,
"input file (output from JCalibrateToT).");
46 zap[
'a'] =
make_field(detectorFile,
"detector file.");
48 zap[
't'] =
make_field(fraction,
"maximal fraction of signal allowed for noise.") = 0.5;
49 zap[
'A'] =
make_field(overwriteDetector,
"overwrite detector file.");
54 catch(
const exception& error) {
55 FATAL(error.what() << endl);
71 NOTICE(
"Set detector version to " <<
detector.getVersion() << endl);
75 gErrorIgnoreLevel = kError;
77 TFile* in = TFile::Open(inputFile.c_str(),
"exist");
79 if (in == NULL || !in->IsOpen()) {
80 FATAL(
"File: " << inputFile <<
" not opened." << endl);
84 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
86 if (!module->empty()) {
92 for (
int ix = 1; ix <= h2s->GetXaxis()->GetNbins(); ++ix) {
97 for (
int iy = 1; iy <= h2s->GetYaxis()->GetNbins(); ++iy) {
99 const double x = h2s->GetYaxis()->GetBinCenter(iy);
100 const double y = h2s->GetBinContent(ix, iy);
109 const bool disable = noise > fraction * signal;
112 cout <<
"PMT " <<
FILL(10,
'0') << module->getID() <<
"." <<
FILL(2,
'0') << (ix - 1) <<
FILL()
113 <<
" noise/signal " <<
FIXED(7,0) << noise <<
"/" <<
FIXED(7,0) << signal << (disable ?
" *" :
"") << endl;
116 if (overwriteDetector) {
118 module->getPMT(ix - 1).getStatus().set(
PMT_DISABLE);
125 WARNING(
"No histogram for module " << module->getID() <<
"; skip." << endl);
132 if (overwriteDetector) {
134 NOTICE(
"Store PMT status on file " << detectorFile << endl);
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Utility class to parse command line options.
static const char *const _2SToT
Histogram naming.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const int PMT_DISABLE
KM3NeT Data Definitions v3.4.0-8-ge14cb17 https://git.km3net.de/common/km3net-dataformat.
Auxiliary data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
Type definition of range.