Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JPrintTuna.cc File Reference

Auxiliary program to print slow control parameters. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <set>
#include <map>
#include "TROOT.h"
#include "TFile.h"
#include "JDB/JDatalog.hh"
#include "JDB/JSupport.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JROOT/JRootToolkit.hh"
#include "JLang/JFileStream.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to print slow control parameters.

Author
mdejong

Definition in file JPrintTuna.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 28 of file JPrintTuna.cc.

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}
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
General purpose class for object reading from a list of file names.
virtual void rewind() override
Rewind.
virtual bool hasNext() override
Check availability of next element.
virtual const pointer_type & next() override
Get next element.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition JHead.cc:163
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::string parameter
Definition JDatalog.hh:74
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128