35 inline double getEfficiency(
const JPMTParameters& parameters)
40 static const char*
const EFFICIENCY =
"EFFICIENCY";
51 int main(
int argc,
char **argv)
68 JParser<> zap(
"Auxiliary application to plot PMT parameters.");
70 zap[
'a'] =
make_field(detectorFile,
"detector file.");
71 zap[
'P'] =
make_field(inputFile,
"PMT calibration data file(s)");
73 zap[
'r'] =
make_field(regexp,
"regular expresion to extract bin labels for the x-axis") =
"";
74 zap[
'A'] =
make_field(showPMTAddress,
"show PMT address on y-axis");
75 zap[
'L'] =
make_field(labelInterval,
"interval between x-axis bins for which labels are shown") = 1;
76 zap[
'R'] =
make_field(relative,
"monitor changes relative to first input");
81 catch(
const exception &error) {
82 FATAL(error.what() << endl);
95 FATAL(
"Empty detector." << endl);
105 const int NUMBER_OF_FILES = parameters.size();
108 NUMBER_OF_FILES, -0.5, NUMBER_OF_FILES - 0.5,
111 manager->Sumw2(kFALSE);
115 const int n = (NUMBER_OF_FILES < labelInterval) ? 1 : labelInterval;
117 const TPRegexp buffer(regexp);
119 for (
int i = 0; i != NUMBER_OF_FILES; ++i) {
122 manager->GetXaxis()->SetBinLabel(i+1 ,
parse(buffer, TString(inputFile[i].c_str())));
124 manager->GetXaxis()->SetBinLabel(i+1 ,
" ");
128 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
130 DEBUG(
"Module " << setw(10) << module->getID() << endl);
136 for (
int i = 0; i != NUMBER_OF_FILES; ++i) {
140 for (JProperties::const_iterator p = properties.begin(); p != properties.end(); ++p) {
144 try { value = (p->second.getValue<
const double>()); }
catch(
const exception& error) {}
145 try { value = (p->second.getValue<
const bool>() ? 1.0 : 0.0); }
catch(
const exception& error) {}
147 if (i == 0) { buffer[p->first] = value; }
148 if (relative) { value -= buffer[p->first]; }
150 manager[
MAKE_CSTRING(module->getID() <<
"." << p->first)]->SetBinContent(i + 1, pmt + 1, value);
153 double value = getEfficiency(parameters[i].getPMTParameters(
JPMTIdentifier(module->getID(), pmt)));
155 if (i == 0) { buffer[EFFICIENCY] = value; }
156 if (relative) { value -= buffer[EFFICIENCY]; }
158 manager[
MAKE_CSTRING(module->getID() <<
"." << EFFICIENCY)]->SetBinContent(i + 1, pmt + 1, value);
164 i->second->Sumw2(kFALSE);
167 if (showPMTAddress) {
175 istringstream(i->first) >> id;
KM3NeT DAQ constants, bit handling, etc.
Data structure for detector geometry and calibration.
Dynamic ROOT object management.
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int main(int argc, char **argv)
I/O formatting auxiliaries.
#define MAKE_CSTRING(A)
Make C-string.
Lookup table for PMT addresses in detector.
const JModuleAddressMap & get(const int id) const
Get module address map.
Auxiliary class for map of PMT parameters.
Data structure for PMT parameters.
Utility class to parse parameter values.
Utility class to parse command line options.
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double getSurvivalProbability(const JPMTParameters ¶meters)
Get model dependent probability that a one photo-electron hit survives the simulation of the PMT assu...
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map.
void setAxisLabels(TAxis *axis, const JModuleAddressMap &memo)
Set axis with PMT address labels.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
boost::property_tree::ptree parse(std::string str)