// Menu for running GL demos. // Author: Timur Pocheptsov void gldemos() { TControlBar *bar = new TControlBar("vertical", "GL painter demo",20,20); bar->AddButton("Help on demos", "help()", "Description"); bar->AddButton("glsurfaces", ".x $ROOTSYS/tutorials/gl/glsurfaces.C", "Surface painter example"); bar->AddButton("glrose", ".x $ROOTSYS/tutorials/gl/glrose.C", "Surface in polar system"); bar->AddButton("gltf3", ".x $ROOTSYS/tutorials/gl/gltf3.C", "TF3 painter"); bar->AddButton("glbox", ".x $ROOTSYS/tutorials/gl/glbox.C", "BOX painter"); bar->AddButton("glparametric", ".x $ROOTSYS/tutorials/gl/glparametric.C", "Parametric surface"); bar->Show(); }
void g4menu() { // Load Geant4 libraries if (!gInterpreter->IsLoaded("$ALICE/geant4_vmc/examples/macro/g4libs.C")) gROOT->LoadMacro("$ALICE/geant4_vmc/examples/macro/g4libs.C"); gInterpreter->ProcessLine("g4libs()"); // Load ALICE Geant4 library //cout << "Loading g4alice library ..." << endl; //gSystem->Load("libg4alice"); // Menu TControlBar* menu = new TControlBar("vertical","Alice Geant4 menu"); menu->AddButton("Geometry", "MakeGeometry()", "Generate Root geometry file"); menu->AddButton("Run G4", "RunG4Simulation()", "Process Alice run"); menu->AddButton("Run G4 batch", "RunG4Simulation(); >& g4.out", "Process Alice run"); menu->AddButton("Run G3", "RunG3Simulation()", "Process Alice run"); menu->AddButton("Run G3 batch", "RunG3Simulation(); >& g3.out", "Process Alice run"); menu->AddButton("Init", "Init();", "Initialize Alice for G4 simulation"); menu->AddButton("Init batch","Init(); >& g4init.out", "Initialize Alice for G4 simulation"); menu->AddButton("Geant4UI", "StartGeant4UI()","Go to Geant4 Interactive session"); menu->AddButton("AGDD", "GenerateAGDD()","Generate XML (AGDD) file with geometry description"); //menu->AddButton("GDML", "GenerateGDML()","Generate XML (GDML) file with geometry description"); menu->AddButton("Quit", "Quit()", "Quit aliroot"); gROOT->SaveContext(); cout << endl << "**************************************************************" << endl << " To run simulation:" << endl << " First select <Geometry> to build geometry.root file." << endl << " Then re-run aliroot and select <Run> button" << endl << endl << " The <Init> button is kept for debugging purposes," << endl << " it itializes MonteCarlo but it does not itialize" << endl << " completely ALICE framework. That's why to run simulation," << endl << " you have to re-run aliroot and select Run button." << endl << endl << " The menu enables to start Geant4 interactive session:" << endl << " Select <Geant4UI> button and use Geant4 interactive commands" << endl << " To go back to Root UI, type exit." << endl << "**************************************************************" << endl << endl; menu->Show(); }
void BrowseHistograms(const char* histname) { fHistName=histname; TSystemDirectory dir(".","."); TList *files = dir.GetListOfFiles(); if (!files) { cerr << "Error: No files found in " << fFileDir << endl; return; } files->Sort(); histograms = new TList(); saved = new TList(); c = new TCanvas("canvas","Browse Histograms"); TSystemFile *file; TIter next(files); Int_t n=0; TString fname; while ((file=(TSystemFile*)next())) { fname = file->GetName(); if (!file->IsDirectory() && fname.EndsWith(".root")) { histograms->Add(new TObjString(fname)); n++; //if(n>10) // break; } } DrawCurrHistogram(); TControlBar *bar = new TControlBar("vertical", "Control", 10, 10); bar->AddButton("Next","ProcessClick(1);", "Show next run"); bar->AddButton("Next And Save","NextAndSave();", "Show previous run"); bar->AddButton("Next And Forget","NextAndForget();", "Show previous run"); bar->AddButton("Prev","ProcessClick(-1);", "Show previous run"); bar->AddButton("Print saved","PrintSaved();", "Show previous run"); bar->SetButtonWidth(90); bar->Show(); }
void MakePHOSEmcCalib() { TControlBar *menu = new TControlBar("vertical","PHOS CDB"); menu->AddButton("Help to run PHOS CDB","Help()", "Explains how to use PHOS CDB menus"); menu->AddButton("Create ideal calibration","SetCC(0)", "Set equal CC"); menu->AddButton("Create full decalibration","SetCC(1)", "Set random decalibration CC"); menu->AddButton("Create residual decalibration","SetCC(2)", "Set residual decalibration calibration coefficients"); menu->AddButton("Read ideal calibration","GetCC(0)", "Read equal calibration coefficients"); menu->AddButton("Read full decalibration","GetCC(1)", "Read random decalibration calibration coefficients"); menu->AddButton("Read residual calibration","GetCC(2)", "Read residial calibration coefficients"); menu->AddButton("Exit","gApplication->Terminate(0)","Quit aliroot session"); menu->Show(); }
void AliT0CalibViewer() { TControlBar *menu = new TControlBar("vertical","T0 CalibViewer"); menu->AddButton("Open file","OpenFile()", "Open file"); menu->AddButton("Draw CFD","DrawCFD()", "Draw all CFD"); menu->AddButton("Draw LED","DrawLED()", "Draw all LED"); menu->AddButton("Draw LED-CFD","DrawLEDminCFD()", "Draw LED-CFD"); menu->AddButton("Draw QTC","DrawQTC()", "Draw all QTC"); menu->AddButton("Draw CFDvsQTC","DrawCFDvsQTC()", "Draw CFD vs QTC"); menu->AddButton("Draw CFDvsLED","DrawCFDvsLED()", "Draw CFD vs LED-CFD"); menu->AddButton("Draw Walk","DrawWalk()", "Draw CFD vs LED-CFD"); menu->Show(); }
//___________________________________________________________________________________ void CalibEI(const TString &i) { // TControlBar* bar = new TControlBar("vertical", "Intrinsic MWPC-"+i+" calibration"); bar->AddButton("dPhiEI", "CalibEI("+i+",1)", "dPhi shift E wrt I"); bar->AddButton("dPhiEI(Z)", "CalibEI("+i+",2)", "dPhi shift E wrt I as a func of Z"); bar->AddButton("dPhiEI(Phi)", "CalibEI("+i+",3)", "dPhi shift E wrt I as a func of Phi"); bar->AddButton("dPhiEI(Phi,Z)", "CalibEI("+i+",23)", "dPhi shift E wrt I as a func of Phi and Z"); bar->AddButton("dPhiEI(CGW)", "CalibEI("+i+",4)", "dPhi shift E wrt I as a func of CGW"); bar->AddButton("dPhiEI(CGI)", "CalibEI("+i+",5)", "dPhi shift E wrt I as a func of CGI"); bar->AddButton("dPhiEI(CGE)", "CalibEI("+i+",6)", "dPhi shift E wrt I as a func of CGE"); bar->SetButtonWidth(150); bar->Show(); }
void PlotFoams( TString fin = "weights/TMVAClassification_PDEFoam.weights_foams.root", bool useTMVAStyle=kTRUE ) { cout << "read file: " << fin << endl; TFile *file = TFile::Open(fin); // set style and remove existing canvas' TMVAGlob::Initialize( useTMVAStyle ); // create control bar TControlBar* cbar = new TControlBar( "vertical", "Choose cell value for plot:", 50, 50 ); if ((gDirectory->Get("SignalFoam") && gDirectory->Get("BgFoam")) || gDirectory->Get("MultiTargetRegressionFoam")) { TString macro = Form( "Plot(\"%s\", TMVA::kValueDensity, \"Event density\", %s)", fin.Data(), (useTMVAStyle ? "kTRUE" : "kFALSE") ); cbar->AddButton( "Event density", macro, "Plot event density", "button" ); } else if (gDirectory->Get("DiscrFoam") || gDirectory->Get("MultiClassFoam0")){ TString macro = Form( "Plot(\"%s\", TMVA::kValue, \"Discriminator\", %s)", fin.Data(), (useTMVAStyle ? "kTRUE" : "kFALSE") ); cbar->AddButton( "Discriminator", macro, "Plot discriminator", "button" ); } else if (gDirectory->Get("MonoTargetRegressionFoam")){ TString macro = Form( "Plot(\"%s\", TMVA::kValue, \"Target\", %s)", fin.Data(), (useTMVAStyle ? "kTRUE" : "kFALSE") ); cbar->AddButton( "Target", macro, "Plot target", "button" ); } else { cout << "Error: no foams found in file: " << fin << endl; return; } TString macro_rms = Form( "Plot(\"%s\", TMVA::kRms, \"Variance\", %s)", fin.Data(), (useTMVAStyle ? "kTRUE" : "kFALSE") ); cbar->AddButton( "Variance", macro_rms, "Plot variance", "button" ); TString macro_rms_ov_mean = Form( "Plot(\"%s\", TMVA::kRmsOvMean, \"Variance/Mean\", %s)", fin.Data(), (useTMVAStyle ? "kTRUE" : "kFALSE") ); cbar->AddButton( "Variance/Mean", macro_rms_ov_mean, "Plot variance over mean", "button" ); TString macro_cell_tree = Form( "PlotCellTree(\"%s\", \"Cell tree\", %s)", fin.Data(), (useTMVAStyle ? "kTRUE" : "kFALSE") ); cbar->AddButton( "Cell tree", macro_cell_tree, "Plot cell tree", "button" ); cbar->Show(); file->Close(); }
// main GUI void TMVAGui( const char* fName = "TMVA.root" ) { // Use this script in order to run the various individual macros // that plot the output of TMVA (e.g. running TMVAnalysis.C), // stored in the file "TMVA.root" // for further documentation, look in the individual macros TString curMacroPath(gROOT->GetMacroPath()); gROOT->SetMacroPath(curMacroPath+":$ROOTSYS/tmva/test/:"); cout << "--- Launch TMVA GUI to view input file: " << fName << endl; // init TMVAGui_inactiveButtons.clear(); // check if file exist TFile* file = TFile::Open( fName ); if (!file) { cout << "==> Abort TMVAGui, please verify filename" << endl; return; } // find all references cout << "--- Reading keys ..." << endl; TMVAGui_keyContent = (TList*)file->GetListOfKeys()->Clone(); // close file file->Close(); TString defaultRequiredClassifier = ""; // gROOT->Reset(); // gStyle->SetScreenFactor(2); // if you have a large screen, select 1,2 or 1.4 // create the control bar TControlBar* cbar = new TControlBar( "vertical", "TMVA Plotting Macros", 0, 0 ); const TString buttonType( "button" ); // configure buttons Int_t ic = 0; ActionButton( cbar, Form( "(%ia) Input Variables (training sample)", ++ic), Form( ".x variables.C(\"%s\",0)", fName ), "Plots all input variables (macro variables.C)", buttonType ); ActionButton( cbar, Form( "(%ib) Decorrelated Input Variables", ic ), Form( ".x variables.C(\"%s\",1)", fName ), "Plots all decorrelated input variables (macro variables.C(1))", buttonType, "DecorrTransform" ); ActionButton( cbar, Form( "(%ic) PCA-transformed Input Variables", ic ), Form( ".x variables.C(\"%s\",2)", fName ), "Plots all PCA-transformed input variables (macro variables.C(2))", buttonType, "PCATransform" ); ActionButton( cbar, Form( "(%id) GaussDecorr-transformed Input Variables", ic ), Form( ".x variables.C(\"%s\",3)", fName ), "Plots all GaussDecorrelated-transformed input variables (macro variables.C(3))", buttonType, "GaussDecorr" ); ActionButton( cbar, Form( "(%ia) Input Variable Correlations (scatter profiles)", ++ic ), Form( ".x CorrGui.C\(\"%s\",0)", fName ), "Plots signal and background correlation profiles between input variables (macro CorrGui.C)", buttonType ); ActionButton( cbar, Form( "(%ib) Decorrelated Input Variable Correlations (scatter profiles)", ic ), Form( ".x CorrGui.C\(\"%s\",1)", fName ), "Plots signal and background correlation profiles between decorrelated input variables (macro CorrGui.C(1))", buttonType, "DecorrTransform" ); ActionButton( cbar, Form( "(%ic) PCA-transformed Input Variable Correlations (scatter profiles)", ic ), Form( ".x CorrGui.C\(\"%s\",2)", fName ), "Plots signal and background correlation profiles between PCA-transformed input variables (macro CorrGui.C(2))", buttonType, "PCATransform" ); ActionButton( cbar, Form( "(%id) GaussDecorr-transformed Input Variable Correlations (scatter profiles)", ic ), Form( ".x CorrGui.C\(\"%s\",3)", fName ), "Plots signal and background correlation profiles between Gaussianised and Decorrelated input variables (macro CorrGui.C(3))", buttonType, "GaussDecorr" ); ActionButton( cbar, Form( "(%i) Input Variable Linear Correlation Coefficients", ++ic ), Form( ".x correlations.C(\"%s\")", fName ), "Plots signal and background correlation summaries for all input variables (macro correlations.C)", buttonType ); ActionButton( cbar, Form( "(%ia) Classifier Output Distributions (test sample)", ++ic ), Form( ".x mvas.C(\"%s\",0)", fName ), "Plots the output of each classifier for the test data (macro mvas.C(...,0))", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ib) Classifier Output Distributions for Training and Test Samples", ic ), Form( ".x mvas.C(\"%s\",3)", fName ), "Plots the rarity of each classifier for the test data (macro mvas.C(...,3))", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ic) Classifier Probability Distributions", ic ), Form( ".x mvas.C(\"%s\",1)", fName ), "Plots the probability of each classifier for the test data (macro mvas.C(...,1))", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%id) Classifier Rarity Distributions", ic ), Form( ".x mvas.C(\"%s\",2)", fName ), "Plots the rarity of each classifier for the test data (macro mvas.C(...,2))", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Cut Efficiencies", ++ic ), Form( ".x mvaeffs.C+(\"%s\")", fName ), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ib) Classifier Background Rejection vs Signal Efficiency (ROC curve)", ic ), Form( ".x efficiencies.C(\"%s\")", fName ), "Plots background rejection vs signal efficiencies (macro efficiencies.C) [\"ROC\" stands for \"Receiver Operation Characteristics\"]", buttonType, defaultRequiredClassifier ); TString title = Form( "(%i) Parallel Coordinates (requires ROOT-version >= 5.17)", ++ic ); ActionButton( cbar, title, Form( ".x paracoor.C(\"%s\")", fName ), "Plots parallel coordinates for classifiers and input variables (macro paracoor.C, requires ROOT >= 5.17)", buttonType, defaultRequiredClassifier ); // parallel coordinates only exist since ROOT 5.17 #if ROOT_VERSION_CODE < ROOT_VERSION(5,17,0) TMVAGui_inactiveButtons.push_back( title ); #endif ActionButton( cbar, Form( "(%i) Likelihood Reference Distributiuons", ++ic), Form( ".x likelihoodrefs.C(\"%s\")", fName ), "Plots to verify the likelihood reference distributions (macro likelihoodrefs.C)", buttonType, "Likelihood" ); ActionButton( cbar, Form( "(%ia) Network Architecture", ++ic ), Form( ".x network.C(\"%s\")", fName ), "Plots the MLP weights (macro network.C)", buttonType, "MLP" ); ActionButton( cbar, Form( "(%ib) Network Convergence Test", ic ), Form( ".x annconvergencetest.C(\"%s\")", fName ), "Plots error estimator versus training epoch for training and test samples (macro annconvergencetest.C)", buttonType, "MLP" ); ActionButton( cbar, Form( "(%i) Decision Trees", ++ic ), Form( ".x BDT.C+(\"%s\")", fName ), "Plots the Decision Trees trained by BDT algorithms (macro BDT.C(itree,...))", buttonType, "BDT" ); ActionButton( cbar, Form( "(%i) Decision Tree Control Plots", ++ic ), Form( ".x BDTControlPlots.C(\"%s\")", fName ), "Plots to monitor boosting and pruning of decision trees (macro BDTControlPlots.C)", buttonType, "BDT" ); ActionButton( cbar, Form( "(%i) PDFs of Classifiers", ++ic ), Form( ".x probas.C(\"%s\")", fName ), "Plots the Fit of the Methods outputs; to plot other trees (i) call macro from command line (macro probas.C(i))", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%i) Rule Ensemble Importance Plots", ++ic ), Form( ".x rulevis.C(\"%s\",0)", fName ), "Plots all input variables with rule ensemble weights, including linear terms (macro rulevis.C)", buttonType, "RuleFit" ); cbar->AddSeparator(); cbar->AddButton( Form( "(%i) Quit", ++ic ), ".q", "Quit", buttonType ); // set the style cbar->SetTextColor("black"); // there seems to be a bug in ROOT: font jumps back to default after pressing on >2 different buttons // cbar->SetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1"); // draw cbar->Show(); // indicate inactive buttons for (UInt_t i=0; i<TMVAGui_inactiveButtons.size(); i++) cbar->SetButtonState( TMVAGui_inactiveButtons[i], 3 ); if (TMVAGui_inactiveButtons.size() > 0) { cout << "=== Note: inactive buttons indicate that the corresponding classifiers were not trained ===" << endl; } gROOT->SaveContext(); }
void DrawPictures() { TControlBar *menu = new TControlBar("vertical","Pictures menu"); menu->AddButton("TPC shaded", ".x DrawTPC.C","Draw a shaded view of TPC"); menu->AddButton("ITS shaded", ".x DrawITS.C","Draw a shaded view of ITS"); menu->AddButton("CASTOR shaded",".x DrawCASTOR.C","Draw a shaded view of CASTOR"); menu->AddButton("ABSO shaded", ".x DrawABSO.C","Draw a shaded view of ABSO"); menu->AddButton("DIPO shaded", ".x DrawDIPO.C","Draw a shaded view of DIPO"); menu->AddButton("FMD shaded", ".x DrawFMD.C","Draw a shaded view of FMD"); menu->AddButton("FRAME shaded", ".x DrawFRAME.C","Draw a shaded view of FRAME"); menu->AddButton("HALL shaded", ".x DrawHALL.C","Draw a shaded view of HALL"); menu->AddButton("MAG shaded", ".x DrawMAG.C","Draw a shaded view of MAG"); menu->AddButton("MUON shaded", ".x DrawMUON.C","Draw a shaded view of MUON"); menu->AddButton("PHOS shaded", ".x DrawPHOS.C","Draw a shaded view of PHOS"); menu->AddButton("PIPE shaded", ".x DrawPIPE.C","Draw a shaded view of PIPE"); menu->AddButton("PMD shaded", ".x DrawPMD.C","Draw a shaded view of PMD"); menu->AddButton("HMPID shaded", ".x DrawHMPID.C","Draw a shaded view of HMPID"); menu->AddButton("SHIL shaded", ".x DrawSHIL.C","Draw a shaded view of SHIL"); menu->AddButton("T0 shaded", ".x DrawT0.C","Draw a shaded view of T0"); menu->AddButton("TOF shaded", ".x DrawTOF.C","Draw a shaded view of TOF"); menu->AddButton("TRD shaded", ".x DrawTRD.C","Draw a shaded view of TRD"); menu->AddButton("ZDC shaded", ".x DrawZDC.C","Draw a shaded view of ZDC"); menu->AddButton("VZERO shaded", ".x DrawVZERO.C","Draw a shaded view of VZERO"); menu->Show(); }
//___________________________________________________________________________________ void CalibMwpcNaI(const TString &i) { // TControlBar* bar = new TControlBar("vertical", "MWPC-"+i+" wrt NaI"); bar->AddButton("dPhi", "CalibMwpcNaI("+i+",1,0,0,0,0)", "dPhi Mwpc-NaI"); bar->AddButton("dX", "CalibMwpcNaI("+i+",2,0,0,0,0)", "X shift"); bar->AddButton("dY", "CalibMwpcNaI("+i+",3,0,0,0,0)", "Y shift"); bar->AddButton("dZ", "CalibMwpcNaI("+i+",4,0,0,0,0)", "Z shift"); bar->AddButton("dPhi tracks", "CalibMwpcNaI("+i+",5,0,0,0,0)", "dPhi between tracks"); bar->AddButton("dTheta tracks", "CalibMwpcNaI("+i+",6,0,0,0,0)", "dTheta between tracks"); bar->AddButton("dPsi tracks", "CalibMwpcNaI("+i+",7,0,0,0,0)", "dPsi between tracks"); bar->AddButton("dZinter vs Zinter", "CalibMwpcNaI("+i+",8,0,0,0,0)", ""); bar->AddButton("dXinter vs Zinter", "CalibMwpcNaI("+i+",9,0,0,0,0)", ""); bar->AddButton("dYinter vs Zinter", "CalibMwpcNaI("+i+",10,0,0,0,0)", ""); bar->AddButton("dZinter vs PhiInter", "CalibMwpcNaI("+i+",11,0,0,0,0)", ""); bar->AddButton("dXinter vs PhiInter", "CalibMwpcNaI("+i+",12,0,0,0,0)", ""); bar->AddButton("dYinter vs PhiInter", "CalibMwpcNaI("+i+",13,0,0,0,0)", ""); bar->AddButton("dPhiInter vs PhiInter", "CalibMwpcNaI("+i+",14,0,0,0,0)", ""); bar->AddButton("dPhiInter vs Zinter", "CalibMwpcNaI("+i+",15,0,0,0,0)", ""); bar->SetButtonWidth(150); bar->Show(); }
//___________________________________________________________________________________ void CalibMwpc() { // TControlBar* bar = new TControlBar("vertical", "MWPC-1 wrt MWPC-0 calibration"); bar->AddButton("dPhi", "CalibMwpc(1, 0, 0, 0, 0)", "dPhi MWPC1 - MWPC0"); bar->AddButton("dX", "CalibMwpc(2, 0, 0, 0, 0)", "dX MWPC1 - MWPC0"); bar->AddButton("dY", "CalibMwpc(3, 0, 0, 0, 0)", "dY MWPC1 - MWPC0"); bar->AddButton("dZ", "CalibMwpc(4, 0, 0, 0, 0)", "dZ MWPC1 - MWPC0"); bar->AddButton("dPhi tracks", "CalibMwpc(5, 0, 0, 0, 0)", "dPhi tracks 1-2"); bar->AddButton("dTheta tracks", "CalibMwpc(6, 0, 0, 0, 0)", "dTheta tracks 1-2"); bar->AddButton("dTheta2 tracks2", "CalibMwpc(66, 0, 0, 0, 0)", "dTheta tracks 1-2"); bar->AddButton("dPsi tracks", "CalibMwpc(7, 0, 0, 0, 0)", "dPsi tracks 1-2"); bar->AddButton("dZinter vs Zinter", "CalibMwpc(8, 0, 0, 0, 0)", "dZ vs Zinter"); bar->AddButton("dXinter vs Zinter", "CalibMwpc(9, 0, 0, 0, 0)", "dX vs Zinter"); bar->AddButton("dYinter vs Zinter", "CalibMwpc(10, 0, 0, 0, 0)", "dY vs Zinter"); bar->AddButton("dZinter vs PhiInter", "CalibMwpc(11, 0, 0, 0, 0)", "dZinter vs PhiInter"); bar->AddButton("dXinter vs PhiInter", "CalibMwpc(12, 0, 0, 0, 0)", "dXinter vs PhiInter"); bar->AddButton("dYinter vs PhiInter", "CalibMwpc(13, 0, 0, 0, 0)", "dYinter vs PhiInter"); bar->AddButton("dPhi vs PhiInter", "CalibMwpc(14, 0, 0, 0, 0)", "dPhi vs PhiInter"); bar->AddButton("dPhi vs ZInter", "CalibMwpc(15, 0, 0, 0, 0)", "dPhi vs ZInter"); bar->SetButtonWidth(150); bar->Show(); }
// main GUI void TMVAGui( const char* fName = "TMVA.root" ) ///usage: { //TMVA::gConfig().GetVariablePlotting().fNbins1D = 50.0; //TMVA::gConfig().GetVariablePlotting().fNbinsXOfROCCurve=50; // Use this script in order to run the various individual macros // that plot the output of TMVA (e.g. running TMVAClassification.C), // stored in the file "TMVA.root" TString curMacroPath(gROOT->GetMacroPath()); // uncomment next line for macros submitted to next root version gROOT->SetMacroPath(curMacroPath+":$ROOTSYS/tmva/test/:"); // for the sourceforge version, including $ROOTSYS/tmva/test in the // macro path is a mistake, especially if "./" was not part of path // add ../macros to the path (comment out next line for the ROOT version of TMVA) // gROOT->SetMacroPath(curMacroPath+":../macros:"); cout << "--- Launch TMVA GUI to view input file: " << fName << endl; // init TMVAGui_inactiveButtons.clear(); // check if file exist TFile* file = TFile::Open( fName ); if (!file) { cout << "==> Abort TMVAGui, please verify filename" << endl; return; } // find all references cout << "--- Reading keys ..." << endl; TMVAGui_keyContent = (TList*)file->GetListOfKeys()->Clone(); // close file file->Close(); TString defaultRequiredClassifier = ""; // gROOT->Reset(); // gStyle->SetScreenFactor(2); // if you have a large screen, select 1,2 or 1.4 // create the control bar TControlBar* cbar = new TControlBar( "vertical", "TMVA Plotting Macros for Classification", 0, 0 ); const TString buttonType( "button" ); // configure buttons Int_t ic = 1; // find all input variables types TList* keylist = GetKeyList( "InputVariables" ); TListIter it( keylist ); TObjString* str = 0; char ch = 'a'; while ((str = (TObjString*)it())) { TString tmp = str->GetString(); TString title = Form( "Input variables '%s'-transformed (training sample)", tmp.ReplaceAll("InputVariables_","").Data() ); if (tmp.Contains( "Id" )) title = "Input variables (training sample)"; ActionButton( cbar, Form( "(%i%c) %s", ic, ch++, title.Data() ), Form( ".x variables.C(\"%s\",\"%s\",\"%s\")", fName, str->GetString().Data(), title.Data() ), Form( "Plots all '%s'-transformed input variables (macro variables.C(...))", str->GetString().Data() ), buttonType, str->GetString() ); } ic++; // correlation scatter plots it.Reset(); ch = 'a'; while ((str = (TObjString*)it())) { TString tmp = str->GetString(); TString title = Form( "Input variable correlations '%s'-transformed (scatter profiles)", tmp.ReplaceAll("InputVariables_","").Data() ); if (tmp.Contains( "Id" )) title = "Input variable correlations (scatter profiles)"; ActionButton( cbar, Form( "(%i%c) %s", ic, ch++, title.Data() ), Form( ".x CorrGui.C(\"%s\",\"%s\",\"%s\")", fName, str->GetString().Data(), title.Data() ), Form( "Plots all correlation profiles between '%s'-transformed input variables (macro CorrGui.C(...))", str->GetString().Data() ), buttonType, str->GetString() ); } // coefficients ActionButton( cbar, Form( "(%i) Input Variable Linear Correlation Coefficients", ++ic ), Form( ".x correlations.C(\"%s\")", fName ), "Plots signal and background correlation summaries for all input variables (macro correlations.C)", buttonType ); ActionButton( cbar, Form( "(%ia) Classifier Output Distributions (test sample)", ++ic ), Form( ".x mvas.C(\"%s\",0)", fName ), "Plots the output of each classifier for the test data (macro mvas.C(...,0))", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( " (%ib) Classifier Output Distributions (test and training samples superimposed) ", ic ), Form( ".x mvas.C(\"%s\",3)", fName ), "Plots the output of each classifier for the test (histograms) and training (dots) data (macro mvas.C(...,3))", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ic) Classifier Probability Distributions (test sample)", ic ), Form( ".x mvas.C(\"%s\",1)", fName ), "Plots the probability of each classifier for the test data (macro mvas.C(...,1))", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%id) Classifier Rarity Distributions (test sample)", ic ), Form( ".x mvas.C(\"%s\",2)", fName ), "Plots the Rarity of each classifier for the test data (macro mvas.C(...,2)) - background distribution should be uniform", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Cut Efficiencies: S/sqrt(S+B)", ++ic ), Form( ".x mvaeffs.C+(\"%s\",\"S/sqrt(S+B)\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Before-Cut Efficiencies: B/sqrt(S+B)", ++ic ), Form( ".x mvaeffs_beforecut.C+(\"%s\",\"B/sqrt(S+B)\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Before-Cut Efficiencies: B/sqrt(S+B) @B_Purity=0.95", ++ic ), Form( ".x mvaeffs_beforecut.C+(\"%s\",\"B/sqrt(S+B)\",\"0.95\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Before-Cut Efficiencies: B/sqrt(S+B) @B_Purity=0.90", ++ic ), Form( ".x mvaeffs_beforecut.C+(\"%s\",\"B/sqrt(S+B)\",\"0.90\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Before-Cut Efficiencies: B/sqrt(S+B) @B_Purity=0.85", ++ic ), Form( ".x mvaeffs_beforecut.C+(\"%s\",\"B/sqrt(S+B)\",\"0.85\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Before-Cut Efficiencies: B/S", ++ic ), Form( ".x mvaeffs_beforecut.C+(\"%s\",\"B/S\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Before-Cut Efficiencies: B/S @B_Purity=0.95", ++ic ), Form( ".x mvaeffs_beforecut.C+(\"%s\",\"B/S\",\"0.95\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Before-Cut Efficiencies: B/S @B_Purity=0.90", ++ic ), Form( ".x mvaeffs_beforecut.C+(\"%s\",\"B/S\",\"0.90\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Before-Cut Efficiencies: B/S @B_Purity=0.85", ++ic ), Form( ".x mvaeffs_beforecut.C+(\"%s\",\"B/S\",\"0.85\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Before-Cut Efficiencies: B/S @B_Purity=0.80", ++ic ), Form( ".x mvaeffs_beforecut.C+(\"%s\",\"B/S\",\"0.80\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ia) Classifier Cut Efficiencies: S/B ", ++ic ), Form( ".x mvaeffs.C+(\"%s\",\"S/B\")", fName), "Plots signal and background efficiencies versus cut on classifier output (macro mvaeffs.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%ib) Classifier Background Rejection vs Signal Efficiency (ROC curve)", ic ), Form( ".x efficiencies.C(\"%s\")", fName ), "Plots background rejection vs signal efficiencies (macro efficiencies.C) [\"ROC\" stands for \"Receiver Operation Characteristics\"]", buttonType, defaultRequiredClassifier ); TString title = Form( "(%i) Parallel Coordinates (requires ROOT-version >= 5.17)", ++ic ); ActionButton( cbar, title, Form( ".x paracoor.C(\"%s\")", fName ), "Plots parallel coordinates for classifiers and input variables (macro paracoor.C, requires ROOT >= 5.17)", buttonType, defaultRequiredClassifier ); // parallel coordinates only exist since ROOT 5.17 #if ROOT_VERSION_CODE < ROOT_VERSION(5,17,0) TMVAGui_inactiveButtons.push_back( title ); #endif ActionButton( cbar, Form( "(%i) PDFs of Classifiers (requires \"CreateMVAPdfs\" option set)", ++ic ), Form( ".x probas.C(\"%s\")", fName ), "Plots the PDFs of the classifier output distributions for signal and background - if requested (macro probas.C)", buttonType, defaultRequiredClassifier ); ActionButton( cbar, Form( "(%i) Likelihood Reference Distributiuons", ++ic), Form( ".x likelihoodrefs.C(\"%s\")", fName ), "Plots to verify the likelihood reference distributions (macro likelihoodrefs.C)", buttonType, "Likelihood" ); ActionButton( cbar, Form( "(%ia) Network Architecture (MLP)", ++ic ), Form( ".x network.C(\"%s\")", fName ), "Plots the MLP weights (macro network.C)", buttonType, "MLP" ); ActionButton( cbar, Form( "(%ib) Network Convergence Test (MLP)", ic ), Form( ".x annconvergencetest.C(\"%s\")", fName ), "Plots error estimator versus training epoch for training and test samples (macro annconvergencetest.C)", buttonType, "MLP" ); ActionButton( cbar, Form( "(%i) Decision Trees (BDT)", ++ic ), Form( ".x BDT.C+(\"%s\")", fName ), "Plots the Decision Trees trained by BDT algorithms (macro BDT.C(itree,...))", buttonType, "BDT" ); ActionButton( cbar, Form( "(%i) Decision Tree Control Plots (BDT)", ++ic ), Form( ".x BDTControlPlots.C(\"%s\")", fName ), "Plots to monitor boosting and pruning of decision trees (macro BDTControlPlots.C)", buttonType, "BDT" ); // ActionButton( cbar, // Form( "(%i) Monitor Decision Tree Boosting", ++ic ), // Form( ".x BDTBoostWatch.C+(\"%s\")", fName ), // "Plots separation obtained by BDT method as function of boosting steps (macro BDTBoostWatch.C(itree,...))", // buttonType, "BDT" ); // ActionButton( cbar, // Form( "(%i) Rule Ensemble Importance Plots (RuleFit)", ++ic ), // Form( ".x rulevis.C(\"%s\",0)", fName ), // "Plots all input variables with rule ensemble weights, including linear terms (macro rulevis.C)", // buttonType, "RuleFit" ); ActionButton( cbar, Form( "(%i) Plot Foams (PDEFoam)", ++ic ), Form( ".x PlotFoams.C", fName ), "Plot Foams (macro PlotFoams.C)", buttonType, "PDEFoam" ); ActionButton( cbar, Form( "(%i) General Boost Control Plots", ++ic ), Form( ".x BoostControlPlots.C(\"%s\")", fName ), "Plots to monitor boosting of general classifiers (macro BoostControlPlots.C)", buttonType, "Boost" ); cbar->AddSeparator(); cbar->AddButton( Form( "(%i) Quit", ++ic ), ".q", "Quit", buttonType ); // set the style cbar->SetTextColor("black"); // there seems to be a bug in ROOT: font jumps back to default after pressing on >2 different buttons // cbar->SetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1"); // draw cbar->Show(); // indicate inactive buttons for (UInt_t i=0; i<TMVAGui_inactiveButtons.size(); i++) cbar->SetButtonState( TMVAGui_inactiveButtons[i], 3 ); if (TMVAGui_inactiveButtons.size() > 0) { cout << "=== Note: inactive buttons indicate that the corresponding classifiers were not trained ===" << endl; } gROOT->SaveContext(); }
//__________________________________________________________________ void GetControlBar() { gROOT->Reset(); /* //Add the tutorials directory to the macro path //This is necessary in case this macro is executed from another user directory TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName()); dir.ReplaceAll("PeakSearch_207Bi_interactive.C",""); dir.ReplaceAll("/./",""); const char *current = gROOT->GetMacroPath(); gROOT->SetMacroPath(Form("%s:%s",current,dir.Data())); */ TControlBar *bar = new TControlBar("vertical", "Controls",20,10); //bar->SetNumberOfColumns(3); //bar->SetNumberOfRows(7); bar->AddButton("Root Browser", "new TBrowser;", "Start the ROOT Browser"); bar->AddButton("Open folder", "OpenDataFile();", "Open data folder, provide name on screen"); bar->AddButton("OpenPeaksFile", "OpenPeaksFile()", "Open the output file of the peaks details"); bar->AddButton("Next histogram", "GetNextHistogram(+1)"," Load the next histogram"); bar->AddButton("Prev histogram", "GetNextHistogram(-1)"," Load the previous histogram"); bar->AddButton("Rebin histogram ", "RebinHistogram()"," Rebin the current histogram"); bar->AddButton("Store binning ", "WriteRebin()"," Write the adequate bining of the histogram "); bar->AddButton("Close", "Close()", "Close the files and exit"); TControlBar *bar2 = new TControlBar("vertical", "Bi207 (keV)",100,100); //bar2->SetNumberOfColumns(3); //bar->SetNumberOfRows(7); bar2->AddButton("XRay 72.8", "AssignEnergy(72.805)", "AssignEnergy this energy : 21.4%"); bar2->AddButton("XRay 75.0", "AssignEnergy(74.969)", "AssignEnergy this energy : 35.7%"); bar2->AddButton("XRay 84.4", "AssignEnergy(84.450)", "AssignEnergy this energy : 4.31%"); bar2->AddButton("XRay 84.9", "AssignEnergy(84.938)", "AssignEnergy this energy : 8.27%"); bar2->AddButton("XRay 87.3", "AssignEnergy(87.300)", "AssignEnergy this energy : 3.02%"); //bar->AddSeparator() ; //TControlBar *bar3 = new TControlBar("vertical", "Bi207 ICE (keV)",50,50); //bar2->SetNumberOfColumns(3); //bar->SetNumberOfRows(7); bar2->AddButton("K 481.7", "AssignEnergy(481.6935)", "AssignEnergy this energy : 1.515%"); bar2->AddButton("L 553.8", "AssignEnergy(553.8372)", "AssignEnergy this energy : 0.438%"); bar2->AddButton("M 565.8", "AssignEnergy(565.8473)", "AssignEnergy this energy : 0.147%"); bar2->AddButton("K 975.6", "AssignEnergy(975.651)", "AssignEnergy this energy : 7.03%"); bar2->AddButton("L 1047.9", "AssignEnergy(1047.795)", "AssignEnergy this energy : 1.84%"); bar2->AddButton("M 1059.8", "AssignEnergy(1059.805)", "AssignEnergy this energy : 0.54%"); bar->SetButtonWidth(200); bar->Show(); bar2->SetButtonWidth(200); bar2->SetTextColor("blue"); //bar2->SetFont("-adobe-helvetica-bold-r-*-*-16-*-*-*-*-*-iso8859-1"); bar2->Show(); /* bar3->SetButtonWidth(100); bar3->SetTextColor("red"); bar3->SetFont("-adobe-helvetica-bold-r-*-*-16-*-*-*-*-*-iso8859-1"); bar3->Show(); */ gROOT->SaveContext(); }
void mirrors() { setStyle(); init_parameters(); write_parameters(); simulateResponse(); TControlBar* bar = new TControlBar("vertical", "LTCC Segments by Maurizio Ungaro"); bar->AddButton("", ""); bar->AddButton("Show Photon Yield", "draw_W()"); bar->AddButton("", ""); bar->AddButton("Show refractive index of C4F10", "draw_c4f10n()"); bar->AddButton("Show quantum efficiencies", "draw_qes()"); bar->AddButton("Show reflectivities", "draw_reflectivities()"); bar->AddButton("Show wc reflectivities", "draw_wcreflectivities()"); bar->AddButton("Show Window Gains", "draw_window_gain()"); bar->AddButton("", ""); bar->AddButton("Integrate Yield", "integrate_yield()"); bar->AddButton("Plot Yields", "plot_yields()"); bar->AddButton("Plot Ratios", "normalized_yields_mirrors()"); bar->AddButton("", ""); bar->AddButton("Change particle", "change_particle()"); bar->AddButton("Change mirror", "change_mirror()"); bar->AddButton("Change gas", "change_gas()"); bar->AddButton("Change pmt", "change_pmt()"); bar->AddButton("Change WC", "change_WC()"); bar->AddButton("", ""); bar->AddButton("Simulate Response", "simulateResponse()"); bar->AddButton("", ""); bar->AddButton("Write Parameters", "write_parameters()"); bar->AddButton("", ""); bar->Show(); // that's all! }