Crombie Tools
PlotROC.h
Go to the documentation of this file.
1 /**
2  @file PlotROC.h
3  Header file for PlotROC class definition.
4  @author Daniel Abercrombie <dabercro@mit.edu>
5 */
6 
7 #ifndef CROMBIETOOLS_PLOTTOOLS_PLOTROC_H
8 #define CROMBIETOOLS_PLOTTOOLS_PLOTROC_H
9 
10 #include "TGraph.h"
11 #include "TTree.h"
12 #include "TString.h"
13 #include "TCut.h"
14 
15 #include "PlotHists.h"
16 #include "PlotBase.h"
17 
18 /**
19  @ingroup plotgroup
20  @class PlotROC
21  @brief Plotter for ROC curves and significance plots.
22 
23  The plotter takes signal and background trees and scans cuts over a given variable.
24  Multiple variables can be scanned this way at the same time to determine the best discriminators.
25 */
26 
27 class PlotROC : public PlotBase
28 {
29  public:
30  PlotROC();
31  virtual ~PlotROC();
32 
33  /// Makes the canvas with the ROC curves
34  void MakeCanvas ( TString FileBase, Int_t NumBins = 500, TString XLabel = "#epsilon_{Signal}",
35  TString YLabel = "#epsilon_{Background}", Bool_t logY = false, Bool_t logX = false );
36 
37  /// Set the pointer to the signal tree
38  void SetSignalTree ( TTree *tree ) { fSignalTree = tree; }
39  /// Set the pointer to the background tree
40  void SetBackgroundTree ( TTree *tree ) { fBackgroundTree = tree; }
41  /// Set the weight that defines the signal
42  void SetSignalCut ( TCut cut ) { fSignalCut = cut; }
43  /// Set the weight that defines the background
44  void SetBackgroundCut ( TCut cut ) { fBackgroundCut = cut; }
45 
46  /// Reset the list of variables to be plotted
47  void ResetVars () { fROCVars.resize(0); }
48  /// Add a variable to be scanned over and plotted
49  void AddVar ( TString var ) { fROCVars.push_back(var); }
50 
51  /// Types of plots made by PlotROC
52  enum PlotType { kROC = 0, kSignificance };
53  /// Set type of plot to be made
54  void SetPlotType ( PlotType type ) { fPlotType = type; }
55 
56  private:
57 
58  /// Make a single ROC curve, using a given cut variable
59  TGraph* MakeROC ( TString CutVar, Int_t NumBins );
60  /// Make all of the ROC curves for the list of variables
61  std::vector<TGraph*> MakeROCs ( Int_t NumBins );
62 
63  TTree* fSignalTree = NULL; ///< Pointer to tree from which to extract signal
64  TTree* fBackgroundTree = NULL; ///< Pointer to tree from which to extract background
65  TCut fSignalCut = ""; ///< Cut used on signal tree to extract signal
66  TCut fBackgroundCut = ""; ///< Cut used on background tree to extract background
67  std::vector<TString> fROCVars; ///< List of varaibles to make cuts on
68 
69  PlotHists fPlotHists; ///< Plotter for histograms
70 
71  PlotType fPlotType = kROC; ///< Holds enum for type of plot to be made
72 
73  ClassDef(PlotROC, 1)
74 };
75 
76 #endif