67 _unifParams(other._unifParams),
68 _gausParams(other._gausParams)
85 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << param.
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
106 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << param.
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
132 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::sampleSumUniform() ERROR: input parameter " << arg->
GetName() <<
" is not a RooRealVar and is ignored" << endl ;
145 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::sampleSumUniform: variable " << arg2->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
147 okset2.
add(*actualVar) ;
181 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::sampleSumGauss() ERROR: input parameter " << arg->
GetName() <<
" is not a RooRealVar and is ignored" << endl ;
194 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::sampleSumUniform: variable " << arg2->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
196 okset2.
add(*actualVar) ;
219 std::list<UniParam>::iterator uiter ;
225 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << uiter->_param->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
229 uiter->_param = actualPar ;
232 std::string parName = std::string(uiter->_param->GetName()) +
"_gen";
233 std::string parTitle = std::string(uiter->_param->GetTitle()) +
" as generated";
234 _genParSet.
addOwned(std::make_unique<RooRealVar>(parName.c_str(),parTitle.c_str(),0));
238 std::list<GausParam>::iterator giter ;
244 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << giter->_param->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
248 giter->_param = actualPar ;
251 std::string parName = std::string(giter->_param->GetName()) +
"_gen";
252 std::string parTitle = std::string(giter->_param->GetTitle()) +
" as generated";
253 _genParSet.
addOwned(std::make_unique<RooRealVar>(parName.c_str(),parTitle.c_str(),0));
258 std::list<UniParamSet>::iterator usiter ;
266 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << arg->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
268 actualPSet.
add(*actualVar) ;
271 usiter->_pset.removeAll() ;
272 usiter->_pset.add(actualPSet) ;
275 for(
auto * param : static_range_cast<RooRealVar*>(usiter->_pset)) {
276 std::string parName = std::string(param->GetName()) +
"_gen";
277 std::string parTitle = std::string(param->GetTitle()) +
" as generated";
278 _genParSet.
addOwned(std::make_unique<RooRealVar>(parName.c_str(),parTitle.c_str(),0));
283 std::list<GausParamSet>::iterator ugiter ;
291 oocoutW(
nullptr,InputArguments) <<
"RooRandomizeParamMCSModule::initializeInstance: variable " << arg->
GetName() <<
" is not a parameter of RooMCStudy model and is ignored!" << endl ;
293 actualPSet.
add(*actualVar) ;
297 ugiter->_pset.removeAll() ;
298 ugiter->_pset.add(actualPSet) ;
301 for(
auto * param : static_range_cast<RooRealVar*>(ugiter->_pset)) {
302 std::string parName = std::string(param->GetName()) +
"_gen";
303 std::string parTitle = std::string(param->GetTitle()) +
" as generated";
304 _genParSet.
addOwned(std::make_unique<RooRealVar>(parName.c_str(),parTitle.c_str(),0));
309 _data = std::make_unique<RooDataSet>(
"DeltaLLSigData",
"Additional data for Delta(-log(L)) study",
_genParSet) ;
334 std::list<UniParam>::iterator uiter ;
337 oocoutE(
nullptr,Generation) <<
"RooRandomizeParamMCSModule::processBeforeGen: applying uniform smearing to generator parameter "
338 << uiter->_param->GetName() <<
" in range [" << uiter->_lo <<
"," << uiter->_hi <<
"], chosen value for this sample is " << newVal << endl ;
339 uiter->_param->setVal(newVal) ;
346 std::list<GausParam>::iterator giter ;
349 oocoutI(
nullptr,Generation) <<
"RooRandomizeParamMCSModule::processBeforeGen: applying gaussian smearing to generator parameter "
350 << giter->_param->GetName() <<
" with a mean of " << giter->_mean <<
" and a width of " << giter->_sigma <<
", chosen value for this sample is " << newVal << endl ;
351 giter->_param->setVal(newVal) ;
358 std::list<UniParamSet>::iterator usiter ;
363 oocoutI(
nullptr,Generation) <<
"RooRandomizeParamMCSModule::processBeforeGen: applying uniform smearing to sum of set of generator parameters "
365 <<
" in range [" << usiter->_lo <<
"," << usiter->_hi <<
"], chosen sum value for this sample is " << newVal << endl ;
368 RooAddition sumVal(
"sumVal",
"sumVal",usiter->_pset) ;
369 double compScaleFactor = newVal/sumVal.
getVal() ;
372 for(
auto * param : static_range_cast<RooRealVar*>(usiter->_pset)) {
373 param->setVal(param->getVal()*compScaleFactor) ;
375 genpar->
setVal(param->getVal()) ;
380 std::list<GausParamSet>::iterator gsiter ;
385 oocoutI(
nullptr,Generation) <<
"RooRandomizeParamMCSModule::processBeforeGen: applying gaussian smearing to sum of set of generator parameters "
387 <<
" with a mean of " << gsiter->_mean <<
" and a width of " << gsiter->_sigma
388 <<
", chosen value for this sample is " << newVal << endl ;
391 RooAddition sumVal(
"sumVal",
"sumVal",gsiter->_pset) ;
392 double compScaleFactor = newVal/sumVal.
getVal() ;
395 for(
auto * param : static_range_cast<RooRealVar*>(gsiter->_pset)) {
396 param->setVal(param->getVal()*compScaleFactor) ;
398 genpar->
setVal(param->getVal()) ;
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
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.
Base class for add-on modules to RooMCStudy that can perform additional calculations on each generate...
RooArgSet * genParams()
Return current value of generator model parameters.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
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.
Container class to hold unbinned data.
const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Add-on module to RooMCStudy that allows you to randomize input generation parameters.
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...
std::unique_ptr< RooDataSet > _data
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
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
!
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).