Analyzing the PDR NTuple


The NtupleAnalysis Class:

The NtupleAnalysis class is used to select the branches of the PDR ntuple (or any root ntuple) that should be drawn to a postscript file.  Cuts may also be provided.  There is a simple but powerful scripting language which may be used to print histograms with multiple cuts.  The script file can be automatically generated with all available branches included but commented out such that the user may uncomment only those which should be drawn.

API

//! select a root file for analysis
Bool_t openRootFile(const char *szRootFileName);

//! draw (up to 10) plots passed as parameters
Bool_t drawPlots( const char *szPsFileName, const TCut cut, 
                            const TString plot1,
                            const TString plot2 = "",
                            const TString plot3 = "",
                            const TString plot4 = "",
                            const TString plot5 = "",
                            const TString plot6 = "",
                            const TString plot7 = "",
                            const TString plot8 = "",
                            const TString plot9 = "",
                            const TString plot10 = ""
                            );

//! write plots contained in plot file to ps file
Bool_t drawPlots(const char *szPsFileName, const char *szPlotFileName = "plots.txt");

//! write all plots to ps file
Bool_t drawAllPlots(const char *szPsFileName, const TCut cut);

//! create a plot file based on the ntuple stored in the currently loaded root file
Bool_t makePlotFile(const char *szPlotFileName = "plots.txt");

Usage

Here's a macro demonstrating the use of the above functions (click on the hyperlinks to see the output and input files.)

 

The HistBatch Class:

The NtupleAnalysis class uses another class to print the histograms to postscript.  It can also be used directly for printing histograms other than those in the pdr ntuple to postscript.

API

//! Draw all histograms (if in memory) contained in list
static void drawAll(const TList *l, const char *szFileName, const Int_t nCols = 1, const Int_t nRows = 1) const;

//! Draw all histograms (if in memory) contained in directory (does not recurse sub-TDirectories)
static void drawAll(const TDirectory *d, const char *szFileName, const Int_t nCols = 1, const Int_t nRows = 1) const;

//! Draw all histograms (from disk) contained in file (recurses sub-TDirectories)
static void drawAll(const char *szInFileName, const char *szFileName, const Int_t nCols = 1, const Int_t nRows = 1) const;

Usage

All methods are public static.  No instance of the HistBatch must be created in order to call the functions.  Treat the functions as if they belong to a namespace called HistBatch.  ie:

    HistBatch::drawAll(myList, "myPsFile.ps", 2, 2);   // Draw all histos in myList to myPsFile.ps in 2x2 orientation