myfitter is hosted by Hepforge, IPPP Durham

Previous: Installation, Up: Getting Started


1.3 Compiling the Example

When everything is installed properly, copy the contents of doc/examples to some other directory and run

     g++ -o linear_example linear_example.cpp `pkg-config --cflags --libs myFitter`

If you don't use the GNU compiler (but why wouldn't you?) replace g++ by whatever your compiler is called. The command pkg-config --cflags --libs myFitter prints out the flags needed to link your program to myFitter, and by enclosing it in back-quotes you substitute its output on the command line. When you write bigger programs you'll want to do compiling and linking in two steps. Then use pkg-config --cflags myFitter for compilation and pkg-config --libs myFitter for linking.

If everything worked, you now have an executable called linear_example in your working directory. Try to run it. It fits a simple model to some data and computes the p-value in two different ways. It takes a couple of minutes to run. To get a first idea of how to implement your own models and do your own fits, have a look at the source files linear_example.cpp and linearmodel.hpp. They have lots of comments that explain what's going on.