Logo ROOT  
Reference Guide
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
42See doc: http://root.cern.ch/drupal/content/changing-default-root-version
43*/
44
45
47
48 public:
49
50 /// configure proof with number of experiments and host session
51 /// in case of Prooflite, it is better to define the number of workers as "worker=n" in the host string
52 ProofConfig(RooWorkspace &w, Int_t nExperiments = 0, const char *host = "", bool showGui = false) :
54 fNExperiments(nExperiments),
55 fHost(host),
56 fShowGui(showGui)
57 {
58
59 // case of ProofLite
60 if (fHost == "" || fHost.Contains("lite") ) {
61 fLite = true;
62
63
64 // get the default value of the machine - use CINT interface until we have a poper PROOF interface that we can call
65 int nMaxWorkers = gROOT->ProcessLineFast("TProofLite::GetNumberOfWorkers()");
66
67 if (nExperiments == 0) {
68 fNExperiments = nMaxWorkers;
69 }
70
71 if (nExperiments > nMaxWorkers)
72 std::cout << "ProofConfig - Warning: using a number of workers = " << nExperiments << " which is larger than the number of cores in the machine "
73 << nMaxWorkers << std::endl;
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:335
Option_t Option_t option
#define gROOT
Definition: TROOT.h:404
Holds configuration options for proof and proof-lite.
Definition: ProofConfig.h:46
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:52
bool GetShowGui(void) const
return fShowGui
Definition: ProofConfig.h:100
RooWorkspace & fWorkspace
workspace that is to be used with the RooStudyManager
Definition: ProofConfig.h:105
bool fShowGui
Whether to show the Proof Progress window.
Definition: ProofConfig.h:108
Int_t fNExperiments
number of experiments. This is sometimes called "events" in proof; "experiments" in RooStudyManager.
Definition: ProofConfig.h:106
virtual ~ProofConfig()
Definition: ProofConfig.h:86
bool IsLite() const
return true if it is a Lite session (ProofLite)
Definition: ProofConfig.h:102
TString fHost
Proof hostname. Use empty string (ie "") for proof-lite. Can also handle options like "workers=2" to ...
Definition: ProofConfig.h:107
bool fLite
Whether we have a Proof Lite session.
Definition: ProofConfig.h:109
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).
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
Basic string class.
Definition: TString.h:136
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:2341
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
Namespace for the RooStats classes.
Definition: Asimov.h:19