Skip to content

Commit 1327d91

Browse files
committed
write compilation instruction in Readme; rename CMakeLists.txt
1 parent d8be2d6 commit 1327d91

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed
File renamed without changes.

PWGHF/D2H/Macros/README.md

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,55 @@
1-
export ROOT_INCLUDE_PATH=path-to-json-include // if not in O2Physics environment
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.
25

6+
## Dependencies
7+
1. ROOT
8+
9+
2. RapidJSON. Download the header-only (no compilation needed) RapidJSON library, see the link https://rapidjson.org.
10+
11+
## How to run
12+
### As a ROOT macro
13+
The `runMassFitter.C` can be compiled as ROOT macro.
14+
```
15+
source path-to-root-install/bin/thisroot.sh
16+
export ROOT_INCLUDE_PATH=$ROOT_INCLUDE_PATH:path-to-json-include
317
root -l -x -b -q "HFInvMassFitter.cxx" "runMassFitter.C(\"config_massfitter.json\")"
18+
```
19+
If you have O2Physics compilation and enter into its environment there is no need to set environment variables (skip first two lines above).
420

21+
### As a CMake project
22+
It is also possible to compile the fitter as a CMake project or insert it into existing one if any.
23+
Use the `CMakeLists_HFInvMassFitter.txt` (rename it into `CMakeLists.txt` before usage).\
24+
Compile the fitter with the following steps:
25+
```
26+
mkdir build
27+
cd build
28+
source path-to-root-install/bin/thisroot.sh
29+
cmake -DHFFITTER_RAPIDJSON_INCLUDE_DIRS=path-to-json-include ..
30+
make
31+
```
32+
and run the fitter:
33+
```
34+
./runMassFitter ../config_massfitter.json
35+
```
36+
### Directly from the terminal
37+
Compile the fitter with the following steps:
38+
```
39+
mkdir build
40+
cd build
41+
source path-to-root-install/bin/thisroot.sh
542
6-
Step 1: Generate ROOT dictionary:
43+
# Generate ROOT dictionary:
744
rootcling -f G__HFInvMassFitter.cxx -c ../HFInvMassFitter.h ../HFInvMassFitterLinkDef.h
845
9-
Step 2: Compile source code:
46+
# Compile source code:
1047
g++ -fPIC -I$(root-config --incdir) -I path-to-json-include -c ../HFInvMassFitter.cxx ../runMassFitter.C G__HFInvMassFitter.cxx
1148
12-
Step 3: Link the executable:
49+
# Link the executable:
1350
g++ -o runMassFitter HFInvMassFitter.o runMassFitter.o G__HFInvMassFitter.o $(root-config --libs) -lRooFit -lRooFitCore -lEG
51+
```
52+
and run the fitter:
53+
```
54+
./runMassFitter ../config_massfitter.json
55+
```

0 commit comments

Comments
 (0)