37   const char FILTER = 
'!';   
 
   47 int main(
int argc, 
char **argv)
 
   59   JRange_t        runs           = JRange_t::DEFAULT_RANGE;
 
   60   long long int   numberOfRows;
 
   68   locate.insert(
"pmt_id");
 
   69   locate.insert(
"pmt_threshold");
 
   70   locate.insert(
"pmt_threshold@");
 
   71   locate.insert(
"pmt_highvolt");
 
   72   locate.insert(
"pmt_highvolt@");
 
   76     JParser<> zap(
"Auxiliary program to convert slow control data from the database to ROOT TTree.");
 
   82     zap[
'D'] = 
make_field(detid,        
"Detector identifier");
 
   84     zap[
'n'] = 
make_field(numberOfRows, 
"Maximal number of rows")         = numeric_limits<long long int>::max();
 
   87     zap[
'P'] = 
make_field(prescale,     
"Prescale sampling of data")      = 1;
 
   88     zap[
'G'] = 
make_field(graph,        
"Write TGraph instead of TTree");
 
   94   catch(
const exception &error) {
 
   95     FATAL(error.what() << endl);
 
   98   filter.push_back(
MAKE_STRING(FILTER << 
"CLBControlTimeoutMS"));
 
  100   if (runs.getUpperLimit() < runs.getLowerLimit()) {
 
  101     runs.setUpperLimit(runs.getLowerLimit());
 
  105     WARNING(
"Setting prescale to one." << endl);
 
  115     void put(
const Double_t x, 
const Double_t y)
 
  155       DEBUG(
"Reading database table " << getTable<JDetectorIntegration_t>() << endl); 
 
  157       ResultSet& rs  = 
getResultSet(getTable<JDetectorIntegration_t>());
 
  159       if (! (rs >> detector)) {
 
  164     DEBUG(
"Number of integrated products (before) " << right << detector.
size() << endl);
 
  168     DEBUG(
"Number of integrated products (after)  " << right << detector.
size() << endl);
 
  173       DEBUG(
"Reading database table " << getTable<JAllParams>() << endl); 
 
  184         if (
to_upper(parameters.TYPE) == 
"INTEGER" && parameters.INTEGER_UNIT_SCALE > 0.0) {
 
  185           unit[
to_upper(parameters.NAME)] = parameters.INTEGER_UNIT_SCALE;
 
  193       DEBUG(
"Reading database table " << getTable<JDatalogNumbers>() << endl); 
 
  196                                                 runs.getLowerLimit(),
 
  197                                                 runs.getUpperLimit());
 
  199       ResultSet& rs  = 
getResultSet(getTable<JDatalogNumbers>(), selection);
 
  201       long long int counter = 0;
 
  208         const JLocation_t& location = router.getLocation(upi);
 
  212           strings.insert(location.
string);
 
  213           floors .insert(location.
floor);
 
  221               bool    nos    = (*i)[0] == FILTER;
 
  222               TRegexp regexp = (nos ? i->substr(1).c_str() : i->c_str());
 
  224               if (TString(
parameters.PARAMETER_NAME).Contains(regexp)) {
 
  232             if (location.
string >= (
int) data.size()) {
 
  233               data.resize(location.
string + 1);
 
  236             if (location.
floor  >= (
int) data[location.
string].size()) { 
 
  242             if (locate.count(buffer) != 0) {
 
  246             JGraph_t& 
g1 = data[location.
string][location.
floor][buffer];
 
  258             if ((g1.counter++)%prescale == 0) {
 
  285   catch(
const exception& error) {
 
  286     ERROR(error.what() << endl);
 
  291     cout << endl << 
"Parameters without location in detector." << endl;
 
  294       cout << left << setw(48) << i->first << 
' ' << setw(6) << i->second << endl;
 
  298   if (!errors.empty()) {
 
  300     cout << endl << 
"Parameters without scale." << endl;
 
  303       cout << left << setw(48) << i->first << 
' ' << setw(6) << i->second << endl;
 
  309     for (
size_t string = 0; 
string != data.size(); ++string) {
 
  310       for (
size_t floor = 0; floor != data[string].size(); ++floor) {
 
  311         for (map_type::iterator i = data[
string][floor].begin(); i != data[string][floor].end(); ++i) {
 
  313           TGraph 
g1(i->second.X.size(), i->second.X.data(), i->second.Y.data());
 
  315           g1.SetName(
MAKE_CSTRING(
FILL(3,
'0') << 
string << 
'.' << 
FILL(2,
'0') << floor << 
'.' << setfill(
' ') << i->first));
 
  317           const JRange<double> range(i->second.Y.begin(), i->second.Y.end());
 
  319           g1.SetMinimum(range.getLowerLimit());
 
  320           g1.SetMaximum(range.getUpperLimit());
 
  329     os << 
"set_variable NUMBER_OF_STRINGS " << setw(4) <<  strings.size()   << 
";" << endl;
 
  330     os << 
"set_variable NUMBER_OF_FLOORS  " << setw(4) <<  floors. size()   << 
";" << endl;
 
  331     if (!strings.empty()) {
 
  332       os << 
"set_variable FIRST_STRING      " << setw(4) << *strings. begin() << 
";" << endl;
 
  333       os << 
"set_variable LAST_STRING       " << setw(4) << *strings.rbegin() << 
";" << endl;
 
  335     if (!floors.empty()) {
 
  336       os << 
"set_variable FIRST_FLOOR       " << setw(4) << *floors.  begin() << 
";" << endl;
 
  337       os << 
"set_variable LAST_FLOOR        " << setw(4) << *floors. rbegin() << 
";" << endl;
 
  339     os << 
"set_array    STRINGS           ";
 
  340     copy(strings.begin(), strings.end(), ostream_iterator<int>(os, 
" "));
 
  343     outputFile.put(TNamed(
"TUNA", os.str().c_str()));
 
Utility class to parse command line options. 
 
size_t size() const 
size of integration data 
 
Recording of objects on file according a format that follows from the file name extension. 
 
#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
 
#define MAKE_CSTRING(A)
Make C-string. 
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Auxiliary class for specifying selection of database data. 
 
*fatal Wrong number of arguments esac if[!-d ${OUTPUT_DIR}]
 
#define MAKE_STRING(A)
Make string. 
 
int floor
position in string 
 
I/O formatting auxiliaries. 
 
Auxiliary class to map UPI to location in detector. 
 
Auxiliary data structure for location of product in detector. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
bool is_integer(const std::string &buffer)
Check if string is an integer. 
 
std::string to_upper(const std::string &value)
Convert all character to upper case. 
 
ROOT TTree parameter settings. 
 
Auxiliary data structure for streaming of STL containers. 
 
General purpose messaging. 
 
Auxiliary data structure for sequence of same character. 
 
JRange< Double_t > JRange_t
 
static const JDetectorsHelper & getDetector
Function object for mapping serial number and object identifier of detectors. 
 
Universal product identifier (UPI). 
 
int position
position in floor 
 
Auxiliary class to define a range between two values. 
 
Utility class to parse command line options. 
 
ResultSet & getResultSet(const std::string &query)
Get result set. 
 
void copy(const Head &from, JHead &to)
Copy header from from to to. 
 
int string
position in detector 
 
void configure(const std::string &detid)
Configure detector integration for given detector identifier. 
 
Template definition for getting table specific selector. 
 
#define DEBUG(A)
Message macros. 
 
Double_t g1(const Double_t x)
Function. 
 
int main(int argc, char *argv[])