Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
anmalara authored Dec 4, 2023
2 parents 1c0c812 + b47ce81 commit 1b2edc6
Show file tree
Hide file tree
Showing 84 changed files with 9,513 additions and 845 deletions.
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
# E741: ambiguous variable name 'l' (too pedantic! get a good font)
# E711: sometimes needed for comparison to ROOT nullptr (better to cast to bool)
# F401: unused import (some may have side effects, need to clean by hand)
ignore = F403,F405,E402,W504,E203,W503,E262,E265,E266,E501,E741,E711,F401
# E721: do not compare types (new, could be fixed relatively easily)
ignore = F403,F405,E402,W504,E203,W503,E262,E265,E266,E501,E741,E711,F401,E721
max-line-length = 160
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,17 @@ jobs:
- name: Install build environment
shell: bash -l {0}
run: |
mamba install -c conda-forge python==${{ matrix.python }} pip pandas 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-cpp boost pcre eigen
cd HiggsAnalysis/CombinedLimit
bash set_conda_env_vars.sh
- name: Build
shell: bash -l {0}
run: |
cd HiggsAnalysis/CombinedLimit
make CONDA=1 -j 2
- name: Run tests
if: startsWith(matrix.python, '3.')
shell: bash -l {0}
run: |
cd HiggsAnalysis/CombinedLimit/test
python test_interference.py
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ DICTNAME=$(LIBNAME)_xr
# Linker and flags -------------------------------------------------------------
LD = $(shell root-config --ld)
ROOTLDFLAGS = $(shell root-config --ldflags)
ROOTLIBDIR = $(shell root-config --libdir)
# 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'
LDFLAGS = $(ROOTLDFLAGS) -g -shared -install_name @rpath/$(SONAME) -fPIC
EXELDFLAGS = -Wl,-rpath,'@executable_path/../lib' -Wl,-rpath,$(ROOTLIBDIR)
else
LDFLAGS = $(ROOTLDFLAGS) -shared -Wl,-soname,$(SONAME) -Wl,-E -Wl,-z,defs -fPIC
EXELDFLAGS =
Expand Down Expand Up @@ -97,7 +98,7 @@ $(OBJ_DIR):
@mkdir -p $(OBJ_DIR)/a

$(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)
genreflex $(SRC_DIR)/classes.h -s $< -o $@ --deep --fail_on_warnings --rootmap=$(OBJ_DIR)/a/$(DICTNAME).rootmap --rootmap-lib=$(SONAME) -Isrc -I$(PARENT_DIR)
mv $(OBJ_DIR)/a/$(DICTNAME).rootmap $(LIB_DIR)/
mv $(OBJ_DIR)/a/$(DICTNAME)_rdict.pcm $(LIB_DIR)/

Expand Down
4 changes: 2 additions & 2 deletions bin/PerfTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include "RooMsgService.h"
#include <dlfcn.h>
#include <RooStats/ModelConfig.h>
#include "HiggsAnalysis/CombinedLimit/interface/CachingNLL.h"
#include "HiggsAnalysis/CombinedLimit/interface/ProfilingTools.h"
#include "../interface/CachingNLL.h"
#include "../interface/ProfilingTools.h"

void (*dump_)(const char *);

Expand Down
8 changes: 6 additions & 2 deletions bin/combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "../interface/CascadeMinimizer.h"
#include "../interface/ProfilingTools.h"
#include "../interface/GenerateOnly.h"
#include "../interface/Logger.h"
#include "../interface/CombineLogger.h"
#include <map>

using namespace std;
Expand All @@ -51,6 +51,9 @@ int main(int argc, char **argv) {

Combine combiner;

// Set name of Log file (ideally would make this similar format to out file)
CombineLogger::instance().setName("combine_logger.out");

map<string, LimitAlgo *> methods;
algo = new Significance(); methods.insert(make_pair(algo->name(), algo));
algo = new BayesianFlatPrior(); methods.insert(make_pair(algo->name(), algo));
Expand Down Expand Up @@ -250,6 +253,7 @@ int main(int argc, char **argv) {
}

TString fileName = "higgsCombine" + name + "."+whichMethod+"."+massName+toyName+"root";

TFile *test = new TFile(fileName, "RECREATE"); outputFile = test;
TTree *t = new TTree("limit", "limit");
int syst, iToy, iSeed, iChannel;
Expand Down Expand Up @@ -324,7 +328,7 @@ int main(int argc, char **argv) {

try {
combiner.run(datacard, dataset, limit, limitErr, iToy, t, runToys);
if (verbose>0) Logger::instance().printLog();
if (verbose>0) CombineLogger::instance().printLog();
} catch (std::exception &ex) {
cerr << "Error when running the combination:\n\t" << ex.what() << std::endl;
test->Close();
Expand Down
119 changes: 119 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Contributing

Contributions to combine of all sizes, from minor documentation updates to big code improvements, are welcome and encouraged.

To ensure good development of the tool, we try to coordinate contributions.
However, we are happy to help overcome any steps that may pose issues for contributors.

Guidelines for contributions are below.

In general you should always perform the following steps when contributing.

1. Make your changes;
2. Test your changes to ensure they work and don't break anything;
3. If this changes any user-facing aspect, ensure that the appropriate documentation is updated;
4. Check code style (see below), and fix any issues;
5. Create your pull request;
6. Iterate with the maintainers until the request is merged.

## Code Style


We ask that you put some effort into the readability of your code.
We are, however, always happy to help if there is an issue.

We use linting as part of our ci/cd for the python code.
That means your code will be checked automatically, and you must make sure it conforms to certain rules.

Currently no linting or automatic checks of C++ code are implemented.
Although we do not have a well-defined style guide for C++, we always appreciate readable and well-formatted code.

### Technical details on linting

we use `flake8` and `black` for linting.
To run the linting locally before making your pull request, or before making a commit, you can do the following.

ensure `flake8` and `black` are installed:

```
python -m pip install -q flake8 black
```

and then from the main directory of this repository run


flake8:
```
flake8 .
```

and black:

```
black -l 160 --check --diff .
```

If you'd like to see the details of the configuration `flake8` is using, check the `.flake8` file in the main directory.
The black linting uses the default [black style](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html) (for v23.3.0), with only the command line options shown above.


## Updating Documentation

It is crucial to our user base and developers that the documentation is well-maintained.
For that reason, whenever you make a change you should consider whether this requires a corresponding documentation update.

If the change is user-facing it almost certainly does require a documentation update.

Documentation is **very important** to us.
Therefore, we will be picky and make sure it is done well!
However, we don't want to put extra burden on you, so we are happy to help and will make our own edits and updates to improve the documentation of your change.

We appreciate you putting in some effort and thought to ensure:

- your documentation is understandable to the audience being targeted;
- your documentation is clear and concise; and
- your documentation fits in properly with the overall documentation structure.

### Technical details of the documentation

We use [mkdocs](www.mkdocs.org) to produce the static website that documents combine.

The documentation files are all under the `docs/` folder.
Which pages get included in the site, and other configuration details are set in the `mkdocs.yml` file.

In order to check the documentation rendering (features such as latex math rendering, etc) locally, you can generate the site on your local computer and check it in your browser.
To do so, after [installing mkdocs](https://www.mkdocs.org/getting-started/) and [pymdown extensions](https://facelessuser.github.io/pymdown-extensions/installation/) and the [cinder theme](https://sourcefoundry.org/cinder/) via:

```
python -m pip install mkdocs pymdown-extensions mkdocs-cinder
```

you can do:

```
mkdocs build
mkdocs serve
```

from the main repository directory. mkdocs will then print a link you can open to check the page generated in your browser.

**NOTE:** mkdocs builds which use internal links (or images etc) with absolute paths will work for local deployment, but will break when deployed to the public documentations pages.
Please ensure you use relative paths. Currently, this is the only known feature where the behvaiour differs between local mkdocs and public pages deployment.
If you'd like to test the deployment directly, the suggested method is to set up a docs page using your personal github account; this should mimic the exact settings of the official page.

## Big Contributions

We welcome large contributions to combine.
Note, however, that we also follow long term planning, and there is a dedicated group stewarding the overall direction and development of the code.

This means that the code development should fit in with our long term vision;
if you have an idea for a big improvement or change it will be most efficient if you [contact us](mailto:[email protected]) first, in order to ensure that we can integrate it as seemlessly as possible into our plans.
This will simplify any potential conflicts when you make your pull request.

## Requested Contributions

As part of the long term planning, we have a number of changes we are targeting, but have not yet had a chance to implement.
As well as the [issues](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/issues) listed on the github issues tracker, you can see the [projects](https://github.com/orgs/cms-analysis/projects) listed under the general cms-analysis organization, where we have defined several projects and areas we are targeting.
If you're interested in getting involved in any of these projects please contact us at [[email protected]](mailto:[email protected]).


Loading

0 comments on commit 1b2edc6

Please sign in to comment.