|
| 1 | +# Invariant-mass fitter |
| 2 | +Invariant-mass fitter is implemented in the class `HFInvMassFitter` (`HFInvMassFitter.cxx/h` files), and its run is executed via `runMassFitter.C` macro. |
| 3 | +Fitter is configured in `config_massfitter.json`.\ |
| 4 | +The fitter is **not** a part of O2Physics source code. |
| 5 | + |
| 6 | +## Dependencies |
| 7 | +1. ROOT |
| 8 | +2. RapidJSON. Download the header-only (no compilation needed) RapidJSON library, see the link <https://rapidjson.org>. |
| 9 | + |
| 10 | +If you have O2Physics compilation you do not need to fulfill these dependencies explicitly. |
| 11 | + |
| 12 | +## How to run |
| 13 | +### As a ROOT macro |
| 14 | +The `runMassFitter.C` can be compiled as ROOT macro. |
| 15 | +```bash |
| 16 | +cd path-to-o2physics-src/PWGHF/D2H/Macros |
| 17 | +source path-to-root-install/bin/thisroot.sh |
| 18 | +export ROOT_INCLUDE_PATH=$ROOT_INCLUDE_PATH:path-to-json-include |
| 19 | +root -l -x -b -q "HFInvMassFitter.cxx" "runMassFitter.C(\"config_massfitter.json\")" |
| 20 | +``` |
| 21 | +If you have O2Physics compilation and enter into its environment there is no need to set environment variables (skip lines 2-3 above). |
| 22 | + |
| 23 | +### As a CMake project |
| 24 | +It is also possible to compile the fitter as a CMake project or insert it into existing one if any. |
| 25 | +Use the `CMakeLists_HFInvMassFitter.txt` (rename it into `CMakeLists.txt` before usage).\ |
| 26 | +Compile the fitter with the following steps: |
| 27 | +```bash |
| 28 | +cd path-to-o2physics-src/PWGHF/D2H/Macros |
| 29 | +mkdir build |
| 30 | +cd build |
| 31 | +source path-to-root-install/bin/thisroot.sh |
| 32 | +cmake -DHFFITTER_RAPIDJSON_INCLUDE_DIRS=path-to-json-include ../ |
| 33 | +make |
| 34 | +``` |
| 35 | +and run the fitter: |
| 36 | +```bash |
| 37 | +./runMassFitter ../config_massfitter.json |
| 38 | +``` |
| 39 | +### Directly from the terminal |
| 40 | +Compile the fitter with the following steps: |
| 41 | +```bash |
| 42 | +cd path-to-o2physics-src/PWGHF/D2H/Macros |
| 43 | +mkdir build |
| 44 | +cd build |
| 45 | +source path-to-root-install/bin/thisroot.sh |
| 46 | + |
| 47 | +# Generate ROOT dictionary: |
| 48 | +rootcling -f G__HFInvMassFitter.cxx -c ../HFInvMassFitter.h ../HFInvMassFitterLinkDef.h |
| 49 | + |
| 50 | +# Compile source code: |
| 51 | +g++ -fPIC -I$(root-config --incdir) -I path-to-json-include -c ../HFInvMassFitter.cxx ../runMassFitter.C G__HFInvMassFitter.cxx |
| 52 | + |
| 53 | +# Link the executable: |
| 54 | +g++ -o runMassFitter HFInvMassFitter.o runMassFitter.o G__HFInvMassFitter.o $(root-config --libs) -lRooFit -lRooFitCore -lEG |
| 55 | +``` |
| 56 | +and run the fitter: |
| 57 | +```bash |
| 58 | +./runMassFitter ../config_massfitter.json |
| 59 | +``` |
0 commit comments