29int main(
int argc,
char **argv)
41 JParser<> zap(
"Auxiliary program to project 3D histograms.");
43 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
44 zap[
'P'] =
make_field(project,
"projection") =
' ',
'x',
'X',
'y',
'Y',
'z',
'Z';
50 catch(
const exception &error) {
51 FATAL(error.what() << endl);
54 const bool px = (project ==
'x' || project ==
'X');
55 const bool py = (project ==
'y' || project ==
'Y');
56 const bool pz = (project ==
'z' || project ==
'Z');
61 FATAL(
"Invalid operation: "
62 << (px ?
"" :
"no") <<
" X projection " <<
" and "
63 << (py ?
"" :
"no") <<
" Y projection " <<
" and "
64 << (pz ?
"" :
"no") <<
" Z projection " << endl);
69 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
71 DEBUG(
"Input: " << *input << endl);
73 TDirectory* dir = getDirectory(*input);
76 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
80 const TRegexp regexp(input->getObjectName());
82 TIter iter(dir->GetListOfKeys());
84 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
86 const TString tag(key->GetName());
88 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
92 if (tag.Contains(regexp) && isTObject(key)) {
94 TH3* h3 =
dynamic_cast<TH3*
>(key->ReadObj());
99 listOfObjects.push_back(h3->ProjectionX(
MAKE_CSTRING(h3->GetName() <<
"_px")));
101 listOfObjects.push_back(h3->ProjectionY(
MAKE_CSTRING(h3->GetName() <<
"_py")));
103 listOfObjects.push_back(h3->ProjectionZ(
MAKE_CSTRING(h3->GetName() <<
"_pz")));
109 if (!listOfObjects.empty()) {
113 for (vector<TObject*>::const_iterator i = listOfObjects.begin(); i != listOfObjects.end(); ++i) {