61 std::unique_ptr<TFile>
f{
TFile::Open(studyPackFileName,
"READ")};
90 TFile f(
Form(
"study_data_%s.root",studyName),
"RECREATE") ;
97 std::ofstream bdr(
Form(
"study_driver_%s.sh", studyName));
98 bdr <<
"#!/bin/sh" << std::endl
99 <<
Form(
"if [ ! -f study_data_%s.root ] ; then",studyName) << std::endl
100 <<
"uudecode <<EOR" << std::endl ;
104 gSystem->
Exec(
Form(
"cat study_data_%s.root | uuencode -m study_data_%s.root >> study_driver_%s.sh",studyName,studyName,studyName)) ;
107 std::ofstream bdr2(
Form(
"study_driver_%s.sh", studyName), std::ios::app);
108 bdr2 <<
"EOR" << std::endl
110 <<
"root -l -b <<EOR" << std::endl
111 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << std::endl
113 <<
"EOR" << std::endl ;
117 coutI(DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << std::endl
118 <<
" input data files is embedded in driver script" << std::endl ;
122 std::ofstream bdr(
Form(
"study_driver_%s.sh", studyName));
123 bdr <<
"#!/bin/sh" << std::endl
124 <<
"root -l -b <<EOR" << std::endl
125 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;", studyName, nExpPerJob) << std::endl
127 <<
"EOR" << std::endl;
129 coutI(DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '"
130 <<
Form(
"study_driver_%s.sh", studyName) <<
"," << std::endl
131 <<
" input data file is " <<
Form(
"study_data_%s.root", studyName) << std::endl;
143 std::list<std::string> flist;
148 for (
auto iter = flist.begin(); iter != flist.end(); ++iter) {
149 coutP(DataHandling) <<
"RooStudyManager::processBatchOutput() now reading file " << *iter << std::endl;
152 for (
auto *key : static_range_cast<TKey *>(*
f.GetListOfKeys())) {
153 TObject *obj =
f.Get(key->GetName());
167 study->aggregateSummaryOutput(olist);
187 Int_t dotslashpos = -1;
191 dotslashpos = next_dot;
192 next_dot = basename.
Index(
".root",dotslashpos+1);
194 if (basename[dotslashpos+5]!=
'/') {
202 if (dotslashpos>=0) {
204 behind_dot_root = basename(dotslashpos+6,basename.
Length()-dotslashpos+6);
206 basename.
Remove(dotslashpos+5);
212 directory = basename(0,slashpos);
213 basename.
Remove(0,slashpos+1);
218 TString expand_directory = directory;
228 if (!strcmp(file,
".") || !strcmp(file,
".."))
continue;
230 if ( (basename!=file) && s.
Index(re) ==
kNPOS)
continue;
238 while ((obj =
static_cast<TObjString*
>(next()))) {
240 if (behind_dot_root.
Length() != 0) {
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
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.
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)
void prepareBatchInput(const char *studyName, Int_t nExpPerJob, bool unifiedInput)
RooStudyManager(RooWorkspace &w)
void aggregateData(TList *olist)
Utility class to manage studies that consist of repeated applications of generate-and-fit operations ...
void driver(Int_t nExperiments)
void addStudy(RooAbsStudy &study)
std::list< RooAbsStudy * > & studies()
Persistable container for RooFit projects.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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.
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.
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.