Date: Wednesday, November 24, 2021 @ 13:17:27 Author: kgizdov Revision: 1054678
upgpkg: root 6.24.06-7: remove unstable patches Modified: root/trunk/PKGBUILD Deleted: root/trunk/9271.patch ------------+ 9271.patch | 753 ----------------------------------------------------------- PKGBUILD | 4 2 files changed, 1 insertion(+), 756 deletions(-) Deleted: 9271.patch =================================================================== --- 9271.patch 2021-11-24 13:16:02 UTC (rev 1054677) +++ 9271.patch 2021-11-24 13:17:27 UTC (rev 1054678) @@ -1,753 +0,0 @@ -From ef095d953b7632654dcd93aa3151508dfefa22d3 Mon Sep 17 00:00:00 2001 -From: Konstantin Gizdov <[email protected]> -Date: Thu, 11 Nov 2021 01:57:36 +0200 -Subject: [PATCH] backport 'address some -Wnonnull issue and follow-up - improvements' to v6-24-00-patches - -RooFit::HistFactory::ConfigParser: fix null dereferences, improve logic, modernise, fix some edge cases, optimise performance -RooAddModel: fix null dereferences -TMVA::DataLoader: calling .front() in an empty container is undefined, fix also null ptr dereference -RooDataHist and RooRealSumFunc fixes for null dereferences -RooAbsCollection: safer Int_t getSize() and RooAbsArg* front(), offer alternatives -RooDataHist::_adjustBinning throw std::logic_error when pass type is not derived from real -clang-format applied ---- - roofit/histfactory/src/ConfigParser.cxx | 469 ++++++++---------- - roofit/roofitcore/inc/RooAbsCollection.h | 17 +- - roofit/roofitcore/src/RooAddModel.cxx | 114 +++-- - roofit/roofitcore/src/RooDataHist.cxx | 15 +- - roofit/roofitcore/src/RooRealSumFunc.cxx | 5 +- - .../Architectures/Reference/DataLoader.cxx | 12 + - 6 files changed, 299 insertions(+), 333 deletions(-) - -diff --git a/roofit/histfactory/src/ConfigParser.cxx b/roofit/histfactory/src/ConfigParser.cxx -index 227a16b6a0a9..3ec032579037 100644 ---- a/roofit/histfactory/src/ConfigParser.cxx -+++ b/roofit/histfactory/src/ConfigParser.cxx -@@ -260,280 +260,215 @@ std::vector< RooStats::HistFactory::Measurement > ConfigParser::GetMeasurementsF - return measurement_list; - - } -- - --HistFactory::Measurement ConfigParser::CreateMeasurementFromDriverNode( TXMLNode* node ) { -- -- -- HistFactory::Measurement measurement; -- -- // Set the default values: -- measurement.SetLumi( 1.0 ); -- measurement.SetLumiRelErr( .10 ); -- measurement.SetBinLow( 0 ); -- measurement.SetBinHigh( 1 ); -- measurement.SetExportOnly( false ); -- -- cxcoutIHF << "Creating new measurement: " << std::endl; -- -- // First, get the attributes of the node -- TListIter attribIt = node->GetAttributes(); -- TXMLAttr* curAttr = 0; -- while( ( curAttr = dynamic_cast< TXMLAttr* >( attribIt() ) ) != 0 ) { -- -- if( curAttr->GetName() == TString( "" ) ) { -- cxcoutEHF << "Found XML attribute in Measurement with no name" << std::endl; -- // ADD Output Here -- throw hf_exc(); -- } -- else if( curAttr->GetName() == TString( "Name" ) ) { -- //rowTitle=curAttr->GetValue(); -- measurement.SetName( curAttr->GetValue() ); -- //measurement.OutputFileName = outputFileNamePrefix+"_"+rowTitle+".root"; -- } -- else if( curAttr->GetName() == TString( "Lumi" ) ) { -- measurement.SetLumi( atof(curAttr->GetValue()) ); -- } -- else if( curAttr->GetName() == TString( "LumiRelErr" ) ) { -- measurement.SetLumiRelErr( atof(curAttr->GetValue()) ); -- } -- else if( curAttr->GetName() == TString( "BinLow" ) ) { -- measurement.SetBinLow( atoi(curAttr->GetValue()) ); -- } -- else if( curAttr->GetName() == TString( "BinHigh" ) ) { -- measurement.SetBinHigh( atoi(curAttr->GetValue()) ); -- } -- else if( curAttr->GetName() == TString( "Mode" ) ) { -- cout <<"\n INFO: Mode attribute is deprecated, will ignore\n"<<endl; -- } -- else if( curAttr->GetName() == TString( "ExportOnly" ) ) { -- measurement.SetExportOnly( CheckTrueFalse(curAttr->GetValue(),"Measurement") ); -- } -- -- else { -- cxcoutEHF << "Found unknown XML attribute in Measurement: " << curAttr->GetName() -- << std::endl; -- throw hf_exc(); -- } -- -- } // End Loop over attributes -- -- -- // Then, get the properties of the children nodes -- TXMLNode* child = node->GetChildren(); -- while( child != 0 ) { -- -- if( child->GetNodeName() == TString( "" ) ) { -- cxcoutEHF << "Found XML child node of Measurement with no name" << std::endl; -- throw hf_exc(); -- } -- -- else if( child->GetNodeName() == TString( "POI" ) ) { -- if( child->GetText() == NULL ) { -- cxcoutEHF << "Error: node: " << child->GetName() -- << " has no text." << std::endl; -- throw hf_exc(); -+HistFactory::Measurement ConfigParser::CreateMeasurementFromDriverNode(TXMLNode *node) -+{ -+ // construct and return at bottom -+ HistFactory::Measurement measurement; -+ -+ // safety for public functions -+ if (node == nullptr) { -+ cxcoutWHF << "Input driver node is undefined, ignoring\n"; -+ return measurement; -+ } -+ -+ // Set the default values: -+ measurement.SetLumi(1.0); -+ measurement.SetLumiRelErr(.10); -+ measurement.SetBinLow(0); -+ measurement.SetBinHigh(1); -+ measurement.SetExportOnly(false); -+ -+ cxcoutIHF << "Creating new measurement:\n"; -+ -+ // First, get the attributes of the node -+ TListIter attribIt = node->GetAttributes(); -+ TXMLAttr *curAttr = nullptr; -+ while ((/**/ curAttr = dynamic_cast<TXMLAttr *>(attribIt()) /**/) != nullptr) { -+ // curAttr is guaranteed non-null above -+ const std::string curAttrName(curAttr->GetName() ? curAttr->GetName() : ""), -+ curAttrValue(curAttr->GetValue() ? curAttr->GetValue() : ""); -+ if (curAttrName == "") { -+ cxcoutEHF << "Found XML attribute in Measurement with no name.\n"; -+ // ADD Output Here -+ throw hf_exc(); -+ } else if (curAttrName == "Name") { -+ measurement.SetName(curAttrValue.c_str()); -+ } else if (curAttrName == "Lumi") { -+ measurement.SetLumi(std::stof(curAttrValue)); -+ } else if (curAttrName == "LumiRelErr") { -+ measurement.SetLumiRelErr(std::stof(curAttrValue)); -+ } else if (curAttrName == "BinLow") { -+ measurement.SetBinLow(std::stoi(curAttrValue)); -+ } else if (curAttrName == "BinHigh") { -+ measurement.SetBinHigh(std::stoi(curAttrValue)); -+ } else if (curAttrName == "Mode") { -+ cout << "\n INFO: Mode attribute is deprecated and no longer supported, will ignore\n"; -+ } else if (curAttrName == "ExportOnly") { -+ measurement.SetExportOnly(CheckTrueFalse(curAttrValue, "Measurement")); -+ } else { -+ cxcoutEHF << "Found unknown XML attribute in Measurement: " << curAttrName << "\n"; -+ throw hf_exc(); - } -- //poi// measurement.SetPOI( child->GetText() ); -- AddSubStrings( measurement.GetPOIList(), child->GetText() ); -- } -- -- else if( child->GetNodeName() == TString( "ParamSetting" ) ) { -- TListIter paramIt = child->GetAttributes(); -- TXMLAttr* curParam = 0; -- while( ( curParam = dynamic_cast< TXMLAttr* >( paramIt() ) ) != 0 ) { -- -- if( curParam->GetName() == TString( "" ) ) { -- cxcoutEHF << "Error: Found tag attribute with no name in ParamSetting" << std::endl; -- throw hf_exc(); -- } -- else if( curParam->GetName() == TString( "Const" ) ) { -- if(curParam->GetValue()==TString("True")){ -- // Fix here...? -- if( child->GetText() == NULL ) { -- cxcoutEHF << "Error: node: " << child->GetName() -- << " has no text." << std::endl; -- throw hf_exc(); -- } -- AddSubStrings( measurement.GetConstantParams(), child->GetText() ); -- } -- } -- else if( curParam->GetName() == TString( "Val" ) ) { -- double val = atof(curParam->GetValue()); -- if( child->GetText() == NULL ) { -- cxcoutEHF << "Error: node: " << child->GetName() -- << " has no text." << std::endl; -- throw hf_exc(); -- } -- std::vector<std::string> child_nodes = GetChildrenFromString(child->GetText()); -- for(unsigned int i = 0; i < child_nodes.size(); ++i) { -- measurement.SetParamValue( child_nodes.at(i), val); -- } -- // AddStringValPairToMap( measurement.GetParamValues(), val, child->GetText() ); -- } -- else { -- cxcoutEHF << "Found tag attribute with unknown name in ParamSetting: " -- << curAttr->GetName() << std::endl; -- throw hf_exc(); -- } -+ } // End Loop over attributes -+ -+ // Then, get the properties of the children nodes -+ TXMLNode *child = node->GetChildren(); -+ while (child != nullptr) { -+ const std::string childName(child->GetName() ? child->GetName() : ""), -+ childNodeName(child->GetNodeName() ? child->GetNodeName() : ""), -+ childText(child->GetText() ? child->GetText() : ""); -+ if (childNodeName.empty()) { -+ cxcoutEHF << "Found XML child node of Measurement with no name\n"; -+ throw hf_exc(); -+ } else if (childNodeName == "POI") { -+ if (childText == "") { -+ cxcoutEHF << "Error: node: " << childName << " has no text.\n"; -+ throw hf_exc(); -+ } -+ // poi // measurement.SetPOI(childText); -+ AddSubStrings(measurement.GetPOIList(), childText); -+ } else if (childNodeName == "ParamSetting") { -+ TListIter paramIt = child->GetAttributes(); -+ TXMLAttr *curParam = nullptr; -+ while ((/**/ curParam = dynamic_cast<TXMLAttr *>(paramIt()) /**/) != nullptr) { -+ // curParam is guaranteed non-null above -+ const std::string curParamName(curParam->GetName() ? curParam->GetName() : ""); -+ if (curParamName.empty()) { -+ cxcoutEHF << "Error: Found tag attribute with no name in ParamSetting\n"; -+ throw hf_exc(); -+ } else if (curParamName == "Const") { -+ if (curParam->GetValue() == TString("True")) { -+ // Fix here...? -+ if (childText.empty()) { -+ cxcoutEHF << "Error: node: " << childName << " has no text.\n"; -+ throw hf_exc(); -+ } -+ AddSubStrings(measurement.GetConstantParams(), childText); -+ } -+ } else if (curParamName == "Val") { -+ double val = atof(curParam->GetValue()); -+ if (childText.empty()) { -+ cxcoutEHF << "Error: node: " << childName << " has no text.\n"; -+ throw hf_exc(); -+ } -+ std::vector<std::string> child_nodes = GetChildrenFromString(childText); -+ for (size_t i = 0; i < child_nodes.size(); ++i) { -+ measurement.SetParamValue(child_nodes.at(i), val); -+ } -+ } else { -+ cxcoutEHF << "Found tag attribute with unknown name in ParamSetting: " << curParamName << "\n"; -+ throw hf_exc(); -+ } -+ } -+ } else if (childNodeName == "Asimov") { -+ // Now, create and configure an asimov object -+ // and add it to the measurement -+ RooStats::HistFactory::Asimov asimov; -+ std::string ParamFixString; -+ -+ // Loop over attributes -+ attribIt = child->GetAttributes(); -+ curAttr = nullptr; -+ while ((/**/ curAttr = dynamic_cast<TXMLAttr *>(attribIt()) /**/) != nullptr) { -+ const std::string curAttrName(curAttr->GetName() ? curAttr->GetName() : ""), -+ curAttrValue(curAttr->GetValue() ? curAttr->GetValue() : ""); -+ if (curAttrName.empty()) { -+ cxcoutEHF << "Error: Found tag attribute with no name in ConstraintTerm\n"; -+ throw hf_exc(); -+ } else if (curAttrName == "Name") { -+ asimov.SetName(curAttrValue); -+ } else if (curAttrName == "FixParams") { -+ ParamFixString = curAttrValue; -+ } else { -+ cxcoutEHF << "Found tag attribute with unknown name in ConstraintTerm: " << curAttrName << "\n"; -+ throw hf_exc(); -+ } -+ } -+ -+ // Add any parameters to the asimov dataset -+ // to be fixed during the fitting and dataset generation -+ if (ParamFixString.empty()) { -+ cxcoutWHF << "Warning: Asimov Dataset with name: " << asimov.GetName() -+ << " added, but no parameters are set to be fixed\n"; -+ } else { -+ AddParamsToAsimov(asimov, ParamFixString); -+ } -+ measurement.AddAsimovDataset(asimov); -+ } else if (childNodeName == "ConstraintTerm") { -+ std::vector<string> syst; -+ std::string type = ""; -+ double rel = 0; -+ -+ // Get the list of parameters in this tag: -+ if (childText.empty()) { -+ cxcoutEHF << "Error: node: " << childName << " has no text\n"; -+ throw hf_exc(); -+ } -+ AddSubStrings(syst, childText); -+ -+ // Now, loop over this tag's attributes -+ attribIt = child->GetAttributes(); -+ curAttr = nullptr; -+ while ((/**/ curAttr = dynamic_cast<TXMLAttr *>(attribIt()) /**/) != nullptr) { -+ const std::string curAttrName(curAttr->GetName() ? curAttr->GetName() : ""), -+ curAttrValue(curAttr->GetValue() ? curAttr->GetValue() : ""); -+ if (curAttrName.empty()) { -+ cxcoutEHF << "Error: Found tag attribute with no name in ConstraintTerm\n"; -+ throw hf_exc(); -+ } else if (curAttrName == "Type") { -+ type = curAttrValue; -+ } else if (curAttrName == "RelativeUncertainty") { -+ rel = std::stof(curAttrValue); -+ } else { -+ cxcoutEHF << "Found tag attribute with unknown name in ConstraintTerm: " << curAttrName << "\n"; -+ throw hf_exc(); -+ } -+ } // End Loop over tag attributes -+ -+ // Now, fill the maps, depending on the type: -+ if (rel != 0) { -+ if (type == "Gamma") { -+ for (const auto &isyst : syst) { -+ // Fix Here...? -+ measurement.GetGammaSyst()[isyst] = rel; -+ } -+ } else if (type == "Uniform") { -+ for (const auto &isyst : syst) { -+ // Fix Here...? -+ measurement.GetUniformSyst()[isyst] = rel; -+ } -+ } else if (type == "LogNormal") { -+ for (const auto &isyst : syst) { -+ // Fix Here...? -+ measurement.GetLogNormSyst()[isyst] = rel; -+ } -+ } -+ } else if (type == "NoConstraint") { -+ for (const auto &isyst : syst) { -+ // Fix Here...? -+ measurement.GetNoSyst()[isyst] = 1.0; // MB : dummy value -+ } -+ } else { -+ // only Gamma, Uniform, LogNormal and NoConstraint are valid types -+ cxcoutEHF << "Error: Encountered unknown type for ConstraintTerm: " << type << "\n"; -+ throw hf_exc(); -+ } -+ // End adding of Constraint terms -+ } else if (IsAcceptableNode(child)) { -+ /* do nothing */ -+ } else { -+ cxcoutEHF << "Found XML child of Measurement with unknown name: " << childNodeName << "\n"; -+ throw hf_exc(); - } -- } -- -- else if( child->GetNodeName() == TString( "Asimov" ) ) { -- -- //std::string name; -- //std::map<string, double> fixedParams; -+ child = child->GetNextNode(); -+ } - -- // Now, create and configure an asimov object -- // and add it to the measurement -- RooStats::HistFactory::Asimov asimov; -- std::string ParamFixString; -- -- // Loop over attributes -- attribIt = child->GetAttributes(); -- curAttr = 0; -- while( ( curAttr = dynamic_cast< TXMLAttr* >( attribIt() ) ) != 0 ) { -- -- if( curAttr->GetName() == TString( "" ) ) { -- cxcoutEHF << "Error: Found tag attribute with no name in ConstraintTerm" << std::endl; -- throw hf_exc(); -- } -- -- else if( curAttr->GetName() == TString( "Name" ) ) { -- std::string name = curAttr->GetValue(); -- asimov.SetName( name ); -- } -- -- else if( curAttr->GetName() == TString( "FixParams" ) ) { -- ParamFixString = curAttr->GetValue(); -- //std::map<std::string, double> fixedParams = ExtractParamMapFromString(FixParamList); -- //asimov.GetFixedParams() = fixedParams; -- } -- -- else { -- cxcoutEHF << "Found tag attribute with unknown name in ConstraintTerm: " -- << curAttr->GetName() << std::endl; -- throw hf_exc(); -- } -- -- } -- -- // Add any parameters to the asimov dataset -- // to be fixed during the fitting and dataset generation -- if( ParamFixString=="" ) { -- cxcoutWHF << "Warning: Asimov Dataset with name: " << asimov.GetName() -- << " added, but no parameters are set to be fixed" << std::endl; -- } -- else { -- AddParamsToAsimov( asimov, ParamFixString ); -- } -- -- measurement.AddAsimovDataset( asimov ); -- -- } -- -- else if( child->GetNodeName() == TString( "ConstraintTerm" ) ) { -- vector<string> syst; -- string type = ""; -- double rel = 0; -- -- map<string,double> gammaSyst; -- map<string,double> uniformSyst; -- map<string,double> logNormSyst; -- -- // Get the list of parameters in this tag: -- if( child->GetText() == NULL ) { -- cxcoutEHF << "Error: node: " << child->GetName() -- << " has no text." << std::endl; -- throw hf_exc(); -- } -- AddSubStrings(syst, child->GetText()); -- -- // Now, loop over this tag's attributes -- attribIt = child->GetAttributes(); -- curAttr = 0; -- while( ( curAttr = dynamic_cast< TXMLAttr* >( attribIt() ) ) != 0 ) { -- -- if( curAttr->GetName() == TString( "" ) ) { -- cxcoutEHF << "Error: Found tag attribute with no name in ConstraintTerm" << std::endl; -- throw hf_exc(); -- } -- -- else if( curAttr->GetName() == TString( "Type" ) ) { -- type = curAttr->GetValue(); -- } -- -- else if( curAttr->GetName() == TString( "RelativeUncertainty" ) ) { -- rel = atof(curAttr->GetValue()); -- } -- -- else { -- cxcoutEHF << "Found tag attribute with unknown name in ConstraintTerm: " -- << curAttr->GetName() << std::endl; -- throw hf_exc(); -- } -- -- } // End Loop over tag attributes -- -- -- // Now, fill the maps, depending on the type: -- -- // Check that the type is in the correct form: -- if( ! (type=="Gamma" || type=="Uniform" || -- type=="LogNormal" || type=="NoConstraint") ) { -- cxcoutEHF << "Error: Encountered unknown type for ConstraintTerm: " << type << std::endl; -- throw hf_exc(); -- } -- -- if (type=="Gamma" && rel!=0) { -- for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); ++it) { -- // Fix Here...? -- measurement.GetGammaSyst()[(*it).c_str()] = rel; -- } -- } -- -- if (type=="Uniform" && rel!=0) { -- for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); ++it) { -- // Fix Here...? -- measurement.GetUniformSyst()[(*it).c_str()] = rel; -- } -- } -- -- if (type=="LogNormal" && rel!=0) { -- for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); ++it) { -- // Fix Here...? -- measurement.GetLogNormSyst()[(*it).c_str()] = rel; -- } -- } -- -- if (type=="NoConstraint") { -- for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); ++it) { -- // Fix Here...? -- measurement.GetNoSyst()[(*it).c_str()] = 1.0; // MB : dummy value -- } -- } -- } // End adding of Constraint terms -- -- -- else if( IsAcceptableNode( child ) ) { ; } -- -- else { -- cxcoutEHF << "Found XML child of Measurement with unknown name: " << child->GetNodeName() -- << std::endl; -- throw hf_exc(); -- } -- -- child = child->GetNextNode(); -- } -- -- measurement.PrintTree(oocoutI(static_cast<TObject*>(nullptr), HistFactory)); -- -- return measurement; -+ measurement.PrintTree(oocoutI(static_cast<TObject *>(nullptr), HistFactory)); - -+ return measurement; - } - -- -- - HistFactory::Channel ConfigParser::ParseChannelXMLFile( string filen ) { - - /* -diff --git a/roofit/roofitcore/inc/RooAbsCollection.h b/roofit/roofitcore/inc/RooAbsCollection.h -index 5c2d733a0674..0ea54abd33b4 100644 ---- a/roofit/roofitcore/inc/RooAbsCollection.h -+++ b/roofit/roofitcore/inc/RooAbsCollection.h -@@ -179,14 +179,17 @@ class RooAbsCollection : public TObject, public RooPrintable { - removeAll(); - } - -- inline Int_t getSize() const { -- // Return the number of elements in the collection -- return _list.size(); -+ inline Int_t getSize() const R__SUGGEST_ALTERNATIVE("size() returns true size.") -+ { -+ // Return the number of elements in the collection -+ return _list.size(); - } -- -- inline RooAbsArg *first() const { -- // Return the first element in this collection -- return _list.front(); -+ -+ inline RooAbsArg *first() const -+ { -+ // Return the first element in this collection -+ // calling front on an empty container is undefined -+ return _list.empty() ? nullptr : _list.front(); - } - - RooAbsArg * operator[](Storage_t::size_type i) const { -diff --git a/roofit/roofitcore/src/RooAddModel.cxx b/roofit/roofitcore/src/RooAddModel.cxx -index cc72e8e55aa2..ce072f9eb745 100644 ---- a/roofit/roofitcore/src/RooAddModel.cxx -+++ b/roofit/roofitcore/src/RooAddModel.cxx -@@ -97,63 +97,71 @@ RooAddModel::RooAddModel(const char *name, const char *title, const RooArgList& - _coefList("!coefficients","List of coefficients",this), - _haveLastCoef(kFALSE), - _allExtendable(kFALSE) --{ -- if (inPdfList.getSize()>inCoefList.getSize()+1) { -- coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() -- << ") number of pdfs and coefficients inconsistent, must have Npdf=Ncoef or Npdf=Ncoef+1" << endl ; -- assert(0) ; -- } -- -- // Constructor with N PDFs and N or N-1 coefs -- TIterator* pdfIter = inPdfList.createIterator() ; -- TIterator* coefIter = inCoefList.createIterator() ; -- RooAbsPdf* pdf ; -- RooAbsReal* coef ; -- -- while((coef = (RooAbsPdf*)coefIter->Next())) { -- pdf = (RooAbsPdf*) pdfIter->Next() ; -- if (!pdf) { -- coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() -- << ") number of pdfs and coefficients inconsistent, must have Npdf=Ncoef or Npdf=Ncoef+1" << endl ; -- assert(0) ; -- } -- if (!dynamic_cast<RooAbsReal*>(coef)) { -- coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() << ") coefficient " << coef->GetName() << " is not of type RooAbsReal, ignored" << endl ; -- continue ; -- } -- if (!dynamic_cast<RooAbsReal*>(pdf)) { -- coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() << ") pdf " << pdf->GetName() << " is not of type RooAbsPdf, ignored" << endl ; -- continue ; -- } -- _pdfList.add(*pdf) ; -- _coefList.add(*coef) ; -- } -- -- pdf = (RooAbsPdf*) pdfIter->Next() ; -- if (pdf) { -- if (!dynamic_cast<RooAbsReal*>(pdf)) { -- coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() << ") last pdf " << coef->GetName() << " is not of type RooAbsPdf, fatal error" << endl ; -- assert(0) ; -- } -- _pdfList.add(*pdf) ; -- } else { -- _haveLastCoef=kTRUE ; -- } -- -- delete pdfIter ; -- delete coefIter ; -- -- _coefCache = new Double_t[_pdfList.getSize()] ; -- _coefErrCount = _errorCount ; -+{ -+ if (inPdfList.size() > inCoefList.size() + 1 || inPdfList.size() < inCoefList.size()) { -+ std::stringstream msgSs; -+ msgSs << "RooAddModel::RooAddModel(" << GetName() -+ << ") number of pdfs and coefficients inconsistent, must have Npdf=Ncoef or Npdf=Ncoef+1"; -+ const std::string msgStr = msgSs.str(); -+ coutE(InputArguments) << msgStr << "\n"; -+ throw std::runtime_error(msgStr); -+ } -+ -+ // Constructor with N PDFs and N or N-1 coefs -+ auto pdfIter = inPdfList.fwdIterator(); -+ -+ for (auto const &coef : inCoefList) { -+ auto pdf = pdfIter.next(); -+ if (!pdf) { -+ std::stringstream msgSs; -+ msgSs << "RooAddModel::RooAddModel(" << GetName() -+ << ") number of pdfs and coefficients inconsistent, must have Npdf=Ncoef or Npdf=Ncoef+1"; -+ const std::string msgStr = msgSs.str(); -+ coutE(InputArguments) << msgStr << "\n"; -+ throw std::runtime_error(msgStr); -+ } -+ if (!coef) { -+ coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() -+ << ") encountered and undefined coefficient, ignored\n"; -+ continue; -+ } -+ if (!dynamic_cast<RooAbsReal *>(coef)) { -+ auto coefName = coef->GetName(); -+ coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() << ") coefficient " -+ << (coefName != nullptr ? coefName : "") << " is not of type RooAbsReal, ignored\n"; -+ continue; -+ } -+ if (!dynamic_cast<RooAbsPdf *>(pdf)) { -+ coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() << ") pdf " << pdf->GetName() -+ << " is not of type RooAbsPdf, ignored\n"; -+ continue; -+ } -+ _pdfList.add(*pdf); -+ _coefList.add(*coef); -+ } -+ -+ if (auto pdf = pdfIter.next()) { -+ if (!dynamic_cast<RooAbsPdf *>(pdf)) { -+ std::stringstream msgSs; -+ msgSs << "RooAddModel::RooAddModel(" << GetName() << ") last pdf " << pdf->GetName() -+ << " is not of type RooAbsPdf, fatal error"; -+ const std::string msgStr = msgSs.str(); -+ coutE(InputArguments) << msgStr << "\n"; -+ throw std::runtime_error(msgStr); -+ } -+ _pdfList.add(*pdf); -+ } else { -+ _haveLastCoef = kTRUE; -+ } - -- if (ownPdfList) { -- _ownedComps.addOwned(_pdfList) ; -- } -+ _coefCache = new Double_t[_pdfList.getSize()]; -+ _coefErrCount = _errorCount; - -+ if (ownPdfList) { -+ _ownedComps.addOwned(_pdfList); -+ } - } - -- -- - //////////////////////////////////////////////////////////////////////////////// - /// Copy constructor - -diff --git a/roofit/roofitcore/src/RooDataHist.cxx b/roofit/roofitcore/src/RooDataHist.cxx -index 5bd49acdbeab..3b132c776695 100644 ---- a/roofit/roofitcore/src/RooDataHist.cxx -+++ b/roofit/roofitcore/src/RooDataHist.cxx -@@ -573,10 +573,17 @@ void RooDataHist::importDHistSet(const RooArgList& /*vars*/, RooCategory& indexC - void RooDataHist::_adjustBinning(RooRealVar &theirVar, const TAxis &axis, - RooRealVar *ourVar, Int_t *offset) - { -- if (!dynamic_cast<RooRealVar*>(ourVar)) { -- coutE(InputArguments) << "RooDataHist::adjustBinning(" << GetName() << ") ERROR: dimension " << ourVar->GetName() << " must be real" << endl ; -- assert(0) ; -- } -+ // RooRealVar is derived from RooAbsRealLValue which is itself -+ // derived from RooAbsReal and a virtual class RooAbsLValue -+ // supplying setter fuctions, check if ourVar is indeed derived -+ // as real -+ if (!dynamic_cast<RooAbsReal *>(ourVar)) { -+ std::string ourVarName(ourVar->GetName()); -+ coutE(InputArguments) << "RooDataHist::adjustBinning(" << GetName() << ") ERROR: dimension " << ourVarName -+ << " must be real\n"; -+ throw std::logic_error("Incorrect type object (" + ourVarName + -+ ") passed as argument to RooDataHist::_adjustBinning. Please report this issue."); -+ } - - const double xlo = theirVar.getMin(); - const double xhi = theirVar.getMax(); -diff --git a/roofit/roofitcore/src/RooRealSumFunc.cxx b/roofit/roofitcore/src/RooRealSumFunc.cxx -index cbff7435b648..6e9fa40f5da5 100644 ---- a/roofit/roofitcore/src/RooRealSumFunc.cxx -+++ b/roofit/roofitcore/src/RooRealSumFunc.cxx -@@ -152,8 +152,9 @@ RooRealSumFunc::RooRealSumFunc(const char *name, const char *title, const RooArg - func = (RooAbsReal *)funcIter->Next(); - if (func) { - if (!dynamic_cast<RooAbsReal *>(func)) { -- coutE(InputArguments) << "RooRealSumFunc::RooRealSumFunc(" << GetName() << ") last func " << coef->GetName() -- << " is not of type RooAbsReal, fatal error" << endl; -+ auto funcName = func->GetName(); -+ coutE(InputArguments) << "RooRealSumFunc::RooRealSumFunc(" << GetName() << ") last func " -+ << (funcName != nullptr ? funcName : "") << " is not of type RooAbsReal, fatal error\n"; - assert(0); - } - _funcList.add(*func); -diff --git a/tmva/tmva/src/DNN/Architectures/Reference/DataLoader.cxx b/tmva/tmva/src/DNN/Architectures/Reference/DataLoader.cxx -index 2465abf3085f..1724805382ac 100644 ---- a/tmva/tmva/src/DNN/Architectures/Reference/DataLoader.cxx -+++ b/tmva/tmva/src/DNN/Architectures/Reference/DataLoader.cxx -@@ -145,6 +145,9 @@ void TDataLoader<TMVAInput_t, TReference<Real_t>>::CopyInput(TMatrixT<Real_t> &m - template <> - void TDataLoader<TMVAInput_t, TReference<Real_t>>::CopyOutput(TMatrixT<Real_t> &matrix, IndexIterator_t sampleIterator) - { -+ // calling front on an empty container is undfined -+ if (std::get<0>(fData).empty()) -+ return; - Event *event = std::get<0>(fData).front(); - const DataSetInfo &info = std::get<1>(fData); - Int_t m = matrix.GetNrows(); -@@ -177,6 +180,9 @@ void TDataLoader<TMVAInput_t, TReference<Real_t>>::CopyOutput(TMatrixT<Real_t> & - template <> - void TDataLoader<TMVAInput_t, TReference<Real_t>>::CopyWeights(TMatrixT<Real_t> &matrix, IndexIterator_t sampleIterator) - { -+ // calling front on an empty container is undfined -+ if (std::get<0>(fData).empty()) -+ return; - Event *event = std::get<0>(fData).front(); - for (Int_t i = 0; i < matrix.GetNrows(); i++) { - Int_t sampleIndex = *sampleIterator++; -@@ -190,6 +196,9 @@ template <> - void TDataLoader<TMVAInput_t, TReference<Double_t>>::CopyInput(TMatrixT<Double_t> &matrix, - IndexIterator_t sampleIterator) - { -+ // calling front on an empty container is undfined -+ if (std::get<0>(fData).empty()) -+ return; - Event *event = std::get<0>(fData).front(); - Int_t m = matrix.GetNrows(); - Int_t n = event->GetNVariables(); -@@ -210,6 +219,9 @@ template <> - void TDataLoader<TMVAInput_t, TReference<Double_t>>::CopyOutput(TMatrixT<Double_t> &matrix, - IndexIterator_t sampleIterator) - { -+ // calling front on an empty container is undfined -+ if (std::get<0>(fData).empty()) -+ return; - Event *event = std::get<0>(fData).front(); - const DataSetInfo &info = std::get<1>(fData); - Int_t m = matrix.GetNrows(); Modified: PKGBUILD =================================================================== --- PKGBUILD 2021-11-24 13:16:02 UTC (rev 1054677) +++ PKGBUILD 2021-11-24 13:17:27 UTC (rev 1054678) @@ -7,7 +7,7 @@ pkgbase=root pkgname=('root' 'root-cuda') pkgver=6.24.06 -pkgrel=6 +pkgrel=7 pkgdesc='C++ data analysis framework and interpreter from CERN' arch=('x86_64') url='https://root.cern' @@ -96,7 +96,6 @@ 'jupyter_notebook_config.py' 'nbman-for-arch.patch' '8351.patch' - '9271.patch' 'thisroot.fail' ) sha512sums=('356d6287df2900de9e831347d9513f444bf7cbd29c39fbb5841051ae877dac1e22dc255c64166cd3925b82aac860ae67ef6ce171732c16fd23d7919a47e7cb5a' @@ -108,7 +107,6 @@ '1c905ee7a3f8f5f3f567d957f9be6b503a8631565d4d9b9bfea5e496ef86865c5a8be1a1f8c7842754029879cf0afd2465249f532a116cc43660aa2e460ae682' '12814f50b7016bd86d3f91e0e31c052783a0c0fa72b7d6a072d3ae6f86c2437323d585e531235377ebbfdd9cb76abd7da84d9631de821151547f1d4b13417e69' '870740fbbd678056dd71b275c5d96f9b0db503ca8e0e9e84f784c3115aae66bb28a1eb531f665c1c8306a52686e5ce484ef65b3194bef6cb0d631664ccb1e3f9' - '6ba0994fa62d9a59a6382b9beafd044d0fb7bd45048c531d0437844a98f7ef40dcd45565670cb5a7adc7dc040885d3b7dbea73448ba1cd30fb9764d4f0890cd5' '3b9e382480b28f60af0b096ac9a42e6ba611b899717988bdebffd5aeabab054e37a28a7421f4a0f39198638c31f56a657a8a9ccc3db54a87daf50d43d35b1ca9') get_pyver () {
