66 _pkg->addStudy(study) ;
86 _pkg->addStudy(study) ;
96 _pkg->driver(nExperiments) ;
106 coutP(
Generation) <<
"RooStudyManager::runProof(" << GetName() <<
") opening PROOF session" << endl ;
107 void* p = (
void*)
gROOT->ProcessLineFast(
Form(
"TProof::Open(\"%s\")",proofHost)) ;
111 coutE(
Generation) <<
"RooStudyManager::runProof(" << GetName() <<
") ERROR initializing proof, aborting" << endl ;
117 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%lx)->SetProgressDialog(0) ;",(
ULong_t)p)) ;
121 coutP(
Generation) <<
"RooStudyManager::runProof(" << GetName() <<
") sending work package to PROOF servers" << endl ;
125 coutP(
Generation) <<
"RooStudyManager::runProof(" << GetName() <<
") starting PROOF processing of " << nExperiments <<
" experiments" << endl ;
127 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%lx)->Process(\"RooProofDriverSelector\",%d) ;",(
ULong_t)p,nExperiments)) ;
130 coutP(
Generation) <<
"RooStudyManager::runProof(" << GetName() <<
") aggregating results data" << endl ;
132 aggregateData(olist) ;
135 coutP(
Generation) <<
"RooStudyManager::runProof(" << GetName() <<
") cleaning up input list" << endl ;
136 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%lx)->GetInputList()->Remove((TObject*)0x%lx) ;",(
ULong_t)p,(
ULong_t)_pkg) ) ;
150 if (
gROOT->GetListOfProofs()->LastIndex() != -1 &&
gROOT->ProcessLineFast(
"gProof;"))
152 gROOT->ProcessLineFast(
Form(
"gProof->Close(\"%s\") ;",option)) ;
153 gROOT->ProcessLineFast(
"gProof->CloseProgressDialog() ;") ;
157 if (
gROOT->GetListOfProofs()->LastIndex() != -1 &&
gROOT->ProcessLineFast(
"gProof;")) {
158 gROOT->ProcessLineFast(
"delete gProof ;") ;
171 TFile f(
Form(
"study_data_%s.root",studyName),
"RECREATE") ;
172 _pkg->Write(
"studypack") ;
178 ofstream bdr(
Form(
"study_driver_%s.sh",studyName)) ;
179 bdr <<
"#!/bin/sh" << endl
180 <<
Form(
"if [ ! -f study_data_%s.root ] ; then",studyName) << endl
181 <<
"uudecode <<EOR" << endl ;
185 gSystem->
Exec(
Form(
"cat study_data_%s.root | uuencode -m study_data_%s.root >> study_driver_%s.sh",studyName,studyName,studyName)) ;
188 ofstream bdr2 (
Form(
"study_driver_%s.sh",studyName),ios::app) ;
189 bdr2 <<
"EOR" << endl
191 <<
"root -l -b <<EOR" << endl
192 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << endl
198 coutI(
DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << endl
199 <<
" input data files is embedded in driver script" << endl ;
203 ofstream bdr(
Form(
"study_driver_%s.sh",studyName)) ;
204 bdr <<
"#!/bin/sh" << endl
205 <<
"root -l -b <<EOR" << endl
206 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << endl
210 coutI(
DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << endl
211 <<
" input data file is " <<
Form(
"study_data_%s.root",studyName) << endl ;
224 expandWildCardSpec(filePat,flist) ;
228 for (list<string>::iterator
iter = flist.begin() ;
iter!=flist.end() ; ++
iter) {
232 TList* list =
f.GetListOfKeys() ;
244 aggregateData(&olist) ;
253 for (list<RooAbsStudy*>::iterator
iter=_pkg->studies().begin() ;
iter!=_pkg->studies().end() ;
iter++) {
254 (*iter)->aggregateSummaryOutput(olist) ;
266 if (!
TString(name).MaybeWildcard()) {
267 result.push_back(name) ;
274 Int_t dotslashpos = -1;
278 dotslashpos = next_dot;
279 next_dot = basename.
Index(
".root",dotslashpos+1);
281 if (basename[dotslashpos+5]!=
'/') {
289 if (dotslashpos>=0) {
291 behind_dot_root = basename(dotslashpos+6,basename.
Length()-dotslashpos+6);
293 basename.
Remove(dotslashpos+5);
299 directory = basename(0,slashpos);
300 basename.
Remove(0,slashpos+1);
313 if (!strcmp(file,
".") || !strcmp(file,
".."))
continue;
315 if ( (basename!=file) && s.
Index(re) ==
kNPOS)
continue;
325 if (behind_dot_root.
Length() != 0)
326 result.push_back(
Form(
"%s/%s/%s",directory.
Data(),file,behind_dot_root.
Data())) ;
328 result.push_back(
Form(
"%s/%s",directory.
Data(),file)) ;
const char * GetName() const
Returns name of object.
Ssiz_t Last(char c) const
Find last occurrence of a character c.
void run(Int_t nExperiments)
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
static void closeProof(Option_t *option="s")
"Option_t *option" takes the parameters forwarded to gProof->Close(option).
virtual const char * WorkingDirectory()
Return working directory.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Collectable string class.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Regular expression class.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
void addStudy(RooAbsStudy &study)
Iterator abstract base class.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
const char * Data() const
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
ClassImp(RooStudyManager)
std::map< std::string, std::string >::const_iterator iter
Book space in a file, create I/O buffers, to fill them, (un)compress them.
RooStudyManager(RooWorkspace &w)
void processBatchOutput(const char *filePat)
R__EXTERN TSystem * gSystem
char * Form(const char *fmt,...)
void expandWildCardSpec(const char *spec, std::list< std::string > &result)
case with one single file
virtual const char * GetName() const
Returns name of object.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
void aggregateData(TList *olist)
virtual void FreeDirectory(void *dirp)
Free a directory.
TString & Remove(Ssiz_t pos)
void runProof(Int_t nExperiments, const char *proofHost="", Bool_t showGui=kTRUE)
Open PROOF-Lite session.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual void Add(TObject *obj)
virtual TObject * Next()=0
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void prepareBatchInput(const char *studyName, Int_t nExpPerJob, Bool_t unifiedInput)
virtual void Close(Option_t *option="")
Close a file.