52 JParser<> zap(
"Auxiliary application to plot PMT parameters as a function of variant.");
58 zap[
'a'] =
make_field(detectorFile,
"detector file.");
59 zap[
'f'] =
make_field(inputFile,
"output of JPrintDB -q \"integration\" -c \";\" -W1") =
"";
66 catch(
const exception &error) {
67 FATAL(error.what() << endl);
76 catch(
const JException& error) {
80 const JLocationRouter router(
detector);
82 JDetectorIntegration_t integration;
92 catch(
const exception& error) {
93 FATAL(error.what() << endl);
96 if (inputFile !=
"") {
98 integration.load(inputFile.c_str());
102 DEBUG(
"Reading database table " << getTable<JDetectorIntegration_t>() << endl);
106 ResultSet& rs =
getResultSet(getTable<JDetectorIntegration_t>());
108 if (! (rs >> integration)) {
109 THROW(JDatabaseException,
"Error reading " << getTable<JDetectorIntegration_t>());
112 catch(
const exception& error) {
113 FATAL(error.what() << endl);
117 integration.configure(detid);
121 JDetectorIntegration_t::range_type
range = integration.find(
PBS::PMT);
123 JManager<string, TH1D> H1(
new TH1D(
"TTS_ns[%]", NULL, 100, 0.0, 4.0));
124 JManager<string, TH1D> H2(
new TH1D(
"QE[%]", NULL, 100, 0.0, 2.0));
125 JManager<string, TH1D> H3(
new TH1D(
"gain[%]", NULL, 100, 0.0, 2.0));
126 JManager<string, TH1D> H4(
new TH1D(
"gainSpread[%]", NULL, 100, 0.0, 1.0));
128 for (JDetectorIntegration_t::range_const_iterator
i =
range.first;
i !=
range.second; ++
i) {
130 const JUPI_t upi = integration[
i->second].content.getUPI();
131 const JLocation_t location = product.getLocation(upi);
133 DEBUG(
"PMT " << left << setw(24) << upi.getVariant() << right <<
' ' << location << endl);
135 if (location.is_valid()) {
137 const JModule& module = router.getModule(JLocation(location.string, location.floor));
138 const JPMTParameters& buffer =
parameters.getPMTParameters(JPMTIdentifier(module.getID(), location.position));
140 H1[upi.getVariant()]->Fill(buffer.TTS_ns);
141 H2[upi.getVariant()]->Fill(buffer.QE);
142 H3[upi.getVariant()]->Fill(buffer.gain);
143 H4[upi.getVariant()]->Fill(buffer.gainSpread);
149 out << H1 << H2 << H3 << H4;
Utility class to parse command line options.
static JGetPBSSequences getPBSSequences
Function object to get PBS sequences as a function of PBS.
static const JPBS_t PMT(3, 4, 2, 3)
PBS of photo-multiplier tube (PMT)
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
ResultSet & getResultSet(const std::string &query)
Get result set.
std::vector< JServer > getServernames()
Get list of names of available database servers.
do set_variable DETECTOR_TXT $WORKDIR detector
#define DEBUG(A)
Message macros.