67 _pkg->addStudy(study) ;
76 TFile *
f =
new TFile(studyPackFileName) ;
87 _pkg->addStudy(study) ;
97 _pkg->driver(nExperiments) ;
108 void* p = (
void*)
gROOT->ProcessLineFast(
Form(
"TProof::Open(\"%s\")",proofHost)) ;
112 coutE(
Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") ERROR initializing proof, aborting" << endl ;
118 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%lx)->SetProgressDialog(0) ;",(
ULong_t)p)) ;
122 coutP(
Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") sending work package to PROOF servers" << endl ;
126 coutP(
Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") starting PROOF processing of " << nExperiments <<
" experiments" << endl ;
128 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%lx)->Process(\"RooProofDriverSelector\",%d) ;",(
ULong_t)p,nExperiments)) ;
133 aggregateData(olist) ;
137 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%lx)->GetInputList()->Remove((TObject*)0x%lx) ;",(
ULong_t)p,(
ULong_t)_pkg) ) ;
151 if (
gROOT->GetListOfProofs()->LastIndex() != -1 &&
gROOT->ProcessLineFast(
"gProof;"))
153 gROOT->ProcessLineFast(
Form(
"gProof->Close(\"%s\") ;",option)) ;
154 gROOT->ProcessLineFast(
"gProof->CloseProgressDialog() ;") ;
158 if (
gROOT->GetListOfProofs()->LastIndex() != -1 &&
gROOT->ProcessLineFast(
"gProof;")) {
159 gROOT->ProcessLineFast(
"delete gProof ;") ;
172 TFile
f(
Form(
"study_data_%s.root",studyName),
"RECREATE") ;
173 _pkg->Write(
"studypack") ;
179 ofstream bdr(
Form(
"study_driver_%s.sh",studyName)) ;
180 bdr <<
"#!/bin/sh" << endl
181 <<
Form(
"if [ ! -f study_data_%s.root ] ; then",studyName) << endl
182 <<
"uudecode <<EOR" << endl ;
186 gSystem->
Exec(
Form(
"cat study_data_%s.root | uuencode -m study_data_%s.root >> study_driver_%s.sh",studyName,studyName,studyName)) ;
189 ofstream bdr2 (
Form(
"study_driver_%s.sh",studyName),ios::app) ;
190 bdr2 <<
"EOR" << endl
192 <<
"root -l -b <<EOR" << endl
193 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << endl
199 coutI(
DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << endl
200 <<
" input data files is embedded in driver script" << endl ;
204 ofstream bdr(
Form(
"study_driver_%s.sh",studyName)) ;
205 bdr <<
"#!/bin/sh" << endl
206 <<
"root -l -b <<EOR" << endl
207 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << endl
211 coutI(
DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << endl
212 <<
" input data file is " <<
Form(
"study_data_%s.root",studyName) << endl ;
225 expandWildCardSpec(filePat,flist) ;
229 for (list<string>::iterator iter = flist.begin() ; iter!=flist.end() ; ++iter) {
230 coutP(
DataHandling) <<
"RooStudyManager::processBatchOutput() now reading file " << *iter << endl ;
231 TFile
f(iter->c_str()) ;
233 TList* list =
f.GetListOfKeys() ;
245 aggregateData(&olist) ;
254 for (list<RooAbsStudy*>::iterator iter=_pkg->studies().begin() ; iter!=_pkg->studies().end() ; iter++) {
255 (*iter)->aggregateSummaryOutput(olist) ;
267 if (!TString(name).MaybeWildcard()) {
268 result.push_back(name) ;
273 TString basename(name);
275 Int_t dotslashpos = -1;
277 Int_t next_dot = basename.Index(
".root");
279 dotslashpos = next_dot;
280 next_dot = basename.Index(
".root",dotslashpos+1);
282 if (basename[dotslashpos+5]!=
'/') {
289 TString behind_dot_root;
290 if (dotslashpos>=0) {
292 behind_dot_root = basename(dotslashpos+6,basename.Length()-dotslashpos+6);
294 basename.Remove(dotslashpos+5);
297 Int_t slashpos = basename.Last(
'/');
300 directory = basename(0,slashpos);
301 basename.Remove(0,slashpos+1);
314 if (!strcmp(file,
".") || !strcmp(file,
".."))
continue;
316 if ( (basename!=file) && s.Index(re) ==
kNPOS)
continue;
326 if (behind_dot_root.Length() != 0)
327 result.push_back(
Form(
"%s/%s/%s",directory.Data(),file,behind_dot_root.Data())) ;
329 result.push_back(
Form(
"%s/%s",directory.Data(),file)) ;
RooStudyPackage is a utility class to manage studies that consist of repeated applications of generat...
virtual const char * GetName() const
Returns name of object.
std::string GetName(const std::string &scope_name)
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.
Collectable string class.
Regular expression class.
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.
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.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
RooStudyManager(RooWorkspace &w)
RooAbsStudy is an abstract base class for RooStudyManager modules.
const char * GetName() const
Returns name of object.
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
RooStudyManager is a utility class to manage studies that consist of repeated applications of generat...
virtual Int_t Exec(const char *shellcmd)
Execute a command.
void aggregateData(TList *olist)
virtual void FreeDirectory(void *dirp)
Free a directory.
void runProof(Int_t nExperiments, const char *proofHost="", Bool_t showGui=kTRUE)
Open PROOF-Lite session.
Mother of all ROOT objects.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
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 ~.
virtual const char * GetName() const
Returns name of object.
void prepareBatchInput(const char *studyName, Int_t nExpPerJob, Bool_t unifiedInput)
The RooWorkspace is a persistable container for RooFit projects.