35{
38
40 string usr;
41 string pwd;
42 string cookie;
43
45 string detectorFile;
47
49
50 try {
51
52 JParser<> zap(
"Program to create input data for HV-tuning.");
53
58 zap[
'f'] =
make_field(inputFiles,
"map of run numbers to file names (i.e. to the output of JFitToT)");
59 zap[
'a'] =
make_field(detectorFile,
"detector file");
62
63 zap(argc, argv);
64 }
65 catch(const exception &error) {
66 FATAL(error.what() << endl);
67 }
68
69
71
73
74 try {
75
77
78 JDB::reset(usr, pwd, cookie);
79
80
81
83
84 const int runNr = fileIt->first;
85
86 NOTICE(
"Extracting Gain-/HV-data for run " << runNr << endl);
87
88 {
89 TFile fitData(fileIt->second.c_str(), "READ");
90
93
95
96 const int domID =
detector.getModule(
JLocation(table.DUID, table.FLOORID)).getID();
97 const string pmtID =
MAKE_STRING(right << domID <<
'.' <<
FILL(2,
'0') << table.CABLEPOS);
98
100 const TF1*
f1 = (h1 != NULL ? h1->GetFunction(
FITTOT_FNAME.c_str()) : NULL);
101
103
104 if (f1 != NULL) {
105
107
108 const double gain =
f1->GetParameter(Ngain);
109 const double gainError =
f1->GetParError (Ngain);
110
111 interpolator.AddPoint(table.HV_VALUE, gain, gainError);
112 }
113 }
114
115 rs.Close();
116 }
117 }
118
119 } catch (const exception& error) {
120
121 FATAL(error.what() << endl);
122 }
123
124
125
126
128
130
134 }
135 }
136
137 out << manager;
138
139 out.Close();
140}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
#define MAKE_STRING(A)
Make string.
Auxiliary class for specifying selection of database data.
Logical location of module.
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
Object reading from a list of files.
virtual bool hasNext() override
Check availability of next element.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
static const std::string FITTOT_FNAME
static const std::string FITTOT_SUFFIX
static const char * FITTOT_GAIN_PARNAME
ResultSet & getResultSet(const std::string &query)
Get result set.
const char * getTable()
Get table name.
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
std::vector< JServer > getServernames()
Get list of names of available database servers.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
Auxiliary data structure for sequence of same character.
Auxiliary data structure to store high-voltage versus gain data and interpolate the nominal high-volt...
Wrapper class for server name.
Template definition for getting table specific selector.