69 _unifParams(other._unifParams),
70 _gausParams(other._gausParams),
100 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << param.
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
121 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << param.
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
147 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::sampleSumUniform() ERROR: input parameter " << arg->
GetName() <<
" is not a RooRealVar and is ignored" << endl ;
160 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::sampleSumUniform: variable " << arg2->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
162 okset2.
add(*actualVar) ;
196 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::sampleSumGauss() ERROR: input parameter " << arg->
GetName() <<
" is not a RooRealVar and is ignored" << endl ;
209 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::sampleSumUniform: variable " << arg2->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
211 okset2.
add(*actualVar) ;
234 std::list<UniParam>::iterator uiter ;
240 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << uiter->_param->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
244 uiter->_param = actualPar ;
247 std::string parName = std::string(uiter->_param->GetName()) +
"_gen";
248 std::string parTitle = std::string(uiter->_param->GetTitle()) +
" as generated";
249 _genParSet.
addOwned(std::make_unique<RooRealVar>(parName.c_str(),parTitle.c_str(),0));
253 std::list<GausParam>::iterator giter ;
259 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << giter->_param->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
263 giter->_param = actualPar ;
266 std::string parName = std::string(giter->_param->GetName()) +
"_gen";
267 std::string parTitle = std::string(giter->_param->GetTitle()) +
" as generated";
268 _genParSet.
addOwned(std::make_unique<RooRealVar>(parName.c_str(),parTitle.c_str(),0));
273 std::list<UniParamSet>::iterator usiter ;
281 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << arg->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
283 actualPSet.
add(*actualVar) ;
286 usiter->_pset.removeAll() ;
287 usiter->_pset.add(actualPSet) ;
290 for(
auto * param : static_range_cast<RooRealVar*>(usiter->_pset)) {
291 std::string parName = std::string(param->GetName()) +
"_gen";
292 std::string parTitle = std::string(param->GetTitle()) +
" as generated";
293 _genParSet.
addOwned(std::make_unique<RooRealVar>(parName.c_str(),parTitle.c_str(),0));
298 std::list<GausParamSet>::iterator ugiter ;
306 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << arg->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
308 actualPSet.
add(*actualVar) ;
312 ugiter->_pset.removeAll() ;
313 ugiter->_pset.add(actualPSet) ;
316 for(
auto * param : static_range_cast<RooRealVar*>(ugiter->_pset)) {
317 std::string parName = std::string(param->GetName()) +
"_gen";
318 std::string parTitle = std::string(param->GetTitle()) +
" as generated";
319 _genParSet.
addOwned(std::make_unique<RooRealVar>(parName.c_str(),parTitle.c_str(),0));
349 std::list<UniParam>::iterator uiter ;
352 oocoutE(
nullptr,Generation) <<
"RooRandomizeParamMCSModule::processBeforeGen: applying uniform smearing to generator parameter "
353 << uiter->_param->GetName() <<
" in range [" << uiter->_lo <<
"," << uiter->_hi <<
"], chosen value for this sample is " << newVal << endl ;
354 uiter->_param->setVal(newVal) ;
361 std::list<GausParam>::iterator giter ;
364 oocoutI(
nullptr,Generation) <<
"RooRandomizeParamMCSModule::processBeforeGen: applying gaussian smearing to generator parameter "
365 << giter->_param->GetName() <<
" with a mean of " << giter->_mean <<
" and a width of " << giter->_sigma <<
", chosen value for this sample is " << newVal << endl ;
366 giter->_param->setVal(newVal) ;
373 std::list<UniParamSet>::iterator usiter ;
378 oocoutI(
nullptr,Generation) <<
"RooRandomizeParamMCSModule::processBeforeGen: applying uniform smearing to sum of set of generator parameters "
380 <<
" in range [" << usiter->_lo <<
"," << usiter->_hi <<
"], chosen sum value for this sample is " << newVal << endl ;
383 RooAddition sumVal(
"sumVal",
"sumVal",usiter->_pset) ;
384 double compScaleFactor = newVal/sumVal.
getVal() ;
387 for(
auto * param : static_range_cast<RooRealVar*>(usiter->_pset)) {
388 param->setVal(param->getVal()*compScaleFactor) ;
390 genpar->
setVal(param->getVal()) ;
395 std::list<GausParamSet>::iterator gsiter ;
400 oocoutI(
nullptr,Generation) <<
"RooRandomizeParamMCSModule::processBeforeGen: applying gaussian smearing to sum of set of generator parameters "
402 <<
" with a mean of " << gsiter->_mean <<
" and a width of " << gsiter->_sigma
403 <<
", chosen value for this sample is " << newVal << endl ;
406 RooAddition sumVal(
"sumVal",
"sumVal",gsiter->_pset) ;
407 double compScaleFactor = newVal/sumVal.
getVal() ;
410 for(
auto * param : static_range_cast<RooRealVar*>(gsiter->_pset)) {
411 param->setVal(param->getVal()*compScaleFactor) ;
413 genpar->
setVal(param->getVal()) ;
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsMCStudyModule is a base class for add-on modules to RooMCStudy that can perform additional calc...
RooArgSet * genParams()
Return current value of generator model parameters.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAddition calculates the sum of a set of RooAbsReal terms, or when constructed with two sets,...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooDataSet is a container class to hold unbinned data.
void add(const RooArgSet &row, double weight=1.0, double weightError=0.0) override
Add one ore more rows of data.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
RooRandomizeParamMCSModule is an add-on modules to RooMCStudy that allows you to randomize input gene...
void sampleSumGauss(const RooArgSet ¶mSet, double lo, double hi)
Request gaussian smearing of sum of parameters in paramSet uniform smearing with mean 'mean' and widt...
bool initializeRun(Int_t) override
Initialize module at beginning of RooCMStudy run.
std::list< GausParam > _gausParams
!
void sampleSumUniform(const RooArgSet ¶mSet, double lo, double hi)
Request uniform smearing of sum of parameters in paramSet uniform smearing in range [lo,...
std::list< UniParamSet > _unifParamSets
!
void sampleGaussian(RooRealVar ¶m, double mean, double sigma)
Request Gaussian smearing of param in with mean 'mean' and width 'sigma' in RooMCStudy generation cyc...
bool processBeforeGen(Int_t) override
Apply all smearings to generator parameters.
~RooRandomizeParamMCSModule() override
Destructor.
RooRandomizeParamMCSModule()
Constructor.
RooDataSet * finalizeRun() override
Return auxiliary data of this module so that it is merged with RooMCStudy::fitParDataSet()
bool initializeInstance() override
Initialize module after attachment to RooMCStudy object.
void sampleUniform(RooRealVar ¶m, double lo, double hi)
Request uniform smearing of param in range [lo,hi] in RooMCStudy generation cycle.
std::list< GausParamSet > _gausParamSets
!
std::list< UniParam > _unifParams
!
RooRealVar represents a variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
const char * GetName() const override
Returns name of object.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).