Jpp
JPrintTuna.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 #include <iterator>
5 #include <set>
6 #include <map>
7 
8 #include "TROOT.h"
9 #include "TFile.h"
10 
11 #include "JDB/JDatalog.hh"
12 #include "JDB/JSupport.hh"
14 #include "JROOT/JRootToolkit.hh"
15 #include "JLang/JFileStream.hh"
16 
17 #include "Jeep/JPrint.hh"
18 #include "Jeep/JParser.hh"
19 #include "Jeep/JMessage.hh"
20 
21 
22 /**
23  * \file
24  *
25  * Auxiliary program to print slow control parameters.
26  * \author mdejong
27  */
28 int main(int argc, char **argv)
29 {
30  using namespace std;
31  using namespace JPP;
32 
34  JLimit_t& numberOfEvents = inputFile.getLimit();
35  int id;
36  int debug;
37 
38  try {
39 
40  JParser<> zap("Auxiliary program to print slow control parameters.");
41 
42  zap['f'] = make_field(inputFile, "ROOT input file (output file of JTuna).");
43  zap['n'] = make_field(numberOfEvents) = JLimit::max();
44  zap['S'] = make_field(id, "string identifier (-1 => all)") = -1;
45  zap['d'] = make_field(debug) = 2;
46 
47  zap(argc, argv);
48  }
49  catch(const exception &error) {
50  FATAL(error.what() << endl);
51  }
52 
53  map<int, set<string> > buffer;
54 
55  long long int counter = 0;
56 
57  for (inputFile.rewind(); inputFile.hasNext(); ++counter) {
58 
59  STATUS(setw(10) << counter << '\r'); DEBUG(endl);
60 
61  JDatalog* p = inputFile.next();
62 
63  if (id == -1 || id == p->string) {
64  buffer[p->floor].insert(p->parameter);
65  }
66  }
67  STATUS(endl);
68 
69  for (map<int, set<string> >::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
70 
71  cout << "floor: " << setw(2) << i->first << ' ';
72 
73  copy(i->second.begin(), i->second.end(), ostream_iterator<string>(cout, " "));
74 
75  cout << endl;
76  }
77 }
JSUPPORT::JLimit
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
JMessage.hh
JPrint.hh
JDATABASE::JDatalog::parameter
std::string parameter
Definition: JDatalog.hh:74
JDatalog.hh
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JAANET::copy
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:152
std::set
Definition: JSTDTypes.hh:13
JFileStream.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
main
int main(int argc, char **argv)
Definition: JPrintTuna.cc:28
debug
int debug
debug level
Definition: JSirene.cc:59
JSUPPORT::JMultipleFileScanner::next
virtual const pointer_type & next()
Get next element.
Definition: JMultipleFileScanner.hh:398
JSupport.hh
JRootToolkit.hh
JMultipleFileScanner.hh
std::map
Definition: JSTDTypes.hh:16
JDATABASE::JDatalog::floor
int floor
Definition: JDatalog.hh:72
STATUS
#define STATUS(A)
Definition: JMessage.hh:63
JSUPPORT::JMultipleFileScanner::hasNext
virtual bool hasNext()
Check availability of next element.
Definition: JMultipleFileScanner.hh:350
JParser.hh
JDATABASE::JDatalog
Definition: JDatalog.hh:17
JSUPPORT::JMultipleFileScanner::rewind
virtual void rewind()
Rewind.
Definition: JMultipleFileScanner.hh:332
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JSUPPORT::JMultipleFileScanner
General purpose class for object reading from a list of file names.
Definition: JMultipleFileScanner.hh:167
DEBUG
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std
Definition: jaanetDictionary.h:36
JDATABASE::JDatalog::string
int string
Definition: JDatalog.hh:71
FATAL
#define FATAL(A)
Definition: JMessage.hh:67