Auxiliary program to project 3D histograms.
More...
#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include "TROOT.h"
#include "TFile.h"
#include "TKey.h"
#include "TH3.h"
#include "TProfile3D.h"
#include "TString.h"
#include "TRegexp.h"
#include "JGizmo/JRootObjectID.hh"
#include "JGizmo/JGizmoToolkit.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 project 3D histograms.
- Author
- mdejong
Definition in file JProject3D.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 28 of file JProject3D.cc.
40 JParser<> zap(
"Auxiliary program to project 3D histograms.");
42 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
43 zap[
'P'] =
make_field(project,
"projection") =
' ',
'x',
'X',
'y',
'Y',
'z',
'Z';
49 catch(
const exception &error) {
50 FATAL(error.what() << endl);
53 const bool px = (project ==
'x' || project ==
'X');
54 const bool py = (project ==
'y' || project ==
'Y');
55 const bool pz = (project ==
'z' || project ==
'Z');
60 FATAL(
"Invalid operation: "
61 << (px ?
"" :
"no") <<
" X projection " <<
" and "
62 << (py ?
"" :
"no") <<
" Y projection " <<
" and "
63 << (pz ?
"" :
"no") <<
" Z projection " << endl);
70 DEBUG(
"Input: " << *input << endl);
75 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
79 const TRegexp regexp(input->getObjectName());
81 TIter iter(dir->GetListOfKeys());
83 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
85 const TString tag(key->GetName());
87 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
91 if (tag.Contains(regexp)) {
93 TH3* h3 =
dynamic_cast<TH3*
>(key->ReadObj());
98 listOfObjects.push_back(h3->ProjectionX(
MAKE_CSTRING(h3->GetName() <<
"_px")));
100 listOfObjects.push_back(h3->ProjectionY(
MAKE_CSTRING(h3->GetName() <<
"_py")));
102 listOfObjects.push_back(h3->ProjectionZ(
MAKE_CSTRING(h3->GetName() <<
"_pz")));
108 if (!listOfObjects.empty()) {
Utility class to parse command line options.
#define MAKE_CSTRING(A)
Make C-string.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.