Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:57

0001 #ifndef BDT_Reg__HH
0002 #define BDT_Reg__HH
0003 
0004 #include <vector>
0005 
0006 #include "TMVA/tmvaglob.h"
0007 
0008 #include "RQ_OBJECT.h"
0009 
0010 #include "TStyle.h"
0011 #include "TPad.h"
0012 #include "TCanvas.h"
0013 #include "TFile.h"
0014 #include "TColor.h"
0015 #include "TPaveText.h"
0016 #include "TControlBar.h"
0017 
0018 #include "TGWindow.h"
0019 #include "TGButton.h"
0020 #include "TGLabel.h"
0021 #include "TGNumberEntry.h"
0022 
0023 #include "TMVA/DecisionTree.h"
0024 #include "TMVA/Tools.h"
0025 #include "TXMLEngine.h"
0026 #include "TMVA/BDT.h"
0027 // Uncomment this only if the link problem is solved. The include statement tends
0028 // to use the ROOT classes rather than the local TMVA release
0029 // #include "TMVA/DecisionTree.h"
0030 // #include "TMVA/DecisionTreeNode.h"
0031 
0032 namespace TMVA{
0033 
0034 
0035 
0036    class StatDialogBDTReg {
0037 
0038       RQ_OBJECT("StatDialogBDTReg")
0039 
0040          public:
0041 
0042       StatDialogBDTReg(TString dataset, const TGWindow* p, TString wfile,
0043                        TString methName = "BDT", Int_t itree = 0 );
0044       virtual ~StatDialogBDTReg() {
0045          TMVA::DecisionTreeNode::SetIsTraining(false);
0046          fThis = nullptr;
0047          fMain->CloseWindow();
0048          fMain->Cleanup();
0049          if(gROOT->GetListOfCanvases()->FindObject(fCanvas))
0050             delete fCanvas;
0051       }
0052 
0053       // draw method
0054       void DrawTree( Int_t itree );
0055 
0056       void RaiseDialog() { if (fMain) { fMain->RaiseWindow(); fMain->Layout(); fMain->MapWindow(); } }
0057 
0058    private:
0059 
0060       TGMainFrame *fMain;
0061       Int_t        fItree;
0062       Int_t        fNtrees;
0063       TCanvas*     fCanvas;
0064       TString fDataset;
0065 
0066       TGNumberEntry* fInput;
0067 
0068       TGHorizontalFrame* fButtons;
0069       TGTextButton* fDrawButton;
0070       TGTextButton* fCloseButton;
0071 
0072       void UpdateCanvases();
0073 
0074       // draw methods
0075       TMVA::DecisionTree* ReadTree( TString * &vars, Int_t itree );
0076       void                DrawNode( TMVA::DecisionTreeNode *n,
0077                                     Double_t x, Double_t y, Double_t xscale,  Double_t yscale, TString* vars );
0078       void GetNtrees();
0079 
0080       TString fWfile;
0081       TString fMethName;
0082 
0083    public:
0084 
0085       // static function for external deletion
0086       static void Delete() { if (fThis) { delete fThis; fThis = nullptr; } }
0087 
0088       // slots
0089       void SetItree(); //*SIGNAL*
0090       void Redraw(); //*SIGNAL*
0091       void Close(); //*SIGNAL*
0092 
0093    private:
0094 
0095       static StatDialogBDTReg* fThis;
0096 
0097    };
0098 
0099    // ========================================================================================
0100 
0101    extern std::vector<TControlBar*> BDTReg_Global__cbar;
0102 
0103    // intermediate GUI
0104    void BDT_Reg(TString dataset, const TString& fin = "TMVAReg.root" );
0105    void BDTReg_DeleteTBar(int i);
0106 
0107    void BDT_Reg(TString dataset, Int_t itree, TString wfile = "", TString methName = "BDT", Bool_t useTMVAStyle = kTRUE );
0108 
0109 
0110 }
0111 #endif