143 double HVstepMin = 2 * 3.14;
171 JParser<> zap(
"Example program to find optimal HV-settings.");
173 zap[
'f'] =
make_field(inputFile,
"input file (ROOT format)");
175 zap[
'a'] =
make_field(detectorFile,
"detector file");
176 zap[
'b'] =
make_field(UPIFile,
"PMT UPI ASCII table");
183 catch(
const exception &error) {
184 FATAL(error.what() << endl);
187 if (login.empty() || locationID.empty()) {
189 FATAL(
"Missing user information (please specify via -#login and -#locationID).");
191 }
else if (testType.empty()) {
193 FATAL(
"Missing database test type (please specify via -#testType).");
197 FATAL(
"Missing run numbers.");
203 const JUUID& UUID = JUUID::rndm();
207 timer.
sub(elapsedTime);
214 catch (
const exception& error) {
215 FATAL(error.what() << endl);
220 JUPITable fetchUPI(UPIFile.c_str());
225 TFile input(inputFile.c_str(),
"READ");
239 JHVInterpolator::setMinHVDistance(HVstepMin);
240 JHVInterpolator::setHVRange (HVrange);
241 JHVInterpolator::setGainRange (gainRange);
243 NOTICE(
"Searching optimal high-voltage settings..." << endl <<
244 LEFT(30) <<
"UPI" <<
CENTER(35) <<
"(identifer / location)" <<
RIGHT(35) <<
"Inter-/Extrapolated high-voltage [-]" << endl);
248 const string&
name = it->first;
253 const int seppos = name.find(
'.');
254 const int moduleID = stoi(name.substr(0, seppos));
255 const int tdc = stoi(name.substr(seppos + 1, seppos + 3));
257 const JModule& module = router.getModule(moduleID);
261 const string location =
MAKE_STRING(right <<
FILL(4,
'0') << module.getLocation().getString() <<
'.' <<
262 right <<
FILL(2,
'0') << module.getLocation().getFloor() <<
'.' <<
263 right <<
FILL(2,
'0') << tdc);
265 NOTICE(
LEFT(30) << pmtUPI <<
"(a.k.a. " << name <<
" / " << location <<
"): ");
267 if (
data.interpolateHV(gainTarget)) {
270 const double error =
data.getHVError();
272 NOTICE(right <<
FIXED(20,2) << result <<
" +/- " <<
FIXED(4,2) << error << endl);
278 WARNING(
"Could not find high-voltage corresponding to target gain; Setting zero." << endl);
289 metaInfo.push_back(
JMeta(argc, argv));
294 metaInfo.push_back(*
in.next());
298 TFile output(inputFile.c_str(),
"RECREATE");
312 if (APIversion.getMajorVersion() == 2) {
333 js[
Start_t] = timer.toString();
334 js[
End_t] = timer().toString();
337 }
else if (APIversion.getMajorVersion() == 1) {
348 FATAL(
"Invalid API version <" << APIversion <<
"> accepted major versions 1 and 2." << endl);
353 ofs << setw(2) << setprecision(8);
static JDBTestTypesTuneHV & getDBVersionTuneHV
Function object for looking up the HV-tuning database version number corresponding to a specific test...
static const std::string Arguments_t
Utility class to parse command line options.
static const std::string Start_t
static const std::string Location_t
static const std::string Code_t
Data structure for a composite optical module.
static const std::string Encoding_t
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
static const JPBS_t PMT(3, 4, 2, 3)
PBS of photo-multiplier tube (PMT)
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.
static const std::string Error_t
then echo Enter input within $TIMEOUT_S seconds echo n User name
Utility class to parse parameter values.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Universal product identifier (UPI).
Auxiliary data structure for floating point format specification.
void sub(const time_t t1)
Subtract given time.
#define MAKE_STRING(A)
Make string.
static const std::string Time_t
Auxiliary data structure for alignment of data.
static const std::string APIVersion_t
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
static const std::string Configuration_t
Auxiliary data structure to store high-voltage versus gain data and interpolate the nominal high-volt...
static const std::string Test_t
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getID() const
Get identifier.
Data structure for PMT geometry, calibration and status.
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
static const std::string End_t
const double NOMINAL_GAIN
Specification for normalized gain corresponding to a one photo-electron pulse.
static const std::string Info_t
Auxiliary data structure for sequence of same character.
static const std::string Message_t
static const std::string Data_t
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class for date and time.
Data structure for PMT high-voltage calibration.
static const std::string Type_t
Object reading from a list of files.
static const std::string Provenance_t
do set_variable DETECTOR_TXT $WORKDIR detector
Auxiliary data structure for general purpose version number.
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 JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
static const std::string UUID_t
static const std::string Tests_t
static const std::string OK_t
static const std::string Fail_t
static const std::string User_t