From d36c48600946ece8101e05b0621bdc3c6e8b34c9 Mon Sep 17 00:00:00 2001 From: rkansal47 Date: Thu, 27 Jul 2023 09:27:22 -0500 Subject: [PATCH] comments and indentation --- src/Combine.cc | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/src/Combine.cc b/src/Combine.cc index 04cfdccd385..b2281c7928f 100644 --- a/src/Combine.cc +++ b/src/Combine.cc @@ -216,7 +216,7 @@ void Combine::applyOptions(const boost::program_options::variables_map &vm) { } std::string Combine::parseRegex(std::string instr, const RooArgSet *nuisances, RooWorkspace *w) { - // expand regexps + // expand regexps inside the "rgx{}" option while (instr.find("rgx{") != std::string::npos) { size_t pos1 = instr.find("rgx{"); size_t pos2 = instr.find("}",pos1); @@ -224,7 +224,6 @@ std::string Combine::parseRegex(std::string instr, const RooArgSet *nuisances, R std::string poststr = instr.substr(pos2+1,instr.size()-pos2); std::string reg_esp = instr.substr(pos1+4,pos2-pos1-4); - //std::cout<<"interpreting "<argSet(floatNuisances_.c_str()))); RooArgSet toFloat; if (floatNuisances_=="all") { toFloat.add(*nuisances); @@ -672,8 +669,8 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do } if (verbose > 0) { - std::cout << "Set floating the following parameters: "; toFloat.Print(""); - Logger::instance().log(std::string(Form("Combine.cc: %d -- Set floating the following parameters: ",__LINE__)),Logger::kLogLevelInfo,__func__); + std::cout << "Floating the following parameters: "; toFloat.Print(""); + Logger::instance().log(std::string(Form("Combine.cc: %d -- Floating the following parameters: ",__LINE__)),Logger::kLogLevelInfo,__func__); std::unique_ptr iter(toFloat.createIterator()); for (RooAbsArg *a = (RooAbsArg*) iter->Next(); a != 0; a = (RooAbsArg*) iter->Next()) { Logger::instance().log(std::string(Form("Combine.cc: %d %s ",__LINE__,a->GetName())),Logger::kLogLevelInfo,__func__); @@ -685,7 +682,6 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do if (freezeNuisances_ != "") { freezeNuisances_ = parseRegex(freezeNuisances_, nuisances, w); - //RooArgSet toFreeze((freezeNuisances_=="all")?*nuisances:(w->argSet(freezeNuisances_.c_str()))); RooArgSet toFreeze; if (freezeNuisances_=="allConstrainedNuisances") { toFreeze.add(*nuisances); @@ -713,7 +709,7 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do std::unique_ptr iter(toFreeze.createIterator()); for (RooAbsArg *a = (RooAbsArg*) iter->Next(); a != 0; a = (RooAbsArg*) iter->Next()) { Logger::instance().log(std::string(Form("Combine.cc: %d %s ",__LINE__,a->GetName())),Logger::kLogLevelInfo,__func__); - } + } } utils::setAllConstant(toFreeze, true); if (nuisances) { @@ -731,24 +727,24 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do for (std::vector::iterator ng_it=nuisanceGroups.begin();ng_it!=nuisanceGroups.end();ng_it++){ bool freeze_complement=false; if (boost::algorithm::starts_with((*ng_it),"^")){ - freeze_complement=true; - (*ng_it).erase(0,1); - } + freeze_complement=true; + (*ng_it).erase(0,1); + } - if (!w->set(Form("group_%s",(*ng_it).c_str()))){ - std::cerr << "Unknown nuisance group: " << (*ng_it) << std::endl; - throw std::invalid_argument("Unknown nuisance group name"); - } - RooArgSet groupNuisances(*(w->set(Form("group_%s",(*ng_it).c_str())))); - RooArgSet toFreeze; + if (!w->set(Form("group_%s",(*ng_it).c_str()))){ + std::cerr << "Unknown nuisance group: " << (*ng_it) << std::endl; + throw std::invalid_argument("Unknown nuisance group name"); + } + RooArgSet groupNuisances(*(w->set(Form("group_%s",(*ng_it).c_str())))); + RooArgSet toFreeze; - if (freeze_complement) { - RooArgSet still_floating(*mc->GetNuisanceParameters()); - still_floating.remove(groupNuisances,true,true); - toFreeze.add(still_floating); - } else { - toFreeze.add(groupNuisances); - } + if (freeze_complement) { + RooArgSet still_floating(*mc->GetNuisanceParameters()); + still_floating.remove(groupNuisances,true,true); + toFreeze.add(still_floating); + } else { + toFreeze.add(groupNuisances); + } if (verbose > 0) { std::cout << "Freezing the following nuisance parameters: "; toFreeze.Print(""); } utils::setAllConstant(toFreeze, true); @@ -758,7 +754,7 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do mc->SetNuisanceParameters(newnuis); if (mc_bonly) mc_bonly->SetNuisanceParameters(newnuis); nuisances = mc->GetNuisanceParameters(); - } + } } }