Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ProofConfig.h
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: Kyle Cranmer and Sven Kreiss July 2010
3/*************************************************************************
4 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOSTATS_ProofConfig
12#define ROOSTATS_ProofConfig
13
14
15
16
17#include "Rtypes.h"
18
19#include "RooWorkspace.h"
20#include "RooStudyManager.h"
21
22#include "TROOT.h"
23
24namespace RooStats {
25
26/** \class ProofConfig
27 \ingroup Roostats
28
29Holds configuration options for proof and proof-lite.
30
31This class will be expanded in the future to hold more specific configuration
32options for the tools in RooStats.
33
34Access to TProof::Mgr for configuration is still possible as usual
35(e.g. to set Root Version to be used on workers). You can do:
36
37~~~ {.cpp}
38 TProof::Mgr("my.server.url")->ShowROOTVersions()
39 TProof::Mgr("my.server.url")->SetROOTVersion("v5-27-06_dbg")
40~~~
41
42*/
43
44
46
47 public:
48
49 /// configure proof with number of experiments and host session
50 /// in case of Prooflite, it is better to define the number of workers as "worker=n" in the host string
51 ProofConfig(RooWorkspace &w, Int_t nExperiments = 0, const char *host = "", bool showGui = false) :
53 fNExperiments(nExperiments),
54 fHost(host),
55 fShowGui(showGui)
56 {
57
58 // case of ProofLite
59 if (fHost == "" || fHost.Contains("lite") ) {
60 fLite = true;
61
62
63 // get the default value of the machine - use CINT interface until we have a poper PROOF interface that we can call
64 int nMaxWorkers = gROOT->ProcessLineFast("TProofLite::GetNumberOfWorkers()");
65
66 if (nExperiments == 0) {
67 fNExperiments = nMaxWorkers;
68 }
69
70 if (nExperiments > nMaxWorkers) {
71 std::cout << "ProofConfig - Warning: using a number of workers = " << nExperiments
72 << " which is larger than the number of cores in the machine " << nMaxWorkers << std::endl;
73 }
74
75 // set the number of workers in the Host string
76 fHost = TString::Format("workers=%d",fNExperiments);
77 }
78 else {
79 fLite = false;
80 // have always a default number of experiments
81 if (nExperiments == 0) fNExperiments = 8;
82 }
83 }
84
85
86 virtual ~ProofConfig() {
88 }
89
90 /// close all proof connections
92
93 /// returns fWorkspace
94 RooWorkspace& GetWorkspace(void) const { return fWorkspace; }
95 /// returns fHost
96 const char* GetHost(void) const { return fHost; }
97 /// return fNExperiments
98 Int_t GetNExperiments(void) const { return fNExperiments; }
99 /// return fShowGui
100 bool GetShowGui(void) const { return fShowGui; }
101 /// return true if it is a Lite session (ProofLite)
102 bool IsLite() const { return fLite; }
103
104 protected:
105 RooWorkspace& fWorkspace; ///< workspace that is to be used with the RooStudyManager
106 Int_t fNExperiments; ///< number of experiments. This is sometimes called "events" in proof; "experiments" in RooStudyManager.
107 TString fHost; ///< Proof hostname. Use empty string (ie "") for proof-lite. Can also handle options like "workers=2" to run on two nodes.
108 bool fShowGui; ///< Whether to show the Proof Progress window.
109 bool fLite; ///< Whether we have a Proof Lite session
110
111 protected:
112 ClassDef(ProofConfig,1) // Configuration options for proof.
113};
114}
115
116
117#endif
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:337
Option_t Option_t option
#define gROOT
Definition TROOT.h:406
Holds configuration options for proof and proof-lite.
Definition ProofConfig.h:45
RooWorkspace & GetWorkspace(void) const
returns fWorkspace
Definition ProofConfig.h:94
Int_t GetNExperiments(void) const
return fNExperiments
Definition ProofConfig.h:98
const char * GetHost(void) const
returns fHost
Definition ProofConfig.h:96
ProofConfig(RooWorkspace &w, Int_t nExperiments=0, const char *host="", bool showGui=false)
configure proof with number of experiments and host session in case of Prooflite, it is better to def...
Definition ProofConfig.h:51
bool GetShowGui(void) const
return fShowGui
RooWorkspace & fWorkspace
workspace that is to be used with the RooStudyManager
bool fShowGui
Whether to show the Proof Progress window.
Int_t fNExperiments
number of experiments. This is sometimes called "events" in proof; "experiments" in RooStudyManager.
bool IsLite() const
return true if it is a Lite session (ProofLite)
TString fHost
Proof hostname. Use empty string (ie "") for proof-lite. Can also handle options like "workers=2" to ...
bool fLite
Whether we have a Proof Lite session.
static void CloseProof(Option_t *option="s")
close all proof connections
Definition ProofConfig.h:91
static void closeProof(Option_t *option="s")
"Option_t *option" takes the parameters forwarded to gProof->Close(option).
Persistable container for RooFit projects.
Basic string class.
Definition TString.h:139
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:634
Namespace for the RooStats classes.
Definition Asimov.h:19