Skip to content

Commit

Permalink
Merge tag 'v9.1.0' into 14x-comb2023
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmith- committed Nov 22, 2023
2 parents 5658290 + 5acf6b6 commit 2cb571b
Show file tree
Hide file tree
Showing 258 changed files with 3,962 additions and 2,224 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
push:
branches:
- 112x
- main

jobs:
lint:
Expand All @@ -17,9 +17,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Lint with flake8 and black
- name: Lint with flake8 and black -l 160
run: |
python -m pip install -q flake8 black
black --version
flake8 .
black -l 160 --check --diff .
Expand All @@ -35,6 +36,9 @@ jobs:
# python 3.9 root 6.24 (12_3_X)
- python: "3.9"
root: "6.24"
# python 3.10 root 6.26
- python: "3.10"
root: "6.26.4"
runs-on: ubuntu-latest
name: Compile (py${{ matrix.python }}, root${{ matrix.root }})

Expand All @@ -43,16 +47,17 @@ jobs:
with:
path: HiggsAnalysis/CombinedLimit # Required to match compile instructions
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2.1.1
uses: conda-incubator/setup-miniconda@v2.2.0
with:
mamba-version: "*"
python-version: ${{ matrix.python }}
miniforge-variant: Mambaforge
channels: conda-forge,defaults
channel-priority: true
activate-environment: combine
- name: Install build environment
shell: bash -l {0}
run: |
mamba install -c conda-forge python==${{ matrix.python }} pip root==${{ matrix.root }} gsl tbb vdt boost pcre eigen
mamba install -c conda-forge python==${{ matrix.python }} pip pandas root==${{ matrix.root }} gsl tbb vdt boost pcre eigen
cd HiggsAnalysis/CombinedLimit
bash set_conda_env_vars.sh
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
branches:
- 112x
- main

jobs:
docs:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/gitlabci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: trigger gitlab job
on:
push:
branches: [ 112x ]
branches: [main]

pull_request_target:
types: [labeled , opened , edited , synchronize, reopened ]
branches: [ 112x ]
types: [labeled, opened, edited, synchronize, reopened]
branches: [main]

# pull_request:
# branches: [ 112x ]

jobs:
build:
name: Build
Expand Down
38 changes: 32 additions & 6 deletions .github/workflows/port_to_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
### When a label is added to a PR, rebase it on another branch and open a PR from that rebase version.
### run this just before merging.

name: Port to 112x
name: Port to 112x-releases

on:
pull_request_target:
types: [ labeled ]
branches: [ 102x ]
branches: [ main ]

jobs:
build:
name: Port to 112x
port_112x_comb2022:
name: Port to 112x-comb2022
runs-on: ubuntu-latest

steps:
- name: test rebase
env:
ONTO: 112x
ONTO: 112x-comb2022
REPO: cms-analysis/HiggsAnalysis-CombinedLimit
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event.pull_request && contains(github.event.pull_request.labels.*.name, 'port to 112x') }}
if: ${{ github.event.pull_request && contains(github.event.label.name, 'port to 112x-comb2022') }}
run: |
## checkout full repository
git config --global user.name "github-actions[bot]"
Expand All @@ -39,5 +39,31 @@ jobs:
echo "curl"
curl -X POST -H "Accept: application/vnd.github.v3+json" -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{env.REPO}}/pulls -d '{"head":"rebase_'${{ github.event.pull_request.number }}'_onto_'${{ env.ONTO }}'","base":"'${{env.ONTO}}'", "title":"rebase of '${{ github.event.pull_request.number }}'", "body":"This is a rebase of #'${{ github.event.pull_request.number }}' onto '${{ env.ONTO }}'"}'
port_112x_comb2021:
name: Port to 112x-comb2021
runs-on: ubuntu-latest

steps:
- name: test rebase
env:
ONTO: 112x-comb2021
REPO: cms-analysis/HiggsAnalysis-CombinedLimit
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event.pull_request && contains(github.event.label.name, 'port to 112x-comb2021') }}
run: |
## checkout full repository
git config --global user.name "github-actions[bot]"
git clone https://github.com/${{env.REPO}} -b ${{ env.ONTO }} clone_dir
cd clone_dir
git remote set-url --push origin https://github-actions-bot:[email protected]/${{ env.REPO }}
git remote add other https://github.com/${{github.event.pull_request.head.repo.full_name}}
git fetch other
git branch rebase_${{ github.event.pull_request.number }}_onto_${{ env.ONTO }} other/${{github.event.pull_request.head.ref}}
git rebase --onto ${{env.ONTO}} origin/${{ github.event.pull_request.base.ref }} rebase_${{ github.event.pull_request.number }}_onto_${{ env.ONTO }}
echo "Done Rebasing"
echo "push"
git push origin rebase_${{ github.event.pull_request.number }}_onto_${{ env.ONTO }}
echo "curl"
curl -X POST -H "Accept: application/vnd.github.v3+json" -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{env.REPO}}/pulls -d '{"head":"rebase_'${{ github.event.pull_request.number }}'_onto_'${{ env.ONTO }}'","base":"'${{env.ONTO}}'", "title":"rebase of '${{ github.event.pull_request.number }}'", "body":"This is a rebase of #'${{ github.event.pull_request.number }}' onto '${{ env.ONTO }}'"}'
143 changes: 81 additions & 62 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# HiggsAnalysis/Combined Limit Makefile #
# #
# Authors: Danilo Piparo, Giovanni Petrucciani, Mingshui Chen #
# Revised: Nick Smith 2022 #
# #
# o Automatic compilation of new programs and classes*. #
# o Now generate dictionaries by genreflex #
Expand All @@ -12,28 +13,33 @@

#### SET UP YOUR ENVIRONMENT FIRST WITH ##############################
# source env_standalone.sh
# OR
# source env_lcg.sh (if `make LCG=1` is used to build)
#######################################################################

# Boost
BOOST = /cvmfs/cms.cern.ch/slc7_amd64_gcc820/external/boost/1.72.0-gchjei
VDT = /cvmfs/cms.cern.ch/slc7_amd64_gcc820/cms/vdt/0.4.0-ghbfee
PCRE = /cvmfs/cms.cern.ch/slc7_amd64_gcc820/external/pcre/8.43-bcolbf
GSL = /cvmfs/cms.cern.ch/slc7_amd64_gcc820/external/gsl/2.6-bcolbf3
EIGEN = /cvmfs/cms.cern.ch/slc7_amd64_gcc820/external/eigen/d812f411c3f9-ghbfee
# Hardcoded paths for standalone version identical to CMSSW 11_3_X
# These are ignored if either CONDA=1 or LCG=1 is set
BOOST = /cvmfs/cms.cern.ch/slc7_amd64_gcc900/external/boost/1.75.0-ljfedo
VDT = /cvmfs/cms.cern.ch/slc7_amd64_gcc900/cms/vdt/0.4.0-ghbfee
GSL = /cvmfs/cms.cern.ch/slc7_amd64_gcc900/external/gsl/2.6-ljfedo
EIGEN = /cvmfs/cms.cern.ch/slc7_amd64_gcc900/external/eigen/011e0db31d1bed8b7f73662be6d57d9f30fa457a
# Compiler and flags -----------------------------------------------------------
CC = c++
CXX = $(shell root-config --cxx)
ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs --glibs)
ROOTINC = $(shell root-config --incdir)

# CCFLAGS = -D STANDALONE $(ROOTCFLAGS) -I$(BOOST)/include -I$(VDT)/include -I$(PCRE)/include -I$(GSL)/include -I$(LIBXML)/include/libxml2 -I$(XZ)/include -I$(ZLIB)/include -g -fPIC
# CMSSW CXXFLAGS plus -Wno-unused-local-typedefs (otherwise we get a flood of messages from BOOST) plus -Wno-unused-function
CCFLAGS = -D STANDALONE $(ROOTCFLAGS) -g -fPIC -O2 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++1z -ftree-vectorize -Wstrict-overflow -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -msse3 -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -DGNU_GCC -D_GNU_SOURCE -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE
LIBS = $(ROOTLIBS) -lgsl -l RooFit -lRooFitCore -l RooStats -l Minuit -lMathMore -l Foam -lHistFactory -lboost_filesystem -lboost_program_options -lboost_system -lvdt
CCFLAGS = -D STANDALONE $(ROOTCFLAGS) -g -fPIC -O2 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -ftree-vectorize -Wstrict-overflow -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -msse3 -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -DGNU_GCC -D_GNU_SOURCE -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE
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
else ifeq ($(LCG), 1)
# for some reason, Eigen headers are nested in LCG
CCFLAGS += -I ${CPLUS_INCLUDE_PATH}/eigen3
LIBS += -L${CPLUS_INCLUDE_PATH}/../lib
else
CCFLAGS += -I$(BOOST)/include -I$(VDT)/include -I$(GSL)/include -I$(EIGEN)/include/eigen3
LIBS += -L$(BOOST)/lib -L$(VDT)/lib -L$(GSL)/lib
Expand All @@ -45,18 +51,29 @@ SONAME=lib$(LIBNAME).so
DICTNAME=$(LIBNAME)_xr

# Linker and flags -------------------------------------------------------------
LD = g++
LD = $(shell root-config --ld)
ROOTLDFLAGS = $(shell root-config --ldflags)
# OS x specific linkage
DARWIN := $(shell uname|grep Darwin)
ifdef DARWIN
LDFLAGS = $(ROOTLDFLAGS) -shared -install_name @rpath/$(SONAME) -fPIC
EXELDFLAGS = -Wl,-rpath,'@executable_path/../lib'
else
LDFLAGS = $(ROOTLDFLAGS) -shared -Wl,-soname,$(SONAME) -Wl,-E -Wl,-z,defs -fPIC
EXELDFLAGS =
endif

# Directory structure ----------------------------------------------------------
PARENT_DIR = $(shell pwd)/../../
SRC_DIR = src
INC_DIR = interface
LIB_DIR = lib
PROG_DIR = bin
EXE_DIR = exe
OBJ_DIR = obj
SCRIPTS_DIR = scripts
PYTHON_DIR = python
# outputs
OBJ_DIR = build/obj
LIB_DIR = build/lib
EXE_DIR = build/bin


# Useful shortcuts -------------------------------------------------------------
Expand All @@ -66,81 +83,83 @@ OBJS = $(SRCS:.cc=.o)
OBJS += $(SRXS:.cxx=.o)
PROGS = $(notdir $(wildcard ${PROG_DIR}/*.cpp))
EXES = $(PROGS:.cpp=)
SCRIPTS = $(notdir $(wildcard ${SCRIPTS_DIR}/*.py))
PYLIB_DIR = $(LIB_DIR)/python

#Makefile Rules ---------------------------------------------------------------
.PHONY: clean dirs dict obj lib exe debug

.PHONY: clean exe python

all: dirs dict obj lib exe compile_python
all: exe python

#---------------------------------------

dirs:
$(OBJ_DIR):
@mkdir -p $(OBJ_DIR)/a
@mkdir -p $(SRC_DIR)
@mkdir -p $(LIB_DIR)
@mkdir -p $(EXE_DIR)
@mkdir -p $(LIB_DIR)/python/HiggsAnalysis
@ln -sd ../../../python $(LIB_DIR)/python/HiggsAnalysis/CombinedLimit || /bin/true
@touch $(LIB_DIR)/python/__init__.py
@touch $(LIB_DIR)/python/HiggsAnalysis/__init__.py
@touch $(LIB_DIR)/python/HiggsAnalysis/CombinedLimit/__init__.py

#---------------------------------------

dict: dirs $(OBJ_DIR)/a/$(DICTNAME).cc
$(OBJ_DIR)/a/$(DICTNAME).cc : $(SRC_DIR)/classes_def.xml
# @echo "\n*** Generating dictionaries ..."
genreflex $(SRC_DIR)/classes.h -s $(SRC_DIR)/classes_def.xml -o $(OBJ_DIR)/a/$(DICTNAME).cc --deep --fail_on_warnings --rootmap=$(OBJ_DIR)/a/$(DICTNAME).rootmap --rootmap-lib=$(SONAME) -I$(PARENT_DIR)
$(OBJ_DIR)/a/$(DICTNAME).cc: $(SRC_DIR)/classes_def.xml | $(OBJ_DIR)
genreflex $(SRC_DIR)/classes.h -s $< -o $@ --deep --fail_on_warnings --rootmap=$(OBJ_DIR)/a/$(DICTNAME).rootmap --rootmap-lib=$(SONAME) -I$(PARENT_DIR)
mv $(OBJ_DIR)/a/$(DICTNAME).rootmap $(LIB_DIR)/
mv $(OBJ_DIR)/a/$(DICTNAME)_rdict.pcm $(LIB_DIR)/

#---------------------------------------
$(OBJ_DIR)/a/%.o: $(OBJ_DIR)/a/%.cc | $(OBJ_DIR)
$(CXX) $(CCFLAGS) -I . -I $(SRC_DIR) -I $(PARENT_DIR) -c $< -o $@

obj: dict
# @echo "\n*** Compiling ..."
$(OBJ_DIR)/%.o : $(SRC_DIR)/%.cc $(INC_DIR)/%.h
$(CC) $(CCFLAGS) -I $(INC_DIR) -I $(SRC_DIR) -I $(PARENT_DIR) -c $< -o $@
$(OBJ_DIR)/%.o : $(SRC_DIR)/%.cc $(SRC_DIR)/%.h
$(CC) $(CCFLAGS) -I $(INC_DIR) -I $(SRC_DIR) -I $(PARENT_DIR) -c $< -o $@
$(OBJ_DIR)/%.o : $(SRC_DIR)/%.cxx $(INC_DIR)/%.h
$(CC) $(CCFLAGS) -I $(INC_DIR) -I $(SRC_DIR) -I $(PARENT_DIR) -c $< -o $@
$(OBJ_DIR)/a/%.o : $(OBJ_DIR)/a/%.cc
$(CC) $(CCFLAGS) -I . -I $(SRC_DIR) -I $(PARENT_DIR) -c $< -o $@
#---------------------------------------

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cc $(INC_DIR)/%.h | $(OBJ_DIR)
$(CXX) $(CCFLAGS) -I $(INC_DIR) -I $(SRC_DIR) -I $(PARENT_DIR) -c $< -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cc $(SRC_DIR)/%.h | $(OBJ_DIR)
$(CXX) $(CCFLAGS) -I $(INC_DIR) -I $(SRC_DIR) -I $(PARENT_DIR) -c $< -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cxx $(INC_DIR)/%.h | $(OBJ_DIR)
$(CXX) $(CCFLAGS) -I $(INC_DIR) -I $(SRC_DIR) -I $(PARENT_DIR) -c $< -o $@

# this has no header
$(OBJ_DIR)/tdrstyle.o: $(SRC_DIR)/tdrstyle.cc
$(CC) $(CCFLAGS) -I $(INC_DIR) -c $< -o $@
$(CXX) $(CCFLAGS) -I $(INC_DIR) -c $< -o $@

#---------------------------------------

$(LIB_DIR):
@mkdir -p $(LIB_DIR)

${LIB_DIR}/$(SONAME): $(addprefix $(OBJ_DIR)/,$(OBJS)) $(OBJ_DIR)/a/$(DICTNAME).o | $(LIB_DIR)
$(LD) $(LDFLAGS) $(BOOST_INC) $^ $(SOFLAGS) -o $@ $(LIBS)

#---------------------------------------

lib: dirs ${LIB_DIR}/$(SONAME)
${LIB_DIR}/$(SONAME):$(addprefix $(OBJ_DIR)/,$(OBJS)) $(OBJ_DIR)/a/$(DICTNAME).o
# @echo "\n*** Building $(SONAME) library:"
$(LD) $(LDFLAGS) $(BOOST_INC) $(addprefix $(OBJ_DIR)/,$(OBJS)) $(OBJ_DIR)/a/$(DICTNAME).o $(SOFLAGS) -o $@ $(LIBS)
$(EXE_DIR):
@mkdir -p $(EXE_DIR)

exe: $(addprefix $(EXE_DIR)/,$(EXES)) $(addprefix $(EXE_DIR)/,$(SCRIPTS))
@echo $^

$(EXE_DIR)/%: $(PROG_DIR)/%.cpp $(LIB_DIR)/$(SONAME) | $(EXE_DIR)
@echo $<
$(CXX) $< -o $@ $(CCFLAGS) -L $(LIB_DIR) -l $(LIBNAME) -I $(INC_DIR) -I $(SRC_DIR) -I $(PARENT_DIR) $(BOOST_INC) $(LIBS) $(EXELDFLAGS)

$(EXE_DIR)/%.py: $(SCRIPTS_DIR)/%.py | $(EXE_DIR)
cp $< $@
# macOS System Integrity Protection unsets LD_LIBRARY_PATH for child process started by system programs
# breaking the use of /usr/bin/env in the scripts, so we hardcode the path to python executable instead
ifdef DARWIN
sed -i "" "1s@/.*@$(shell which python)@" $@
endif

#---------------------------------------

exe: $(addprefix $(EXE_DIR)/,$(EXES))
# @echo "\n*** Compiling executables ..."
$(EXE_DIR)/% : $(PROG_DIR)/%.cpp lib
$(CC) $< -o $@ $(CCFLAGS) -L $(LIB_DIR) -l $(LIBNAME) -I $(INC_DIR) -I $(SRC_DIR) -I $(PARENT_DIR) $(BOOST_INC) $(LIBS)
.FORCE:

compile_python:
@python -m compileall -q python
python: .FORCE | $(LIB_DIR)
@mkdir -p $(PYLIB_DIR)/HiggsAnalysis/CombinedLimit
@touch $(PYLIB_DIR)/__init__.py
@touch $(PYLIB_DIR)/HiggsAnalysis/__init__.py
@touch $(PYLIB_DIR)/HiggsAnalysis/CombinedLimit/__init__.py
cp -r $(PYTHON_DIR)/* $(PYLIB_DIR)/HiggsAnalysis/CombinedLimit
python3 -m compileall -q $(PYLIB_DIR)

#---------------------------------------

clean:
# @echo "*** Cleaning all directories and dictionaries ..."
@rm -rf $(OBJ_DIR)
@rm -rf $(EXE_DIR)
@rm -rf $(LIB_DIR)
@rm -rf python/*pyc python/*/*pyc

#---------------------------------------

debug:
@echo "OBJS: $(OBJS)"
@echo "SRCS: $(SRCS)"
Loading

0 comments on commit 2cb571b

Please sign in to comment.