105 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") opening PROOF session" << endl ;
106 void* p = (
void*)
gROOT->ProcessLineFast(
Form(
"TProof::Open(\"%s\")",proofHost)) ;
110 coutE(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") ERROR initializing proof, aborting" << endl ;
116 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->SetProgressDialog(0) ;",(
size_t)p)) ;
120 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") sending work package to PROOF servers" << endl ;
121 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->AddInput((TObject*)0x%zx) ;",(
size_t)p,(
size_t)
_pkg) ) ;
124 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") starting PROOF processing of " << nExperiments <<
" experiments" << endl ;
126 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->Process(\"RooProofDriverSelector\",%d) ;",(
size_t)p,nExperiments)) ;
129 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") aggregating results data" << endl ;
130 TList* olist = (
TList*)
gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->GetOutputList()",(
size_t)p)) ;
134 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") cleaning up input list" << endl ;
135 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->GetInputList()->Remove((TObject*)0x%zx) ;",(
size_t)p,(
size_t)
_pkg) ) ;
149 if (
gROOT->GetListOfProofs()->LastIndex() != -1 &&
gROOT->ProcessLineFast(
"gProof;"))
151 gROOT->ProcessLineFast(
Form(
"gProof->Close(\"%s\") ;",option)) ;
152 gROOT->ProcessLineFast(
"gProof->CloseProgressDialog() ;") ;
156 if (
gROOT->GetListOfProofs()->LastIndex() != -1 &&
gROOT->ProcessLineFast(
"gProof;")) {
157 gROOT->ProcessLineFast(
"delete gProof ;") ;
160 ooccoutI((
TObject*)NULL,Generation) <<
"RooStudyManager: No global Proof objects. No connections closed." << endl ;
170 TFile f(
Form(
"study_data_%s.root",studyName),
"RECREATE") ;
177 ofstream bdr(
Form(
"study_driver_%s.sh",studyName)) ;
178 bdr <<
"#!/bin/sh" << endl
179 <<
Form(
"if [ ! -f study_data_%s.root ] ; then",studyName) << endl
180 <<
"uudecode <<EOR" << endl ;
184 gSystem->
Exec(
Form(
"cat study_data_%s.root | uuencode -m study_data_%s.root >> study_driver_%s.sh",studyName,studyName,studyName)) ;
187 ofstream bdr2 (
Form(
"study_driver_%s.sh",studyName),ios::app) ;
188 bdr2 <<
"EOR" << endl
190 <<
"root -l -b <<EOR" << endl
191 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << endl
197 coutI(DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << endl
198 <<
" input data files is embedded in driver script" << endl ;
202 ofstream bdr(
Form(
"study_driver_%s.sh",studyName)) ;
203 bdr <<
"#!/bin/sh" << endl
204 <<
"root -l -b <<EOR" << endl
205 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << endl
209 coutI(DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << endl
210 <<
" input data file is " <<
Form(
"study_data_%s.root",studyName) << endl ;
227 for (list<string>::iterator iter = flist.begin() ; iter!=flist.end() ; ++iter) {
228 coutP(DataHandling) <<
"RooStudyManager::processBatchOutput() now reading file " << *iter << endl ;
231 TList* list =
f.GetListOfKeys() ;
253 (*iter)->aggregateSummaryOutput(olist) ;
266 result.push_back(
name) ;
273 Int_t dotslashpos = -1;
277 dotslashpos = next_dot;
278 next_dot = basename.
Index(
".root",dotslashpos+1);
280 if (basename[dotslashpos+5]!=
'/') {
288 if (dotslashpos>=0) {
290 behind_dot_root = basename(dotslashpos+6,basename.
Length()-dotslashpos+6);
292 basename.
Remove(dotslashpos+5);
298 directory = basename(0,slashpos);
299 basename.
Remove(0,slashpos+1);
304 TString expand_directory = directory;
314 if (!strcmp(
file,
".") || !strcmp(
file,
".."))
continue;
326 if (behind_dot_root.
Length() != 0)
327 result.push_back(
Form(
"%s/%s/%s",directory.
Data(),
file,behind_dot_root.
Data())) ;
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
RooAbsStudy is an abstract base class for RooStudyManager modules.
RooStudyManager is a utility class to manage studies that consist of repeated applications of generat...
void runProof(Int_t nExperiments, const char *proofHost="", Bool_t showGui=kTRUE)
Open PROOF-Lite session.
void prepareBatchInput(const char *studyName, Int_t nExpPerJob, Bool_t unifiedInput)
void expandWildCardSpec(const char *spec, std::list< std::string > &result)
case with one single file
void run(Int_t nExperiments)
void processBatchOutput(const char *filePat)
void addStudy(RooAbsStudy &study)
static void closeProof(Option_t *option="s")
"Option_t *option" takes the parameters forwarded to gProof->Close(option).
RooStudyManager(RooWorkspace &w)
void aggregateData(TList *olist)
RooStudyPackage is a utility class to manage studies that consist of repeated applications of generat...
void driver(Int_t nExperiments)
void addStudy(RooAbsStudy &study)
std::list< RooAbsStudy * > & studies()
The RooWorkspace is a persistable container for RooFit projects.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Iterator abstract base class.
virtual TObject * Next()=0
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual void Add(TObject *obj)
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual const char * GetName() const
Returns name of object.
Collectable string class.
const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual const char * GetName() const
Returns name of object.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Regular expression class.
const char * Data() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TString & Remove(Ssiz_t pos)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
virtual const char * WorkingDirectory()
Return working directory.
virtual int Unlink(const char *name)
Unlink, i.e.