46 JUPITable(
const char*
const fileName)
51 ifstream
in(fileName);
58 entry.PRODUCER_SERIAL; ) {
60 if (entry.PBS.is_valid() &&
62 entry.SERIALNUMBER >= 0) {
64 number2upi[entry.PBS][entry.SERIALNUMBER] =
JUPI_t(entry.PBS,
89 if (p == number2upi[pbs].end()) {
91 p = number2upi[
pbs].find(number);
93 if (p == number2upi[pbs].end()) {
113 int main(
int argc,
char **argv)
128 double HVstepMin = 2 * 3.14;
158 JParser<> zap(
"Example program to find optimal HV-settings.");
160 zap[
'f'] =
make_field(inputFile,
"input file (ROOT format)");
162 zap[
'a'] =
make_field(detectorFile,
"detector file");
163 zap[
'b'] =
make_field(UPIFile,
"PMT UPI ASCII table");
170 catch(
const exception &error) {
171 FATAL(error.what() << endl);
174 if (login.empty() || locationID.empty()) {
176 FATAL(
"Missing user information (please specify via -#login and -#locationID");
178 }
else if (testType.empty()) {
180 FATAL(
"Missing database test type (please specify via -#testType)");
184 const JUUID& UUID = JUUID::rndm();
189 timer->tm_sec -= elapsedTime;
196 catch (
const exception& error) {
197 FATAL(error.what() << endl);
202 JUPITable fetchUPI(UPIFile.c_str());
207 TFile input(inputFile.c_str(),
"READ");
219 JHVGainGraph::setMinHVDistance(HVstepMin);
220 JHVGainGraph::setHVRange (HVrange);
221 JHVGainGraph::setGainRange (gainRange);
223 NOTICE(
"Searching optimal high-voltage settings..." << endl <<
224 LEFT(30) <<
"UPI" <<
CENTER(35) <<
"(identifer / location)" <<
RIGHT(35) <<
"Inter-/Extrapolated high-voltage [-]" << endl);
228 const string&
name = it->first;
233 const int seppos = name.find(
'.');
234 const int moduleID = stoi(name.substr(0, seppos));
235 const int tdc = stoi(name.substr(seppos + 1, seppos + 3));
241 const string location =
MAKE_STRING(right <<
FILL(4,
'0') << module.getLocation().getString() <<
'.' <<
242 right <<
FILL(2,
'0') << module.getLocation().getFloor() <<
'.' <<
243 right <<
FILL(2,
'0') << tdc);
245 NOTICE(
LEFT(30) << pmtUPI <<
"(a.k.a. " << name <<
" / " << location <<
"): ");
252 NOTICE(right <<
FIXED(20,2) << result <<
" +/- " <<
FIXED(4,2) << error << endl);
258 WARNING(
"Could not find high-voltage corresponding to target gain; Setting zero." << endl);
274 js[
EndTime_t] = timer().toString(format);
279 ofs << setw(2) << setprecision(8);
Utility class to parse command line options.
static const std::string UUID_t
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Data structure for a composite optical module.
static const std::string Failed_t
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
static const std::string Tests_t
static const JPBS_t PMT(3, 4, 2, 3)
PBS of photo-multiplier tube (PMT)
static const std::string OK_t
static const double FITTOT_GAIN_MAX
Default maximal gain.
static const double FITTOT_GAIN_MIN
Default minimal gain.
Router for direct addressing of module data in detector data structure.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Utility class to parse parameter values.
static const std::string Location_t
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
JDateAndTimeFormat
Date and time formats.
Universal product identifier (UPI).
Dynamic ROOT object management.
Auxiliary data structure for floating point format specification.
bool interpolate(const double gainTarget)
Inter-/Extrapolate the high-voltage value corresponding to the target gain value. ...
Data structure for detector geometry and calibration.
#define MAKE_STRING(A)
Make string.
double getTargetHVError(const double gainTarget)
Get error estimate on high-voltage corresponding to given target gain value.
Auxiliary data structure for alignment of data.
Auxiliary data structure to store high-voltage versus gain data and interpolate the nominal high-volt...
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getID() const
Get identifier.
Data structure for PMT geometry and calibration.
static const std::string Test_t
const double NOMINAL_GAIN
Specification for normalized gain corresponding to a one photo-electron pulse.
General purpose messaging.
Auxiliary data structure for sequence of same character.
const JPMT & getPMT(const JPMTIdentifier &id) const
Get PMT parameters.
Direct access to module in detector data structure.
static const std::string EndTime_t
double getTargetHV(const double gainTarget)
Get high-voltage corresponding to given target gain value.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class to define a range between two values.
Auxililary class to get date and time.
Utility class to parse command line options.
Data structure for PMT high-voltage calibration.
static const std::string Type_t
then $JPP_DIR software JDB JAsciiDB q upi pbs
static const std::string StartTime_t
Product breakdown structure (PBS).
static const std::string User_t
Detector calibration key words for JSON I/O.
Exception for accessing a value in a collection that is outside of its range.
do set_variable DETECTOR_TXT $WORKDIR detector
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
int main(int argc, char *argv[])