53 _pkg->addStudy(study) ;
62 std::unique_ptr<TFile>
f{
TFile::Open(studyPackFileName,
"READ")};
73 _pkg->addStudy(study) ;
83 _pkg->driver(nExperiments) ;
91 TFile f(
Form(
"study_data_%s.root",studyName),
"RECREATE") ;
92 _pkg->Write(
"studypack") ;
98 std::ofstream bdr(
Form(
"study_driver_%s.sh", studyName));
99 bdr <<
"#!/bin/sh" << std::endl
100 <<
Form(
"if [ ! -f study_data_%s.root ] ; then",studyName) << std::endl
101 <<
"uudecode <<EOR" << std::endl ;
105 gSystem->Exec(
Form(
"cat study_data_%s.root | uuencode -m study_data_%s.root >> study_driver_%s.sh",studyName,studyName,studyName)) ;
108 std::ofstream bdr2(
Form(
"study_driver_%s.sh", studyName), std::ios::app);
109 bdr2 <<
"EOR" << std::endl
111 <<
"root -l -b <<EOR" << std::endl
112 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;",studyName,nExpPerJob) << std::endl
114 <<
"EOR" << std::endl ;
116 gSystem->Unlink(
Form(
"study_data_%s.root",studyName)) ;
118 coutI(DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '" <<
Form(
"study_driver_%s.sh",studyName) <<
"," << std::endl
119 <<
" input data files is embedded in driver script" << std::endl ;
123 std::ofstream bdr(
Form(
"study_driver_%s.sh", studyName));
124 bdr <<
"#!/bin/sh" << std::endl
125 <<
"root -l -b <<EOR" << std::endl
126 <<
Form(
"RooStudyPackage::processFile(\"%s\",%d) ;", studyName, nExpPerJob) << std::endl
128 <<
"EOR" << std::endl;
130 coutI(DataHandling) <<
"RooStudyManager::prepareBatchInput batch driver file is '"
131 <<
Form(
"study_driver_%s.sh", studyName) <<
"," << std::endl
132 <<
" input data file is " <<
Form(
"study_data_%s.root", studyName) << std::endl;
144 std::list<std::string> flist;
149 for (
auto iter = flist.begin(); iter != flist.end(); ++iter) {
150 coutP(DataHandling) <<
"RooStudyManager::processBatchOutput() now reading file " << *iter << std::endl;
154 TObject *obj =
f.Get(key->GetName());
167 for (
auto study :
_pkg->studies()) {
168 study->aggregateSummaryOutput(olist);
181 result.push_back(
name) ;
188 Int_t dotslashpos = -1;
192 dotslashpos = next_dot;
193 next_dot = basename.
Index(
".root",dotslashpos+1);
195 if (basename[dotslashpos+5]!=
'/') {
203 if (dotslashpos>=0) {
205 behind_dot_root = basename(dotslashpos+6,basename.
Length()-dotslashpos+6);
207 basename.
Remove(dotslashpos+5);
213 directory = basename(0,slashpos);
214 basename.
Remove(0,slashpos+1);
219 TString expand_directory = directory;
220 gSystem->ExpandPathName(expand_directory);
221 void *dir =
gSystem->OpenDirectory(expand_directory.
Data());
228 while ((file =
gSystem->GetDirEntry(dir))) {
229 if (!strcmp(file,
".") || !strcmp(file,
".."))
continue;
231 if ( (basename!=file) && s.
Index(re) ==
kNPOS)
continue;
239 while ((obj =
static_cast<TObjString*
>(next()))) {
241 if (behind_dot_root.
Length() != 0) {
242 result.push_back(
Form(
"%s/%s/%s",directory.
Data(),file,behind_dot_root.
Data())) ;
244 result.push_back(
Form(
"%s/%s", directory.
Data(), file));
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
int Int_t
Signed integer 4 bytes (int).
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
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 ...
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.
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.
TObject()
TObject constructor.
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