Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding package: CMS Combine statistics tool #29267

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions recipes/cms-combine/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -ex

pushd HiggsAnalysis/CombinedLimit
make CONDA=1 -j${CPU_COUNT}
cp -rv build/bin ${PREFIX}
cp -v build/lib/*${SHLIB_EXT} ${PREFIX}/lib
cp -v build/lib/*.pcm ${PREFIX}/lib
cp -v build/lib/*.rootmap ${PREFIX}/lib
mkdir -p ${PREFIX}/include/HiggsAnalysis/CombinedLimit
cp -rv interface ${PREFIX}/include/HiggsAnalysis/CombinedLimit/
cp -rv build/lib/python/HiggsAnalysis $(python3 -c "import sysconfig; print(sysconfig.get_path('platlib'))")/
popd
48 changes: 48 additions & 0 deletions recipes/cms-combine/clang_warnings.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/src/AtlasPdfs.cxx b/src/AtlasPdfs.cxx
index abb70dc2..cf599a1c 100644
--- a/src/AtlasPdfs.cxx
+++ b/src/AtlasPdfs.cxx
@@ -1640,9 +1640,6 @@ void RooStarMomentMorph::CacheElem::calculateFractions(const RooStarMomentMorph&
{
//int nObs=self._obsList.getSize();

- // loop over parList
- int nnuis=0;
-
// zero all fractions
int nPdf=self._pdfList.getSize();
for (Int_t i=0; i<3*nPdf; ++i) {
@@ -1662,9 +1659,6 @@ void RooStarMomentMorph::CacheElem::calculateFractions(const RooStarMomentMorph&
double mlo=self._nref[imin];
double mhi=self._nref[imax];

- // get reference for this obs
- nnuis+=self._nnuis[j];
-
double mfrac = (imax>imin) ? (mhi-m0)/(mhi-mlo) : (mlo-m0)/(mhi-mlo);
if (mfrac> 1.) mfrac= 1.;
if (mfrac<-1.) mfrac=-1.;
diff --git a/src/CascadeMinimizer.cc b/src/CascadeMinimizer.cc
index d5630b1e..d73ed16b 100644
--- a/src/CascadeMinimizer.cc
+++ b/src/CascadeMinimizer.cc
@@ -572,19 +572,6 @@ bool CascadeMinimizer::multipleMinimize(const RooArgSet &reallyCleanParameters,
//if (mode!=0) utils::reorderCombinations(myCombos,pdfSizes,bestIndeces);
utils::reorderCombinations(myCombos,pdfSizes,bestIndeces);

- int numberOfCombinations = 1;
- if (mode==1 || mode==0) numberOfCombinations=myCombos.size();
-
- else {
- for (int i=0;i<numIndeces;i++){
- int nokpdfs=0;
- for (int j=0;j<pdfSizes[i];j++){
- nokpdfs+=contributingIndeces[i][j];
- }
- numberOfCombinations*=nokpdfs;
- }
- }
-
std::vector<std::vector<int> >::iterator my_it = myCombos.begin();
if (mode!=0) my_it++; // already did the best fit case

35 changes: 35 additions & 0 deletions recipes/cms-combine/makefile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/Makefile b/Makefile
index 0af8dece..6d9c5e3f 100644
--- a/Makefile
+++ b/Makefile
@@ -34,8 +34,8 @@ CCFLAGS = -D STANDALONE $(ROOTCFLAGS) -g -fPIC -O2 -pthread -pipe -Werror=main -
LIBS = $(ROOTLIBS) -lgsl -lRooFit -lRooFitCore -lRooStats -lMinuit -lMathMore -lFoam -lHistFactory -lboost_filesystem -lboost_program_options -lboost_system -lvdt

ifeq ($(CONDA), 1)
-CCFLAGS += -I${CONDA_PREFIX}/include/boost -I ${CONDA_PREFIX}/include/vdt -I ${CONDA_PREFIX}/include/gsl -I ${CONDA_PREFIX}/include/eigen3
-LIBS += -L${CONDA_PREFIX}/lib
+CCFLAGS += -I${PREFIX}/include/boost -I ${PREFIX}/include/vdt -I ${PREFIX}/include/gsl -I ${PREFIX}/include/eigen3
+LIBS += -L${PREFIX}/lib
else ifeq ($(LCG), 1)
# for some reason, Eigen headers are nested in LCG
CCFLAGS += -I ${CPLUS_INCLUDE_PATH}/eigen3
@@ -47,7 +47,6 @@ endif

# Library name -----------------------------------------------------------------
LIBNAME=HiggsAnalysisCombinedLimit
-SONAME=lib$(LIBNAME).so
DICTNAME=$(LIBNAME)_xr

# Linker and flags -------------------------------------------------------------
@@ -57,9 +56,11 @@ ROOTLIBDIR = $(shell root-config --libdir)
# OS x specific linkage
DARWIN := $(shell uname|grep Darwin)
ifdef DARWIN
+SONAME=lib$(LIBNAME).dylib
LDFLAGS = $(ROOTLDFLAGS) -g -shared -install_name @rpath/$(SONAME) -fPIC
EXELDFLAGS = -Wl,-rpath,'@executable_path/../lib' -Wl,-rpath,$(ROOTLIBDIR)
else
+SONAME=lib$(LIBNAME).so
LDFLAGS = $(ROOTLDFLAGS) -shared -Wl,-soname,$(SONAME) -Wl,-E -Wl,-z,defs -fPIC
EXELDFLAGS =
endif
65 changes: 65 additions & 0 deletions recipes/cms-combine/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{% set name = "cms-combine" %}
{% set version = "10.0.2" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/archive/refs/tags/v{{ version }}.tar.gz
sha256: a6fecc8b4adc4e631425eeee7501d0258ab64ef36b24680696c2e6f8d38403e7
folder: HiggsAnalysis/CombinedLimit
patches:
- clang_warnings.patch
- makefile.patch

build:
number: 0
skip: true # [win]
ignore_run_exports: python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have python as a run requirement, why are you adding it to ignore_run_exports?


requirements:
build:
- {{ stdlib('c') }}
- {{ compiler('cxx') }}
- make
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
host:
- python
- root_base
- libboost-devel
- eigen
- vdt

run:
- python
- pandas
- gsl

test:
imports:
- HiggsAnalysis.CombinedLimit.PhysicsModel
commands:
- combine -h
- text2workspace.py -h

about:
home: https://cms-analysis.github.io/HiggsAnalysis-CombinedLimit/
summary: 'A software tool used for statistical analysis within the CMS experiment'
description: |
Combine is a RooStats / RooFit - based software tool used for statistical analysis within the
CMS experiment. Note that while this tool was originally developed in the Higgs PAG, its usage
is now widespread within CMS. Combine provides a command-line interface to many different statistical
techniques, available inside RooFit/RooStats, that are used widely inside CMS.
license: Apache-2.0
license_family: Apache
license_file: HiggsAnalysis/CombinedLimit/LICENSE
doc_url: https://cms-analysis.github.io/HiggsAnalysis-CombinedLimit/
dev_url: https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit

extra:
recipe-maintainers:
- nsmith-
- kcormi
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kcormi @anigamova FYI I have added you as maintainers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that they will both need to respond that they approve for the linting to pass.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @nsmith-, fine with me of course!

- anigamova
Loading