42using std::list, std::cout, std::endl, std::string;
58 list<RooAbsStudy*>::const_iterator iter = other.
_studies.begin() ;
59 for (;iter!=other.
_studies.end() ; ++iter) {
60 _studies.push_back((*iter)->clone()) ;
91 for (list<RooAbsStudy*>::iterator iter=
_studies.begin() ; iter!=
_studies.end() ; ++iter) {
92 (*iter)->attach(*
_ws) ;
93 (*iter)->initialize() ;
104 Int_t prescale = nExperiments>100 ?
Int_t(nExperiments/100) : 1 ;
105 for (
Int_t i=0 ; i<nExperiments ; i++) {
107 coutP(Generation) <<
"RooStudyPackage::run(" <<
GetName() <<
") processing experiment " << i <<
"/" << nExperiments << endl ;
119 for (list<RooAbsStudy*>::iterator iter=
_studies.begin() ; iter!=
_studies.end() ; ++iter) {
132 for (list<RooAbsStudy*>::iterator iter=
_studies.begin() ; iter!=
_studies.end() ; ++iter) {
133 (*iter)->finalize() ;
144 for (list<RooAbsStudy*>::iterator iter=
_studies.begin() ; iter!=
_studies.end() ; ++iter) {
146 (*iter)->finalize() ;
148 RooDataSet* summaryData = (*iter)->summaryData() ;
151 cout <<
"registering summary dataset: " ; summaryData->
Print() ;
152 olist->
Add(summaryData) ;
156 if (detailedData && detailedData->
GetSize()>0) {
159 cout <<
"registering detailed dataset " << detailedData->
ClassName() <<
"::"
160 << detailedData->
GetName() <<
" with " << detailedData->
GetSize() <<
" elements" << endl ;
161 for(
auto dobj : static_range_cast<TNamed*>(*detailedData)) {
162 dobj->SetName(
Form(
"%s_%d",dobj->GetName(),seqno)) ;
164 olist->
Add(detailedData) ;
165 (*iter)->releaseDetailData() ;
186 if (worknumber !=
"undef")
187 iworker =
int( worknumber.
Atof()*10 + 0.1);
190 for (
int i = 0; i <= iworker; ++i )
207 string name_fin =
Form(
"study_data_%s.root",studyName) ;
208 TFile fin(name_fin.c_str()) ;
211 cout <<
"RooStudyPackage::processFile() ERROR input file " << name_fin <<
" does not contain a RooStudyPackage named 'studypack'" << endl ;
217 cout <<
"RooStudyPackage::processFile() Initial random seed for this run is " << seqno << endl ;
225 TFile fout(
Form(
"study_result_%s_%d.root",studyName,seqno),
"RECREATE") ;
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
Abstract base class for RooStudyManager modules.
Container class to hold unbinned data.
void SetName(const char *name) override
Change the name of this dataset into the given name.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
void SetName(const char *name)
const char * GetName() const override
Returns name of object.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Utility class to manage studies that consist of repeated applications of generate-and-fit operations ...
void driver(Int_t nExperiments)
Int_t initRandom()
Choose random seed for this process in case pass a definite seed to have it deterministic use also wo...
std::list< RooAbsStudy * > _studies
static void processFile(const char *infile, Int_t nexp)
Read in study package.
void addStudy(RooAbsStudy &study)
void finalize()
Finalize all studies.
void initialize()
Make iterator over copy of studies attached to workspace.
void exportData(TList *olist, Int_t seqno)
RooStudyPackage()=default
void run(Int_t nExperiments)
Persistable container for RooFit projects.
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write all objects in this collection.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
void Close(Option_t *option="") override
Close a file.
void Add(TObject *obj) override
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
Double_t Atof() const
Return floating-point value contained in string.