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
53 ProofConfig(RooWorkspace &w, Int_t nExperiments = 0, const char *host = "", Bool_t showGui = kFALSE) :
54 fWorkspace(w),
55 fNExperiments(nExperiments),
56 fHost(host),
57 fShowGui(showGui)
58 {
59
60 // case of ProofLite
61 if (fHost == "" || fHost.Contains("lite") ) {
62 fLite = true;
63
64
65 // get the default value of the machine - use CINT interface until we have a poper PROOF interface that we can call
66 int nMaxWorkers = gROOT->ProcessLineFast("TProofLite::GetNumberOfWorkers()");
67
68 if (nExperiments == 0) {
69 fNExperiments = nMaxWorkers;
70 }
71
72 if (nExperiments > nMaxWorkers)
73 std::cout << "ProofConfig - Warning: using a number of workers = " << nExperiments << " which is larger than the number of cores in the machine "
74 << nMaxWorkers << std::endl;
75
76 // set the number of workers in the Host string
77 fHost = TString::Format("workers=%d",fNExperiments);
78 }
79 else {
80 fLite = false;
81 // have always a default number of experiments
82 if (nExperiments == 0) fNExperiments = 8;
83 }
84 }
85
86
87 virtual ~ProofConfig() {
89 }
90
91 /// close all proof connections
92 static void CloseProof(Option_t *option = "s") { RooStudyManager::closeProof(option); }
93
94 // returns fWorkspace
95 RooWorkspace& GetWorkspace(void) const { return fWorkspace; }
96 // returns fHost
97 const char* GetHost(void) const { return fHost; }
98 // return fNExperiments
99 Int_t GetNExperiments(void) const { return fNExperiments; }
100 // return fShowGui
101 Bool_t GetShowGui(void) const { return fShowGui; }
102 // return true if it is a Lite session (ProofLite)
103 Bool_t IsLite() const { return fLite; }
104
105 protected:
106 RooWorkspace& fWorkspace; // workspace that is to be used with the RooStudyManager
107 Int_t fNExperiments; // number of experiments. This is sometimes called "events" in proof; "experiments" in RooStudyManager.
108 TString fHost; // Proof hostname. Use empty string (ie "") for proof-lite. Can also handle options like "workers=2" to run on two nodes.
109 Bool_t fShowGui; // Whether to show the Proof Progress window.
110 Bool_t fLite; // Whether we have a Proof Lite session
111
112 protected:
113 ClassDef(ProofConfig,1) // Configuration options for proof.
114};
115}
116
117
118#endif
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
#define gROOT
Definition: TROOT.h:415
Holds configuration options for proof and proof-lite.
Definition: ProofConfig.h:46
RooWorkspace & GetWorkspace(void) const
Definition: ProofConfig.h:95
Int_t GetNExperiments(void) const
Definition: ProofConfig.h:99
ProofConfig(RooWorkspace &w, Int_t nExperiments=0, const char *host="", Bool_t showGui=kFALSE)
Definition: ProofConfig.h:53
const char * GetHost(void) const
Definition: ProofConfig.h:97
RooWorkspace & fWorkspace
Definition: ProofConfig.h:106
virtual ~ProofConfig()
Definition: ProofConfig.h:87
Bool_t IsLite() const
Definition: ProofConfig.h:103
Bool_t GetShowGui(void) const
Definition: ProofConfig.h:101
static void CloseProof(Option_t *option="s")
close all proof connections
Definition: ProofConfig.h:92
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:131
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:2311
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
Namespace for the RooStats classes.
Definition: Asimov.h:20