72 std::unique_ptr<TFile>
f{
TFile::Open(studyPackFileName,
"READ")};
103 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") opening PROOF session" << endl ;
104 void*
p = (
void*)
gROOT->ProcessLineFast(
Form(
"TProof::Open(\"%s\")",proofHost)) ;
108 coutE(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") ERROR initializing proof, aborting" << endl ;
114 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->SetProgressDialog(0) ;",(
size_t)
p)) ;
118 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") sending work package to PROOF servers" << endl ;
119 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->AddInput((TObject*)0x%zx) ;",(
size_t)
p,(
size_t)
_pkg) ) ;
122 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") starting PROOF processing of " << nExperiments <<
" experiments" << endl ;
124 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->Process(\"RooProofDriverSelector\",%d) ;",(
size_t)
p,nExperiments)) ;
127 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") aggregating results data" << endl ;
128 TList* olist = (
TList*)
gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->GetOutputList()",(
size_t)
p)) ;
132 coutP(Generation) <<
"RooStudyManager::runProof(" <<
GetName() <<
") cleaning up input list" << endl ;
133 gROOT->ProcessLineFast(
Form(
"((TProof*)0x%zx)->GetInputList()->Remove((TObject*)0x%zx) ;",(
size_t)
p,(
size_t)
_pkg) ) ;
147 if (
gROOT->GetListOfProofs()->LastIndex() != -1 &&
gROOT->ProcessLineFast(
"gProof;"))
150 gROOT->ProcessLineFast(
"gProof->CloseProgressDialog() ;") ;
154 if (
gROOT->GetListOfProofs()->LastIndex() != -1 &&
gROOT->ProcessLineFast(
"gProof;")) {
155 gROOT->ProcessLineFast(
"delete gProof ;") ;
158 ooccoutI(
nullptr,Generation) <<
"RooStudyManager: No global Proof objects. No connections closed." << endl ;
168 TFile f(
Form(
"study_data_%s.root",studyName),
"RECREATE") ;
175 ofstream bdr(
Form(
"study_driver_%s.sh",studyName)) ;
176 bdr <<
"#!/bin/sh" << endl
177 <<
Form(
"if [ ! -f study_data_%s.root ] ; then",studyName) << endl
178 <<
"uudecode <<EOR" << endl ;
182 gSystem->
Exec(
Form(
"cat study_data_%s.root | uuencode -m study_data_%s.root >> study_driver_%s.sh",studyName,studyName,studyName)) ;
185 ofstream bdr2 (
Form(
"study_driver_%s.sh",studyName),ios::app) ;
186 bdr2 <<
"EOR" << endl
188 <<
"root -l -b <<EOR" << endl
189 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << endl
195 coutI(DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << endl
196 <<
" input data files is embedded in driver script" << endl ;
200 ofstream bdr(
Form(
"study_driver_%s.sh",studyName)) ;
201 bdr <<
"#!/bin/sh" << endl
202 <<
"root -l -b <<EOR" << endl
203 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << endl
207 coutI(DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << endl
208 <<
" input data file is " <<
Form(
"study_data_%s.root",studyName) << endl ;
225 for (list<string>::iterator iter = flist.begin() ; iter!=flist.end() ; ++iter) {
226 coutP(DataHandling) <<
"RooStudyManager::processBatchOutput() now reading file " << *iter << endl ;
229 for(
auto * key : static_range_cast<TKey*>(*
f.GetListOfKeys())) {
230 TObject * obj =
f.Get(key->GetName()) ;
244 (*iter)->aggregateSummaryOutput(olist) ;
264 Int_t dotslashpos = -1;
268 dotslashpos = next_dot;
269 next_dot = basename.
Index(
".root",dotslashpos+1);
271 if (basename[dotslashpos+5]!=
'/') {
279 if (dotslashpos>=0) {
281 behind_dot_root = basename(dotslashpos+6,basename.
Length()-dotslashpos+6);
283 basename.
Remove(dotslashpos+5);
289 directory = basename(0,slashpos);
290 basename.
Remove(0,slashpos+1);
295 TString expand_directory = directory;
305 if (!strcmp(
file,
".") || !strcmp(
file,
".."))
continue;
317 if (behind_dot_root.
Length() != 0)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
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 showGui=true)
Open PROOF-Lite session.
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).
void prepareBatchInput(const char *studyName, Int_t nExpPerJob, bool unifiedInput)
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()
Persistable container for RooFit projects.
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
void Add(TObject *obj) override
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
const char * GetName() const override
Returns name of object.
Collectable string class.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
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.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void Delete(Option_t *option="")
Delete this object.
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.