diff --git a/roofit/roofitcore/inc/RooLinkedList.h b/roofit/roofitcore/inc/RooLinkedList.h index 8152e68a05202b5f4ab9442e537757d1e0fce7e6..95d39e8375994cc618ee5c4b4daf312be74ebe78 100644 --- a/roofit/roofitcore/inc/RooLinkedList.h +++ b/roofit/roofitcore/inc/RooLinkedList.h @@ -85,6 +85,8 @@ public: const char* GetName() const { return _name.Data() ; } void SetName(const char* name) { _name = name ; } void useNptr(Bool_t flag) { _useNptr = flag ; } + // needed for using it in THashList/THashTable + ULong_t Hash() const { return _name.Hash(); } protected: diff --git a/roofit/roofitcore/src/RooAbsStudy.cxx b/roofit/roofitcore/src/RooAbsStudy.cxx index fd6d5944f96aef74ccc96755e856a9e9352d0712..b305ab28cf3b25f0cb61d2be2ff2c4a94388c6f2 100644 --- a/roofit/roofitcore/src/RooAbsStudy.cxx +++ b/roofit/roofitcore/src/RooAbsStudy.cxx @@ -103,11 +103,11 @@ void RooAbsStudy::storeDetailedOutput(TNamed& object) if (!_detailData) { _detailData = new RooLinkedList ; - _detailData->SetName(Form("%s_detailed_data",GetName())) ; + _detailData->SetName(TString::Format("%s_detailed_data_list",GetName())) ; //cout << "RooAbsStudy::ctor() detailData name = " << _detailData->GetName() << endl ; } - object.SetName(Form("%s_detailed_data_%d",GetName(),_detailData->GetSize())) ; + object.SetName(TString::Format("%s_detailed_data_%d",GetName(),_detailData->GetSize())) ; //cout << "storing detailed data with name " << object.GetName() << endl ; _detailData->Add(&object) ; } else { diff --git a/roofit/roofitcore/src/RooStudyPackage.cxx b/roofit/roofitcore/src/RooStudyPackage.cxx index 46160639f844bf157e11fe48a1dc4fdc1a4888ef..fadb011e25f3a7851598a48865f300c9de9ed40a 100644 --- a/roofit/roofitcore/src/RooStudyPackage.cxx +++ b/roofit/roofitcore/src/RooStudyPackage.cxx @@ -37,8 +37,10 @@ #include "TTree.h" #include "TDSet.h" #include "TFile.h" -#include "TRandom.h" +#include "TRandom2.h" #include "RooRandom.h" +#include "TMath.h" +#include "TEnv.h" using namespace std ; @@ -179,8 +181,23 @@ void RooStudyPackage::exportData(TList* olist, Int_t seqno) Int_t RooStudyPackage::initRandom() { // Choose random seed for this process - gRandom->SetSeed(0) ; - Int_t seed = gRandom->Integer(1000000) ; + // in case pass a definite seed to have it deterministic + // use also worker number + TRandom2 random(0); + //gRandom->SetSeed(0) ; + Int_t seed = random.Integer(TMath::Limits<Int_t>::Max()) ; + + // get worker number + TString worknumber = gEnv->GetValue("ProofServ.Ordinal","undef"); + int iworker = -1; + if (worknumber != "undef") + iworker = int( worknumber.Atof()*10 + 0.1); + + if (iworker >= 0) { + for (int i = 0; i <= iworker; ++i ) + seed = random.Integer( TMath::Limits<Int_t>::Max() ); + } + RooRandom::randomGenerator()->SetSeed(seed) ; gRandom->SetSeed(seed) ;