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"
#include "Jeep/JPrint.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 29 of file JProject3D.cc.
   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);
 
   71     DEBUG(
"Input: " << *input << endl);
 
   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()) {
 
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 
 
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.