12 #include "TProfile3D.h" 
   28 int main(
int argc, 
char **argv)
 
   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) && 
isTObject(key)) {
 
   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. 
 
int main(int argc, char *argv[])
 
#define MAKE_CSTRING(A)
Make C-string. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
General purpose messaging. 
 
Utility class to parse command line options. 
 
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject. 
 
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer. 
 
#define DEBUG(A)
Message macros.