Auxiliary program to print Jpp meta data.
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TNamed.h"
#include "TKey.h"
#include "TRegexp.h"
#include "JLang/JLangToolkit.hh"
#include "JLang/JObjectMultiplexer.hh"
#include "Jeep/JeepToolkit.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JMeta.hh"
#include "JSupport/JSupport.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Auxiliary program to print Jpp meta data.
- Author
- mdejong
Definition in file JPrintMeta.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 39 of file JPrintMeta.cc.
52 JParser<> zap(
"Auxiliary program to print Jpp meta data.");
55 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
57 zap[
'O'] =
make_field(option) = plain_t, single_t, json_t;
62 catch(
const exception &error) {
63 FATAL(error.what() << endl);
68 if (application !=
"") {
70 TFile* in = TFile::Open(inputFile.c_str(),
"exists");
72 if (in != NULL && in->IsOpen()) {
74 const TRegexp regexp(application.c_str());
76 TIter iter(in->GetListOfKeys());
78 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
80 const TString tag(key->GetName());
82 if (tag.Index(regexp) != -1) {
84 TNamed* named =
dynamic_cast<TNamed*
>(key->ReadObj());
87 cout << named->GetName() <<
"[" << key->GetCycle() <<
"] " << named->GetTitle() << endl;
96 ERROR(
"Error opening file: " << inputFile << endl);
101 JMultipleFileScanner<JMetaTypes_t> in(inputFile, numberOfEvents);
103 JObjectMultiplexer<JMetaTypes_t> abc(in);
105 if (option == single_t) {
109 while (abc.hasNext()) {
111 JMeta* meta = abc.next();
113 if (option == plain_t) {
115 cout << *meta << endl;
117 }
else if (option == single_t ||
122 for (JMeta::const_iterator i = meta->begin(); i != meta->end(); ++i) {
124 cout <<
double_quote(i->first) <<
" : " <<
double_quote(i->second) << (i->first != meta->rbegin()->first ?
"," :
"") << endl;
137 if (option == single_t) {
Utility class to parse command line options.
static const char *const application_t
Definition of meta data parameters.
std::string double_quote(const std::string &value)
Quote string.
JLimit JLimit_t
Type definition of limit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object