Giter VIP home page Giter VIP logo

genfit's Introduction

GenFit Package

Build and Test DOI

GenFit is an experiment-independent framework for track reconstruction in particle and nuclear physics. It consists of three modular components:

  • Track fitting algorithms

    Currently, GenFit contains a Kalman Filter, a Deterministic Annealing Filter, and a General Broken Lines fitter. Other algorithm modules can be added easily.

  • Track representations

    These modules can perform extrapolations of track parameters through material and magnetic fields. GenFit is distributed with a well-tested track representation. Existing track extrapolation codes can be interfaced in a very straightforward way in this framework, using their native geometry and magnetic field interfaces.

  • Measurements

    The measurement dimensionality and the orientation of planar tracking detectors can be chosen freely. GenFit is especially useful for tracking systems which include detectors which do not measure the passage of particles on predefined planes, like TPCs or wire-based drift chambers. The concept of so-called virtual detector planes provides a simple mechanism to use these detector hits in a transparent way without any geometrical simplifications.

GenFit has been developed in the framework of the PANDA experiment at FAIR, Darmstadt, Germany. It is also used in the Belle II, Fopi, and GEM-TPC experiments.

GenFit is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the license (LGPLv3), or (at your option) any later version. A copy of the license is distributed with GenFit in the LICENSE.md file.

GenFit Homepage: (https://github.com/GenFit/GenFit)

genfit's People

Contributors

daritter avatar drateots avatar eckerpatrick avatar felixmetzner avatar geniejhang avatar giacomoxt avatar ihepzhangyao avatar jojosito avatar markusprim avatar mirguest avatar nils-braun avatar olifre avatar oliver-frost avatar pinkenburg avatar tadeasb avatar thomashauth avatar tmadlener avatar tobischluter avatar vberta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

genfit's Issues

Bug in Track& Track::operator=

In the assignment operator, after the TrackPoint copy by the swap function, the track pointer of each TrackPoint should be updated, since it is pointing to the "original" object and not to the "copied" one.
This is currently done as it follows:

   for (std::vector<TrackPoint*>::const_iterator it=trackPoints_.begin(); it!=trackPoints_.end(); ++it) {
     trackPoints_.back()->setTrack(this);
   }

In this way only the last TrackPoint is updated, not all of them.
I believe, it should be:

 for (std::vector<TrackPoint*>::const_iterator it=trackPoints_.begin(); it!=trackPoints_.end(); ++it) {
    (*it)->setTrack(this);
  }

Release number

Would it possible to add the release number for GenFit?

RKPropagate01/RKPropagate02 tests fail due to numeric issues

[  131s] /home/abuild/rpmbuild/BUILD/GenFit-02-00-01/gtest/TestRKTrackRep.cpp:185: Failure
[  131s] Expected equality of these values:
[  131s]   0
[  131s]   mySA[2]
[  131s]     Which is: -5.55112e-17
[  131s] [  FAILED  ] RKTrackRepTests.RKPropagate01 (10 ms)
[  131s] /home/abuild/rpmbuild/BUILD/GenFit-02-00-01/gtest/TestRKTrackRep.cpp:215: Failure
[  131s] Expected equality of these values:
[  131s]   0.
[  131s]     Which is: 0
[  131s]   mySA[2]
[  131s]     Which is: -5.5511151e-17
[  131s] [  FAILED  ] RKTrackRepTests.RKPropagate02 (0 ms)

For a velocity of 1 (state[6]=1), the error is in the expected range, 5.5e17 is ~1/2^53, i.e. precision of double.

EXPECT_EQ(0, mySA[2]);

For values near 0, EXPECT_{,_DOUBLE,_FLOAT}_EQ is likely to fail:

https://github.com/google/googletest/blob/main/docs/reference/assertions.md#floating-point-comparison-floating-point

Due to rounding errors, it is very unlikely that two floating-point values will match exactly, so EXPECT_EQ is not suitable. In general, for floating-point comparison to make sense, the user needs to carefully choose the error bound.

GoogleTest also provides assertions that use a default error bound based on Units in the Last Place (ULPs). To learn more about ULPs, see the article Comparing Floating Point Numbers.

The correct check macro for comparing to 0 is EXPECT_NEAR(..., FLT_EPSILON). (or n * DBL_EPSILON).

Step limits to the Runge-kutta propagation

Hi.
We are using GenFit for an experiment, named COMET experiment.
In adopting the Genfit for our tracking, we are facing a problem.

In the experiment, there is a tracking detector consisting of straw-tube gaseous chambers is operated in a vacuum under a magnetic field of 1T.
Two-dimensionally aligned straw tubes are assembled into a 'station' component, and the tracker will contain about five stations along the beam line.
The distance between two stations is about > 50 cm.
Signal trajectories (electron with a momentum of ~105 MeV/c) penetrate all of them, and sometimes almost make a full (or more) turn between a pair of the stations when the pitch angle against to the beam axis is large (cos(theta) = Pz/P < ~0.3).
In that situation the Runge-Kutta propagation of the track always fails (the error message says a divergence of the calculation happened.)

I found that this problem technically can be resolved by inserting several virtual measurement planes between two stations.
The virtual planes are genfit::PlanarMeasurement having a meaningless position and almost infinity covariance that hence do not affect the fitting result.

This is because these planes force the propagation to stop at each.
That is why a somewhat limited step limit is important for the propagation.
Looking at the codes, I understood that Genfit automatically decides the step limits according to the material in which the track is running.
However In our case the material (vacuum) is too little to set a reasonable limit.
I need a function to set user limits on the step lengths, but cannot find such one.

If such one exists, I would like you to tell me.
Otherwise, I would be happy if you add it.

Remove dependency to boost

The boost dependency is from pre c++11 times. We could get rid of it with using the stl equivalents. The switch to c++11 seems reasonable anyway, because ROOT6 also requires c++11.

However, nothing but faster compile times will be gained here. I think dependency problems with boost should never be an issue.

Finding Eigen3 breaks on a standard installation

I get:

CMake Error at CMakeLists.txt:39 (FIND_PACKAGE):
  Could not find a package configuration file provided by "Eigen3" with any
  of the following names:

    Eigen3Config.cmake
    eigen3-config.cmake

  Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
  "Eigen3_DIR" to a directory containing one of the above files.  If "Eigen3"
  provides a separate development package or SDK, be sure it has been
  installed.

However, I have:

/usr/share
/usr/share/cmake
/usr/share/cmake/Modules
/usr/share/cmake/Modules/FindEigen3.cmake
/usr/share/pkgconfig
/usr/share/pkgconfig/eigen3.pc

installed just fine.
Modifying CMakeLists.txt from:

FIND_PACKAGE(Eigen3 REQUIRED NO_MODULE)

to

FIND_PACKAGE(Eigen3 REQUIRED)

fixes that:

-- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0") 

I wonder why NO_MODULE is specified explicitly here, since it breaks any standard installation.
Also, in case there is no module, a fallback to "config mode" will be done in any case.

Is there a reason for it (then all distros out there need to patch GenFit), or can it be dropped for good?

Replace assertions by exceptions

In our productive code (Belle II) execution stops by assertions. The idea is to replace the assertions by exceptions to be able to handle these cases and to give more detailed information on the broken conditions.

Edit: To be more clear: I am talking about the specific handling of the checkConsistency method in the Track class. Instead of asserting this, better throw an exception and tell why it is failing.

Linking errors in the latest version of the master branch

Hello!
I am getting some linking errors when using the lastest version of the master branch. Here are my system info:

  • OS : Ubuntu 20.04
  • ROOT : 6.22/02
  • ROOT features : cxx11 asimage builtin_clang builtin_llvm builtin_vdt builtin_xrootd clad dataframe davix exceptions fftw3 fitsio fortran gdml gfal http imt mathmore mlp minuit2 mysql opengl pgsql pyroot pythia8 roofit runtime_cxxmodules shared sqlite ssl tmva tmva-cpu tmva-pymva spectrum vdt x11 xml xrootd
  • GenFit latest commit : 66cebb1

At the bottom of the page you can find the detailed error message. It seems that there are some problems in the generation of the ROOT dictionaries for certain classes (genfit::HMatrixPhi, genfit::GFGbl, genfit::EventDisplay, etc...)

I have just cloned the repository and compiled it with the usual cmake, make, make tests.

====================[ Build | all | Debug ]=====================================
/usr/bin/cmake --build /home/neo/Desktop/GenFit/cmake-build-debug --target all -- -j 6
[  1%] Generating utilitiesRootDict.cc, utilitiesRootDict_rdict.pcm, utilitiesRoot.rootmap
[  4%] Generating trackRepsRootDict.cc, trackRepsRootDict_rdict.pcm, trackRepsRoot.rootmap
[  4%] Generating measurementsRootDict.cc, measurementsRootDict_rdict.pcm, measurementsRoot.rootmap
[  4%] Generating coreRootDict.cc, coreRootDict_rdict.pcm, coreRoot.rootmap
[  6%] Generating GBLRootDict.cc, GBLRootDict_rdict.pcm, GBLRoot.rootmap
[  7%] Generating fittersRootDict.cc, fittersRootDict_rdict.pcm, fittersRoot.rootmap
Warning: Unused class rule: genfit::HMatrixPhi
[  8%] Generating eventDisplayRootDict.cc, eventDisplayRootDict_rdict.pcm, eventDisplayRoot.rootmap
Warning: Unused class rule: genfit::GFGbl
Warning: Unused class rule: genfit::EventDisplay
Warning: Unused class rule: genfit
Scanning dependencies of target genfit2
[  9%] Building CXX object CMakeFiles/genfit2.dir/utilitiesRootDict.cc.o
[ 12%] Building CXX object CMakeFiles/genfit2.dir/trackRepsRootDict.cc.o
[ 12%] Building CXX object CMakeFiles/genfit2.dir/fittersRootDict.cc.o
[ 13%] Building CXX object CMakeFiles/genfit2.dir/measurementsRootDict.cc.o
[ 14%] Building CXX object CMakeFiles/genfit2.dir/GBLRootDict.cc.o
[ 16%] Building CXX object CMakeFiles/genfit2.dir/eventDisplayRootDict.cc.o
[ 17%] Building CXX object CMakeFiles/genfit2.dir/coreRootDict.cc.o
[ 18%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsFinitePlane.cc.o
[ 19%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsFitter.cc.o
[ 20%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsFitterInfo.cc.o
[ 22%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsMeasurement.cc.o
[ 23%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsTrackRep.cc.o
[ 24%] Building CXX object CMakeFiles/genfit2.dir/core/src/Exception.cc.o
[ 25%] Building CXX object CMakeFiles/genfit2.dir/core/src/DetPlane.cc.o
[ 27%] Building CXX object CMakeFiles/genfit2.dir/core/src/FieldManager.cc.o
[ 28%] Building CXX object CMakeFiles/genfit2.dir/core/src/FitStatus.cc.o
[ 29%] Building CXX object CMakeFiles/genfit2.dir/core/src/IO.cc.o
[ 30%] Building CXX object CMakeFiles/genfit2.dir/core/src/Material.cc.o
[ 32%] Building CXX object CMakeFiles/genfit2.dir/core/src/MeasuredStateOnPlane.cc.o
[ 33%] Building CXX object CMakeFiles/genfit2.dir/core/src/MeasurementOnPlane.cc.o
[ 34%] Building CXX object CMakeFiles/genfit2.dir/core/src/StateOnPlane.cc.o
[ 35%] Building CXX object CMakeFiles/genfit2.dir/core/src/ThinScatterer.cc.o
[ 37%] Building CXX object CMakeFiles/genfit2.dir/core/src/Tools.cc.o
[ 38%] Building CXX object CMakeFiles/genfit2.dir/core/src/Track.cc.o
[ 39%] Building CXX object CMakeFiles/genfit2.dir/core/src/TrackCand.cc.o
[ 40%] Building CXX object CMakeFiles/genfit2.dir/core/src/TrackCandHit.cc.o
[ 41%] Building CXX object CMakeFiles/genfit2.dir/core/src/TrackPoint.cc.o
[ 43%] Building CXX object CMakeFiles/genfit2.dir/eventDisplay/src/EventDisplay.cc.o
[ 44%] Building CXX object CMakeFiles/genfit2.dir/fields/src/ConstField.cc.o
[ 45%] Building CXX object CMakeFiles/genfit2.dir/finitePlanes/src/RectangularFinitePlane.cc.o
[ 46%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/AbsKalmanFitter.cc.o
[ 48%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/DAF.cc.o
[ 49%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFitStatus.cc.o
[ 50%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFittedStateOnPlane.cc.o
[ 51%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFitter.cc.o
[ 53%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFitterInfo.cc.o
[ 54%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFitterRefTrack.cc.o
[ 55%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/ReferenceStateOnPlane.cc.o
[ 56%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/BorderedBandMatrix.cc.o
[ 58%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GFGbl.cc.o
[ 59%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblData.cc.o
[ 60%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblFitter.cc.o
[ 61%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblFitterInfo.cc.o
[ 62%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblPoint.cc.o
[ 64%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblTrajectory.cc.o
[ 65%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/MilleBinary.cc.o
[ 66%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/VMatrix.cc.o
[ 67%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/FullMeasurement.cc.o
[ 69%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixPhi.cc.o
[ 70%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixU.cc.o
[ 71%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixUV.cc.o
[ 72%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixUnit.cc.o
[ 74%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixV.cc.o
[ 75%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/PlanarMeasurement.cc.o
[ 76%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/ProlateSpacepointMeasurement.cc.o
[ 77%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/SpacepointMeasurement.cc.o
[ 79%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/WireMeasurement.cc.o
[ 80%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/WireMeasurementNew.cc.o
[ 81%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/WirePointMeasurement.cc.o
[ 82%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/WireTrackCandHit.cc.o
[ 83%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/MaterialEffects.cc.o
[ 85%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/MplTrackRep.cc.o
[ 86%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/RKTools.cc.o
[ 88%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/StepLimits.cc.o
[ 88%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/RKTrackRep.cc.o
[ 90%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/TGeoMaterialInterface.cc.o
[ 91%] Building CXX object CMakeFiles/genfit2.dir/utilities/src/HelixTrackModel.cc.o
[ 92%] Building CXX object CMakeFiles/genfit2.dir/utilities/src/MeasurementCreator.cc.o
[ 93%] Linking CXX shared library lib/libgenfit2.so
[ 93%] Built target genfit2
Scanning dependencies of target gtests
[ 96%] Building CXX object CMakeFiles/gtests.dir/gtest/TestConstField.cpp.o
[ 96%] Building CXX object CMakeFiles/gtests.dir/gtest/TestRKTrackRep.cpp.o
[ 97%] Building CXX object CMakeFiles/gtests.dir/gtest/TestMaterial.cpp.o
[ 98%] Building CXX object CMakeFiles/gtests.dir/gtest/TestMaterialEffects.cpp.o
[100%] Linking CXX executable bin/gtests
/usr/bin/ld: lib/libgenfit2.so.2.2.0: undefined reference to `genfit::EventDisplay::Class()'
/usr/bin/ld: lib/libgenfit2.so.2.2.0: undefined reference to `genfit::HMatrixPhi::Class()'
/usr/bin/ld: lib/libgenfit2.so.2.2.0: undefined reference to `genfit::GFGbl::Streamer(TBuffer&)'
/usr/bin/ld: lib/libgenfit2.so.2.2.0: undefined reference to `genfit::EventDisplay::Streamer(TBuffer&)'
/usr/bin/ld: lib/libgenfit2.so.2.2.0: undefined reference to `genfit::GFGbl::Class()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/gtests.dir/build.make:132: bin/gtests] Error 1
make[1]: *** [CMakeFiles/Makefile2:93: CMakeFiles/gtests.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Possible stack overflow in GenFit

At Belle II we experience the following compilation issues with the GenFit package

genfit2/code2/core/src/Tools.cc:209 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixU.cc:42 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixU.cc:53 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixU.cc:67 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixPhi.cc:54 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixPhi.cc:65 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixPhi.cc:79 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixUV.cc:43 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixUV.cc:56 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixUV.cc:71 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixV.cc:41 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixV.cc:52 stack usage might be unbounded [-Wstack-usage=]
genfit2/code2/measurements/src/HMatrixV.cc:66 stack usage might be unbounded [-Wstack-usage=]

genfit2/code2/GBL/src/GFGbl.cc:333 variable 'trkChi2' set but not used [-Wunused-but-set-variable]
genfit2/code2/GBL/src/GblFitter.cc:161 variable 'ndummy' set but not used [-Wunused-but-set-variable]
genfit2/code2/GBL/src/GblFitter.cc:161 variable 'nscat' set but not used [-Wunused-but-set-variable]
genfit2/code2/GBL/src/GblFitter.cc:295 variable 'igblfi' set but not used [-Wunused-but-set-variable]

The stack overflow warnings are related to the use of the alloca function in several places, which takes memory from stack rather standardly from the heap.
At Belle II we had several problems with the stack size limit and consequent stack overflow.

So If there is no fundamental reason to use stack memory instead of standard dynamic memory allocation, we would prefer to use dynamic memory...

See the related discussion about alloca and malloc
https://stackoverflow.com/questions/1018853/why-is-the-use-of-alloca-not-considered-good-practice

Remove dead code

There is maybe some dead code in the project which could be removed. I will try to make a coverage report when using GenFit with basf2 to locate these blocks.

No API versioning

Hi,

since there seem to be no releases, is there any way to get a "version number", e.g. via a macro, for fundamental API changes?
For example, the recent change from assertions / boolean return values to exceptions is such a fundamental API change, to which all software using genfit must be adapted.

It would be nice if it would be possible to either:

  • Release a version with a fixed API, so it can be packaged and we can tell collaborators to use that version in combination with a version of our software.
  • Add a macro with a version / version string to some header, so we can use IFDEF's in our code.

Of course, having both would be best, but at least having the version string which you could bump for any fundamental API breakage would be cool and easy to get.
For inspiration, you may check RVersion.h of ROOT:

#define ROOT_VERSION_CODE 336420
#define ROOT_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

They also offer some additional stuff which cmake fills (you could even automate that and e.g. use the "date" of the latest commit as version string, not nice, but the least effort if you don't want to think about versions).

Cheers,
Oliver

Install prefix needs fixed

I wasted a day trying to figure out why it wasn't installing into /usr/local when building a container image even when explicitly set.

Please remove the lines in cmake/settings.cmake that prevent this!

This is breaking a convention that has been around for 2 or more decades.

Genfit 2 (54c53d9) does not build on Ubuntu 16.04

Hi!

I currently try to install Genfit on Ubuntu 16.04 xenial, x86_64 Linux 4.4.0-64-generic. I have cmake 3.5.1, ROOT 5.34/30 and ibboost-dev 1.58.0.1ubuntu1 installed and follow the README instructions.

Here's what I get:
cmake ..
[...]
-- Build files have been written to...

make
[ 14%] Building CXX object CMakeFiles/genfit2.dir/GBLRootDict.cc.o
In file included from /home/bielefeldt/genfit2/GBL/include/GFGbl.h:34:0,
                 from /home/bielefeldt/genfit2/build/GBLRootDict.h:34,
                 from /home/bielefeldt/genfit2/build/GBLRootDict.cc:17:
/usr/include/c++/5/sstream:300:7: error: ‘struct std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::__xfer_bufptrs’ redeclared with different access
       struct __xfer_bufptrs
       ^
CMakeFiles/genfit2.dir/build.make:236: recipe for target 'CMakeFiles/genfit2.dir/GBLRootDict.cc.o' failed
make[2]: *** [CMakeFiles/genfit2.dir/GBLRootDict.cc.o] Error 1
CMakeFiles/Makefile2:387: recipe for target 'CMakeFiles/genfit2.dir/all' failed
make[1]: *** [CMakeFiles/genfit2.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Is there anything I do incorrectly? Iirc, I installed Genfit the same way recently, and it worked (might have been Ubuntu 16.10, I can't check this unfortunately).

BTW: /build/GBLRootDict.cc:17 is
#include "GBLRootDict.h"

Thanks for any replies!

Update
I checked on the other machine … It's Ubuntu 16.04, too, but I had the check-out from the svn. The git repo doesn't compile here, too (same error). Anyone knows why?

Fitter Test for Electron Fit

There was a recent bug report concerning the material effects of electrons which is fixed now. Would be nice to have a fitter test for this case, as electrons are special due to Bremsstrahlung.

std::thread with `AbsKalmanFitter::process()` ?

Hi. I am a GENFIT2 user working on COMET Phase-1 (Cylindrical Drift Chamber).
What I am trying to do recently is applying multi-thread method in DAF fitting for a cpu-level parallelization.
In detail, I have several sets of candidate hits for an event, and some of hits of each set might be noise.
I want to check the their qualities (Chi^2 and NDF) fast using the std::thread in C++. Therefore, each thread fits each set of hits.

However, I encountered the segfault in DAF::process() in retreiving the B-field or geometry information during RKTrackExtrapoltion (for exampe, see the log below for B-field error.)

I roughly guess it is because ROOT is not thread-safe for some classes still, but not quite sure
Is there any developer who has tried std::thread in GENFIT2 or know how to avoid the errors?

Broken default installation directories

Currently, lib and include are hardcoded.
This breaks on multilib-systems, which usually have lib32 and lib64.
For that reason, common practice in CMake is to use something like:

include(GNUInstallDirs)
INSTALL(TARGETS someBinary
	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

etc.

Code Style

Does GenFit follow any specific code style?

Expand GFRaveInterface

Currently, the GFRaveInterface only supports one hypothesis. Should be adapted that e.g. also electron fits are possible.

[Regression] Compilation error using gcc 4.9

Since the recent commit:
4d7fe0f
genfit2 does not compile for me on a gcc 4.9 based system anymore:

/var/tmp/portage/sci-physics/genfit-9999/work/genfit-9999/test/unitTests/main.cc:74:12: error: ‘constexpr bool std::isnan(double)’ conflicts with a previous declaration
 using std::isnan;
            ^
In file included from /usr/include/features.h:365:0,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/x86_64-pc-linux-gnu/bits/c++config.h:430,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/iostream:38,
                 from /var/tmp/portage/sci-physics/genfit-9999/work/genfit-9999/test/unitTests/main.cc:1:
/usr/include/bits/mathcalls.h:234:1: note: previous declaration ‘int isnan(double)’
 __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
 ^

Importing isnan from std into the global namespace of course makes it collide with the existing definition indirectly included via iostream (at least in the headers shipped with gcc 4.9.3).

I suggest as a fix to drop the using std::isnan again, and just change the single use of isnan in unitTests/main.cc to explicitly use std::isnan.

Event display

Hello,
I am having issues with event display on two machines. Both running ubuntu 15.10 with different graphics drivers.
When I run minimalFittingExample everything seems to go just fine, however, as soon as I touch the graphics (opengl EVE display) it crashes. That is as soon as I try to rotate or zoom it crashes. Below is the debug output. I am not sure if this is a bug in genfit, root, or the opengl library.

`#6 strlen () at ../sysdeps/x86_64/strlen.S:106
#7 0x00007f3fc9b9581c in llvm::MemoryBuffer::getMemBufferRef() const () from /usr/lib/x86_64-linux-gnu/libLLVM-3.6.so.1
#8 0x00007f3fc9c39bbb in llvm::MCJIT::generateCodeForModule(llvm::Module*) () from /usr/lib/x86_64-linux-gnu/libLLVM-3.6.so.1
#9 0x00007f3fc9c37833 in llvm::MCJIT::finalizeObject() () from /usr/lib/x86_64-linux-gnu/libLLVM-3.6.so.1
#10 0x00007f3fc9c33a47 in LLVMGetPointerToGlobal () from /usr/lib/x86_64-linux-gnu/libLLVM-3.6.so.1
#11 0x00007f3fcb9be5d9 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#12 0x00007f3fcb9bfb95 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#13 0x00007f3fcb8fadef in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#14 0x00007f3fcb8f3c0a in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#15 0x00007f3fcb8f4169 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#16 0x00007f3fcb7b110b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#17 0x00007f3fcb78498a in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#18 0x00007f3fcb76b21c in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#19 0x00007f3fcb7817d3 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#20 0x00007f3fcb661b9b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#21 0x00007f3fdd9c0ed4 in TEveStraightLineSetGL::DirectDraw (this=, rnrCtx=...) at /home/whit/builds/root-6.06.00/graf3d/eve/src/TEveStraightLineSetGL.cxx:155
#22 0x00007f3fdac30b24 in TGLPhysicalShape::Draw (this=0x72157d0, rnrCtx=...) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLPhysicalShape.cxx:409
#23 0x00007f3fdabfdb92 in TGLScene::RenderElements (this=, rnrCtx=..., elVec=std::vector of length 60, capacity 64 = {...}, check_timeout=true, clipPlanes=0x0) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLScene.cxx:916
#24 0x00007f3fdabfe0a4 in TGLScene::RenderAllPasses (this=0x5b4b340, rnrCtx=..., elVec=std::vector of length 60, capacity 64 = {...}, check_timeout=true) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLScene.cxx:815
#25 0x00007f3fdaca8351 in TGLViewerBase::SubRenderScenes (this=0x5b5f9c0, render_foo=&virtual table offset 144) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLViewerBase.cxx:411
#26 0x00007f3fdaca85f4 in TGLViewerBase::RenderOpaque (this=0x5b5f9c0, rnr_non_selected=, rnr_selected=) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLViewerBase.cxx:492
#27 0x00007f3fdaca7d37 in TGLViewerBase::Render (this=0x5b5f9c0) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLViewerBase.cxx:425
#28 0x00007f3fdaca2e01 in TGLViewer::DoSelect (this=0x5b5f9b0, x=1, y=5) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLViewer.cxx:1338
#29 0x00007f3fdaca304e in TGLViewer::RequestSelect (this=, x=, y=) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLViewer.cxx:1309
#30 0x00007f3fdac1b4d7 in TGLEventHandler::SelectForClicked (this=0x5b6c700, event=0x7ffd46ad47c0) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLEventHandler.cxx:129
#31 0x00007f3fdac1d731 in TGLEventHandler::HandleButton (this=0x5b6c700, event=0x7ffd46ad47c0) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLEventHandler.cxx:643
#32 0x00007f3fdabde28f in TGLWidget::HandleButton (this=0x5b713b0, ev=0x7ffd46ad47c0) at /home/whit/builds/root-6.06.00/graf3d/gl/src/TGLWidget.cxx:596
#33 0x00007f3fdd4b6dff in TGFrame::HandleEvent (this=0x5b713b0, event=0x7ffd46ad47c0) at /home/whit/builds/root-6.06.00/gui/gui/src/TGFrame.cxx:500
#34 0x00007f3fdd437d68 in TGClient::HandleEvent (this=0x366f8c0, event=0x7ffd46ad47c0) at /home/whit/builds/root-6.06.00/gui/gui/src/TGClient.cxx:841
#35 0x00007f3fdd438085 in TGClient::ProcessOneEvent (this=0x366f8c0) at /home/whit/builds/root-6.06.00/gui/gui/src/TGClient.cxx:651
#36 0x00007f3fdd4380ed in TGClient::HandleInput (this=0x366f8c0) at /home/whit/builds/root-6.06.00/gui/gui/src/TGClient.cxx:698
#37 0x00007f3fdf540298 in TUnixSystem::DispatchOneEvent (this=0x19e84f0, pendingOnly=) at /home/whit/builds/root-6.06.00/core/unix/src/TUnixSystem.cxx:1046
#38 0x00007f3fdf4a24e4 in TSystem::InnerLoop (this=0x19e84f0) at /home/whit/builds/root-6.06.00/core/base/src/TSystem.cxx:407
#39 0x00007f3fdf4a085f in TSystem::Run (this=0x19e84f0) at /home/whit/builds/root-6.06.00/core/base/src/TSystem.cxx:357
#40 0x00007f3fdf45261f in TApplication::Run (this=0x22ee010, retrn=) at /home/whit/builds/root-6.06.00/core/base/src/TApplication.cxx:1145
#41 0x00007f3fe0070799 in genfit::EventDisplay::open (this=0x3341fc0) at /home/whit/projects/GenFit/eventDisplay/src/EventDisplay.cc:266

`

RKTrackRep::setPosMom - momentum is 0 error, when using multiple reps per track

Dear GENFIT experts,

I would like to have your opinion on the issue, which I experienced trying to use multiple representations per track.
Below there is the code, which I use to create tracks with multiple reps:

genfit::AbsTrackRep* rep = new genfit::RKTrackRep(2212);
    genfit::MeasuredStateOnPlane stateRef(rep);
    std::vector<genfit::AbsTrackRep*> vecReps;
    rep->setPosMomCov(stateRef, pos, mom, covM);

pos, mom, covM are defined previously and correctly according to the FitterTests example.

TVectorD seedState(6);
    TMatrixDSym seedCov(6);
    genfit::Track* fitTrack = nullptr;
    
    vecReps.push_back(new genfit::RKTrackRep(211)); // pi+
    vecReps.push_back(new genfit::RKTrackRep(-211)); // pi-
    vecReps.push_back(new genfit::RKTrackRep(2112)); // neutrons
    vecReps.push_back(new genfit::RKTrackRep(11)); // electrons
    vecReps.push_back(new genfit::RKTrackRep(-11)); // positrons

   genfit::MeasuredStateOnPlane stateIref;

    rep->get6DStateCov(stateRef, seedState, seedCov);
    fitTrack = new genfit::Track(rep->clone(), seedState, seedCov);
    if (!vecReps.empty()) {
            for (auto &irep : vecReps) {
                stateIref = genfit::MeasuredStateOnPlane(irep);
                irep->setPosMomCov(stateIref, pos, mom, covM);
                fitTrack->addTrackRep(irep->clone());
            }
     }

I am skipping the part, where I insert trackPoints, because it should not be relevant for this issue. In the end I perform a fit.
In the end, I do the fit:

fitTrack->checkConsistency();
  fitter->processTrack(fitTrack);

The fitter is defined as:

const int nIter = 20; 
  const double dPVal = 1.E-3; 
  genfit::AbsKalmanFitter* fitter = new genfit::KalmanFitterRefTrack(nIter, dPVal);

However only cardinal representation is fitted properly. For other reps I receive this error after calling processTrack():

genfit::Exception thrown with excString:
RKTrackRep::setPosMom - momentum is 0
in line: 1097 in file: /Users/dasukhon/Documents/GENFIT2/GenFit-02-00-00/trackReps/src/RKTrackRep.cc
with fatal flag 0

What are your thoughts about this situation? Please, tell me if I did something wrongly, when I wanted to add multiple reps to a track.

Thank you!
Best regards,
Daniil Sukhonos

memory leak

Hi everyone, we're trying to use Genfit as our tracking package in a local experiment. The package works well but we've found some problem with memory. We use Genfit as below, which is directly derived from example codes:

.h:

class KalmanFitting : public Fitting
{
public:
//................................................................................//
//Constructor
    KalmanFitting() {}
    KalmanFitting(const TrkHitPVec &track, std::initializer_list<double>);
    ~KalmanFitting()
    {
        delete measurement; measurement = nullptr;
        delete fitter; fitter = nullptr;
    };

    KalmanFitting(const KalmanFitting&) = delete;
    KalmanFitting& operator =(const KalmanFitting&) = delete;

//................................................................................//
//Processor
    virtual void Init(const TrkHitPVec &track, std::initializer_list<double>) override;
    virtual void Fit (const TrkHitPVec &track, std::initializer_list<double>) override;
    virtual void Fill(const TrkHitPVec &track, std::initializer_list<double>) override;

//................................................................................//
//Get
    virtual double GetPx() const override {return px;}
    virtual double GetPy() const override {return py;}
    virtual double GetPz() const override {return pz;}
    virtual double GetPp() const override {return pp;}
    virtual double GetPl() const override {return pl;}

    virtual double GetChi2() const override {return fChi2;}
    virtual double GetXSigma() const override {return xSigma;}
    virtual double GetYSigma() const override {return ySigma;}

    int GetSign(const TrkHitPVec &track);

private:
//................................................................................//
//Method specific
    genfit::AbsTrackRep *rep = nullptr;
    genfit::AbsKalmanFitter *fitter = nullptr;
    genfit::Track *fitTrack = nullptr;

    genfit::PlanarMeasurement *measurement = nullptr;

    TVector3 pos;
    TVector3 mom;
    TMatrixDSym hitCov;
};

.cpp:

//................................................................................//
//Constructor
KalmanFitting::KalmanFitting(const TrkHitPVec &track, std::initializer_list<double> list) : hitCov(2)
{
    try
    {
        if(track.size() < 3) throw -1;

        Init(track, list);
        Fit (track, {});
        Fill(track, {});
    }
    catch(int e)
    {
        std::cerr << "Less than 3 hits" << std::endl;

        auto it = list.begin();
        double preR = *it; it++;
        double B = *it;
        pp = 0.3*B*preR;
    }
    catch(genfit::Exception& e)
    {
        std::cerr << e.what();
        std::cerr <<"Exception, next track" << std::endl;

        auto it = list.begin();
        double preR = *it; it++;
        double B = *it;
        pp = 0.3*B*preR;
    }
}

//................................................................................//
//Processor
//................................................................................//
//Initialize the fitter, set up magnetic, material manager, track representation, fitter and track model
//void KalmanFitting::Init(const TrkHitPVec &track, double preR, double B)
void KalmanFitting::Init(const TrkHitPVec &track, std::initializer_list<double> list)
{
    auto it = list.begin();
    double preR = *it; it++;
    double B = *it;

    int pdg = -GetSign(track)*11;              //pdg id, e- hypothesis
    pos = TVector3((*track.at(0)).GetU()*0.1,  //pre fitting results --postion,  mm->cm
                   (*track.at(0)).GetV()*0.1,  //
                   (*track.at(0)).GetZ()*0.1); //
    mom = TVector3(0, 0, 0.3*B*preR*0.001);   //                    --momentum, MeV->GeV
    hitCov.UnitMatrix();                       //covariance matrix
    hitCov(0, 0) = 0.0006*0.0006;              //resolution, cm --x 6µm
    hitCov(1, 1) = 0.006*0.006;                //               --y 60µm

    genfit::MaterialEffects::getInstance()->init(new genfit::TGeoMaterialInterface());
    genfit::FieldManager::getInstance()->init(new genfit::ConstField(0., B*10., 0.)); //Magnet, T->kGs

    rep = new genfit::RKTrackRep(pdg);
    fitter = new genfit::KalmanFitterRefTrack();
    //fitter = std::make_unique<genfit::KalmanFitterRefTrack>();
    fitTrack = new genfit::Track(rep, pos, mom);
}

//................................................................................//
//Do the fit
void KalmanFitting::Fit(const TrkHitPVec &track, std::initializer_list<double>)
{
    //Create vitual detector planes and fill the track
    int detId = 0;   //virtual detector
    int planeId = 0; //virtual plane
    int hitId = 0;
    TVectorD hitCoords(2);
    //genfit::PlanarMeasurement* measurement = nullptr;
    for(int i = 0; i < static_cast<int>(track.size()); i++)
    {
        hitCoords[0] = 0.1*(*track.at(i)).GetU();
        hitCoords[1] = 0.1*(*track.at(i)).GetV();
        //virtual plane
        measurement = new genfit::PlanarMeasurement(hitCoords,
                                                    hitCov,
                                                    detId,
                                                    ++hitId,
                                                    nullptr);  //TrackPoint* trackPoint
        measurement->setPlane(genfit::SharedPlanePtr(new genfit::DetPlane(TVector3(0.,          //origin vector
                                                                                   0.,
                                                                                   (*track.at(i)).GetZ()*0.1),
                                                                          TVector3(1, 0, 0),   //spanning vector u
                                                                          TVector3(0, 1, 0))), //spanning vector v
                                                                          ++planeId);
        fitTrack->insertPoint(new genfit::TrackPoint(measurement, fitTrack));
    }

    //check
    fitTrack->checkConsistency();
    //fit
    fitter->processTrack(fitTrack);
}

//Fill results
void KalmanFitting::Fill(const TrkHitPVec &track, std::initializer_list<double>)
{
    fitTrack->getFittedState().getPosMomCov(pos, mom, hitCov);
    px = mom.Px()*1000;                                     //GeV->MeV
    py = mom.Py()*1000;                                     //
    pz = mom.Pz()*1000;                                     //
    pp = sqrt(mom.Pz()*mom.Pz() + mom.Px()*mom.Px())*1000.; //
    pl = mom.Py()*1000;                                     //

    double bChi2;
    double bNdf;
    double fNdf;
    fitter->getChiSquNdf(fitTrack, rep, bChi2, fChi2, bNdf, fNdf);
    //std::cout << bChi2 << std::endl;

    genfit::TrackPoint* tp = fitTrack->getPointWithMeasurementAndFitterInfo(0, rep);
    genfit::KalmanFittedStateOnPlane kfsop(*(static_cast<genfit::KalmanFitterInfo*>(tp->getFitterInfo(rep))->getBackwardUpdate()));
    genfit::SharedPlanePtr plane(new genfit::DetPlane(TVector3(0.,
                                                               0.,
                                                               (*track.at(0)).GetZ()*0.1),
                                                      TVector3(1, 0, 0),
                                                      TVector3(0, 1, 0)));
    rep->extrapolateToPlane(kfsop, plane);
    const TVectorD& state = kfsop.getState();
    //std::cout << "dimension of state: " << state.GetNoElements() << std::endl;
    //std::cout << "momemtum error: " << 1/abs(state[0])*1000 - sqrt(pp*pp + pl*pl) << std::endl;
    xSigma = state[3]*10 - (*track.at(0)).GetX();
    //std::cout << "position error: " << xSigma << std::endl;
    ySigma = state[4]*10 - (*track.at(0)).GetY();

    delete tp; tp = nullptr;
}

//................................................................................//
//Get
//................................................................................//
//Calculate sign of charge of input track
int KalmanFitting::GetSign(const TrkHitPVec &track)
{
    double xl  = track.at(track.size() - 1)->GetU();
    double xlr = track.at(track.size() - 2)->GetU();
    double xr  = track.at(0)->GetU();
    double xrl = track.at(1)->GetU();

    double zl  = track.at(track.size() - 1)->GetZ();
    double zlr = track.at(track.size() - 2)->GetZ();
    double zr  = track.at(0)->GetZ();
    double zrl = track.at(1)->GetZ();

    //for(auto hit : track) std::cout << hit->GetZ() << std::endl;

    //std::cout << "xl: " << xl << "    xr: " << xr << std::endl;

    if(zr < zl)
    {
        std::swap(xl,  xr );
        std::swap(xlr, xrl);
        std::swap(zl,  zr );
        std::swap(zlr, zrl);
    }

    int s = 0;
    s = (xr - xrl)/sqrt((xr - xrl)*(xr - xrl) + (zr - zrl)*(zr - zrl)) >
        (xlr - xl)/sqrt((xl - xlr)*(xl - xlr) + (zl - zlr)*(zl - zlr)) ? 1 : -1;
    //std::cout << "s: " << s << std::endl;
    return s;
}

The class track is a collection of self-defined TObject TrkHit, which stores basic information of a hit. It's simply passed into the fitter by reference and only some double values of coordinate are copied.

We can locate the memory leak at fitters/src/KalmanFitterRefTrack.cc, line 689:

referenceState = new ReferenceStateOnPlane(stateToExtrapolate->getState(),
             stateToExtrapolate->getPlane(),
             stateToExtrapolate->getRep(),
             stateToExtrapolate->getAuxInfo());

It seems a new share of memory is allocated but the old one which is passed to prevReferenceState and some other objects is not managed correctly. We then tried to substitute it with smart pointor. While compiling succeeded, error catched by fitTrack->checkConsistency(). It failed to find a reference plane.

Could you please help us fix the memory problem, or give us a better example? Thanks.

Energy loss

Hi everyone, this is not an issue per se but a question I didn't know where to ask. I have implemented GENFIT within our data analysis frame for heavy ion tracking at low energy. To have a satisfactory performance I would need to implement a different way to treat the energy loss. I would appreciate any guidance in how to modify the code to add alternative parameterizations and also to understand how and where the energy loss function is called.

Drop ROOT5 support

The ROOT5 CINT does not work well with modern C++11. We established C++11 as the default in the project, so we will drop ROOT5, because it starts to make troubles when used with Eigen.

assert( Track::checkConsistency() ) doesn't work

Hi!

Thanks to PR #81, now building with RAVEPATH works for me. However, I can't compile the tests. make tests will result in the following output:

[ 83%] Built target genfit2
Scanning dependencies of target vertexingTest
[ 84%] Building CXX object CMakeFiles/vertexingTest.dir/test/vertexingTest/main.cc.o
In file included from …/core/include/MeasurementProducer.h:30:0,
                 from  …/core/include/MeasurementFactory.h:28,
                 from …/core/include/Track.h:29,
                 from …/test/vertexingTest/main.cc:6:
…/test/vertexingTest/main.cc: In function ‘int main()’:
…/test/vertexingTest/main.cc:173:41: error: could not convert ‘trackPtr->genfit::Track::checkConsistency()’ from ‘void’ to ‘bool’
       assert(trackPtr->checkConsistency());
                                         ^
…/test/vertexingTest/main.cc:186:41: error: could not convert ‘trackPtr->genfit::Track::checkConsistency()’ from ‘void’ to ‘bool’
       assert(trackPtr->checkConsistency());
                                         ^
make[3]: *** [CMakeFiles/vertexingTest.dir/test/vertexingTest/main.cc.o] Error 1
make[2]: *** [CMakeFiles/vertexingTest.dir/all] Error 2
make[1]: *** [CMakeFiles/tests.dir/rule] Error 2
make: *** [tests] Error 2

The cause seems to be that Track::checkConsistency() is of type void.

Documentation link?

There is no documentation link in the readme. Certainly it exists somewhere?

Circular path when installing with RAVE

Hi!
There is a minor problem with CMakeLists.txt and its install target that reveals when GenFit is configured with both inatall prefix (CMAKE_INSTALL_PREFIX) and RAVEPATH being set. It appears on the installation stage, like following near-infinite installation log:

$ make install
...
-- Installing: /prefix/include/
-- Installing: /prefix/include/rave
...
-- Installing: /prefix/include/include
-- Installing: /prefix/include/include/rave
...
-- Installing: /prefix/include/include/include
-- Installing: /prefix/include/include/include/rave
...

The point is ${Rave_INCLUDE_DIRS_STR} is substituted into GF_INC_DIRS list that further becomes the subject of install target.
Fix that one can consider is pretty straightforward: put the if(DEFINED RAVE)-clause after INSTALL(DIRECTORY ${GF_INC_DIRS} ... in the main CMakeLists.txt. Otherwise CMake assumes RAVE include dirs being the subject of GenFit installation as well.

Thanks!

Clean up includes in header files

To gain faster compile times:

  • Remove obsolete includes in header files
  • Replace includes with forward declaration in header files

Bonus:

  • Remove obsolete includes in source files

momentum direction from GblFitter

Dear Genfit developers,

I encountered the following behavior of GblFitter:
When fitting a Track with GblFitter, in case the DetPlane normal vector is opposite to the particle flight direction (as defined by the seed values), the fitted momentum on this plane has a wrong sign.

Is it a bug, or the expected behavior?

Here is a code that reproduces the case:
https://github.com/IuriiSorokin/simple_gbl_fit/
There I fit a Track to five PlanarMeasurements. The PlanarMeasurements are defined on the DetPlanes:

DetPlane( {0,0,10}, { 1, 0, 0}, {0, 1, 0} )
DetPlane( {0,0,30}, {-1, 0, 0}, {0, 1, 0} ) <-- notice the u-vector
DetPlane( {0,0,50}, { 1, 0, 0}, {0, 1, 0} )
DetPlane( {0,0,70}, { 1, 0, 0}, {0, 1, 0} )
DetPlane( {0,0,90}, { 1, 0, 0}, {0, 1, 0} )

Notice that the second plane is flipped around the y-axis.
The Track is seeded with the position {0, 0, 0}, and the momentum { 0, 0, 0.2 } (i.e. along the z-axis).
The true track position and momentum (used to create the PlanarMeasurements) are {0, 0, 0} and { -0.01, 0, 0.1 } respectively.

There is a uniform magnetic field { 0, 1, 0 }.

After fitting I get the following momenta on the DetPlanes, respectively:

{ 0.012301,-0.000022, 0.106242}
{-0.006220, 0.000025,-0.107519} <-- notice the sign
{ 0.000348,-0.000027, 0.108468}
{-0.005769,-0.000029, 0.109111}
{-0.012251,-0.000029, 0.109402}

The values are close to the true ones, except of the sign on the second plane.

I am using Genfit commit 70c408f from Jul 14, 2017

I hope you can help me to clarify this issue.

Thank you in advance,
Iurii

Can't conpile Genfit2: No lib generated

Hi all!

I've (again, sorry) encountered a problem when building Genfit2. I am on CentOS 7, but I use a relatively recent root 6.12/06 and cmake 3.11.2. I assume I have all dependencies. I cloned the version e1dc32c of this repo created a build dir and used cmake, with the following outcome:

build$ cmake ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found global svn revision to be Unversioned directory
.
-- Check for ROOT_CONFIG_EXECUTABLE: /localhome/bielefeldt/allsources/build/bin/root-config
-- Check for ROOT_EXECUTABLE: /localhome/bielefeldt/allsources/build/bin/root
-- Check for ROOT_CINT_EXECUTABLE: /localhome/bielefeldt/allsources/build/bin/rootcling
-- Check for libdl.so: /usr/lib64/libdl.so
Environment variable RAVEPATH is set. Try to build GFRave.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1") 
-- Checking for one of the modules 'rave'
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.5") found components:  doxygen dot 
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- GTest not installed or found -- skip building unittests.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bielefeldt/Genfit2/build

I assume that the missing GTest is acceptable?

But with make, the directories lib/ and bin/ remain empty, resulting in the following:

build$ make
[  1%] Generating coreRootDict.cc, coreRootDict_rdict.pcm, coreRoot.rootmap
[  2%] Generating GFRaveRootDict.cc, GFRaveRootDict_rdict.pcm, GFRaveRoot.rootmap
[  3%] Generating utilitiesRootDict.cc, utilitiesRootDict_rdict.pcm, utilitiesRoot.rootmap
[  3%] Generating trackRepsRootDict.cc, trackRepsRootDict_rdict.pcm, trackRepsRoot.rootmap
[  5%] Generating measurementsRootDict.cc, measurementsRootDict_rdict.pcm, measurementsRoot.rootmap
[  6%] Generating GBLRootDict.cc, GBLRootDict_rdict.pcm, GBLRoot.rootmap
[  7%] Generating fittersRootDict.cc, fittersRootDict_rdict.pcm, fittersRoot.rootmap
[  9%] Generating eventDisplayRootDict.cc, eventDisplayRootDict_rdict.pcm, eventDisplayRoot.rootmap
Scanning dependencies of target genfit2
[ 10%] Building CXX object CMakeFiles/genfit2.dir/GFRaveRootDict.cc.o
[ 11%] Building CXX object CMakeFiles/genfit2.dir/utilitiesRootDict.cc.o
[ 12%] Building CXX object CMakeFiles/genfit2.dir/trackRepsRootDict.cc.o
[ 14%] Building CXX object CMakeFiles/genfit2.dir/measurementsRootDict.cc.o
[ 15%] Building CXX object CMakeFiles/genfit2.dir/GBLRootDict.cc.o
[ 16%] Building CXX object CMakeFiles/genfit2.dir/fittersRootDict.cc.o
[ 18%] Building CXX object CMakeFiles/genfit2.dir/eventDisplayRootDict.cc.o
[ 19%] Building CXX object CMakeFiles/genfit2.dir/coreRootDict.cc.o
In file included from /home/bielefeldt/Genfit2/core/include/AbsTrackRep.h:28:0,
                 from /home/bielefeldt/Genfit2/core/include/StateOnPlane.h:28,
                 from /home/bielefeldt/Genfit2/core/include/MeasuredStateOnPlane.h:27,
                 from /home/bielefeldt/Genfit2/core/include/MeasurementOnPlane.h:27,
                 from /home/bielefeldt/Genfit2/core/include/AbsFitterInfo.h:27,
                 from /home/bielefeldt/Genfit2/build/coreRootDict.cc:47:
/home/bielefeldt/Genfit2/core/include/Material.h:22:9: warning: unused parameter ‘material’ [-Wunused-parameter]
         Material(const Material &material) = default;
         ^
In file included from /home/bielefeldt/Genfit2/build/coreRootDict.cc:60:0:
/home/bielefeldt/Genfit2/core/include/ThinScatterer.h: In constructor ‘genfit::ThinScatterer::ThinScatterer(const SharedPlanePtr&, const genfit::Material&)’:
/home/bielefeldt/Genfit2/core/include/ThinScatterer.h:45:61: note: synthesized method ‘constexpr genfit::Material::Material(const genfit::Material&)’ first required here 
     TObject(), sharedPlane_(sharedPlane), material_(material) {;}
                                                             ^
[ 19%] Building CXX object CMakeFiles/genfit2.dir/GFRave/src/GFRaveConverters.cc.o
[ 20%] Building CXX object CMakeFiles/genfit2.dir/GFRave/src/GFRaveMagneticField.cc.o
[ 22%] Building CXX object CMakeFiles/genfit2.dir/GFRave/src/GFRavePropagator.cc.o
/home/bielefeldt/Genfit2/GFRave/src/GFRavePropagator.cc:51:1: warning: unused parameter ‘orig’ [-Wunused-parameter]
 GFRavePropagator::to ( const rave::Track & orig,
 ^
/home/bielefeldt/Genfit2/GFRave/src/GFRavePropagator.cc:51:1: warning: unused parameter ‘rcyl’ [-Wunused-parameter]
[ 23%] Building CXX object CMakeFiles/genfit2.dir/GFRave/src/GFRaveTrackParameters.cc.o
/home/bielefeldt/Genfit2/GFRave/src/GFRaveTrackParameters.cc:42:1: warning: unused parameter ‘originalState’ [-Wunused-parameter]
 GFRaveTrackParameters::GFRaveTrackParameters(const Track* track, MeasuredStateOnPlane* originalState, double weight, const TVectorD & state6, const TMatrixDSym & cov6x6, bool isSmoothed) :
 ^
/home/bielefeldt/Genfit2/GFRave/src/GFRaveTrackParameters.cc:61:1: warning: unused parameter ‘originalState’ [-Wunused-parameter]
 GFRaveTrackParameters::GFRaveTrackParameters(const Track* track, MeasuredStateOnPlane* originalState, double weight) :
 ^
[ 24%] Building CXX object CMakeFiles/genfit2.dir/GFRave/src/GFRaveVertex.cc.o
[ 25%] Building CXX object CMakeFiles/genfit2.dir/GFRave/src/GFRaveVertexFactory.cc.o
[ 27%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsFinitePlane.cc.o
[ 28%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsFitter.cc.o
[ 29%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsFitterInfo.cc.o
[ 31%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsMeasurement.cc.o
[ 32%] Building CXX object CMakeFiles/genfit2.dir/core/src/AbsTrackRep.cc.o
[ 33%] Building CXX object CMakeFiles/genfit2.dir/core/src/DetPlane.cc.o
[ 35%] Building CXX object CMakeFiles/genfit2.dir/core/src/Exception.cc.o
[ 35%] Building CXX object CMakeFiles/genfit2.dir/core/src/FieldManager.cc.o
[ 36%] Building CXX object CMakeFiles/genfit2.dir/core/src/FitStatus.cc.o
[ 37%] Building CXX object CMakeFiles/genfit2.dir/core/src/IO.cc.o
[ 38%] Building CXX object CMakeFiles/genfit2.dir/core/src/Material.cc.o
[ 40%] Building CXX object CMakeFiles/genfit2.dir/core/src/MeasuredStateOnPlane.cc.o
[ 41%] Building CXX object CMakeFiles/genfit2.dir/core/src/MeasurementOnPlane.cc.o
[ 42%] Building CXX object CMakeFiles/genfit2.dir/core/src/StateOnPlane.cc.o
[ 44%] Building CXX object CMakeFiles/genfit2.dir/core/src/ThinScatterer.cc.o
[ 45%] Building CXX object CMakeFiles/genfit2.dir/core/src/Tools.cc.o
[ 46%] Building CXX object CMakeFiles/genfit2.dir/core/src/Track.cc.o
[ 48%] Building CXX object CMakeFiles/genfit2.dir/core/src/TrackCand.cc.o
[ 49%] Building CXX object CMakeFiles/genfit2.dir/core/src/TrackCandHit.cc.o
[ 50%] Building CXX object CMakeFiles/genfit2.dir/core/src/TrackPoint.cc.o
[ 51%] Building CXX object CMakeFiles/genfit2.dir/eventDisplay/src/EventDisplay.cc.o
[ 51%] Building CXX object CMakeFiles/genfit2.dir/fields/src/ConstField.cc.o
[ 53%] Building CXX object CMakeFiles/genfit2.dir/finitePlanes/src/RectangularFinitePlane.cc.o
[ 54%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/AbsKalmanFitter.cc.o
[ 55%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/DAF.cc.o
[ 57%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFitStatus.cc.o
[ 58%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFittedStateOnPlane.cc.o
[ 59%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFitter.cc.o
[ 61%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFitterInfo.cc.o
[ 62%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/KalmanFitterRefTrack.cc.o
[ 63%] Building CXX object CMakeFiles/genfit2.dir/fitters/src/ReferenceStateOnPlane.cc.o
[ 64%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/BorderedBandMatrix.cc.o
[ 66%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GFGbl.cc.o
/home/bielefeldt/Genfit2/GBL/src/GFGbl.cc:326:6: warning: unused parameter ‘resortHits’ [-Wunused-parameter]
 void GFGbl::processTrackWithRep(Track* trk, const AbsTrackRep* rep, bool resortHits)
      ^
[ 67%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblData.cc.o
[ 67%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblFitter.cc.o
[ 68%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblFitterInfo.cc.o
[ 70%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblPoint.cc.o
[ 71%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/GblTrajectory.cc.o
[ 72%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/MilleBinary.cc.o
[ 74%] Building CXX object CMakeFiles/genfit2.dir/GBL/src/VMatrix.cc.o
/home/bielefeldt/Genfit2/GBL/src/VMatrix.cc: In member function ‘unsigned int gbl::VSymMatrix::invert()’:
/home/bielefeldt/Genfit2/GBL/src/VMatrix.cc:397:13: warning: declaration of ‘j’ shadows a previous local [-Wshadow]
    for (int j = 1; j <= nSize; ++j) { // elimination
             ^
/home/bielefeldt/Genfit2/GBL/src/VMatrix.cc:368:7: warning: shadowed declaration is here [-Wshadow]
   int j = first;
       ^
/home/bielefeldt/Genfit2/GBL/src/VMatrix.cc:434:13: warning: declaration of ‘k’ shadows a previous local [-Wshadow]
    for (int k = 1; k <= nSize; ++k) {
             ^
/home/bielefeldt/Genfit2/GBL/src/VMatrix.cc:365:7: warning: shadowed declaration is here [-Wshadow]
   int k = 0;
       ^
/home/bielefeldt/Genfit2/GBL/src/VMatrix.cc:437:15: warning: declaration of ‘j’ shadows a previous local [-Wshadow]
      for (int j = 1; j <= nSize; ++j) {
               ^
/home/bielefeldt/Genfit2/GBL/src/VMatrix.cc:368:7: warning: shadowed declaration is here [-Wshadow]
   int j = first;
       ^
[ 75%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/FullMeasurement.cc.o
[ 76%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixPhi.cc.o
[ 77%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixU.cc.o
[ 79%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixUV.cc.o
[ 80%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixUnit.cc.o
[ 81%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/HMatrixV.cc.o
[ 83%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/PlanarMeasurement.cc.o
[ 84%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/ProlateSpacepointMeasurement.cc.o
[ 84%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/SpacepointMeasurement.cc.o
[ 85%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/WireMeasurement.cc.o
[ 87%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/WireMeasurementNew.cc.o
[ 88%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/WirePointMeasurement.cc.o
[ 89%] Building CXX object CMakeFiles/genfit2.dir/measurements/src/WireTrackCandHit.cc.o
[ 90%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/MaterialEffects.cc.o
[ 92%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/RKTools.cc.o
[ 93%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/RKTrackRep.cc.o
[ 94%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/StepLimits.cc.o
[ 96%] Building CXX object CMakeFiles/genfit2.dir/trackReps/src/TGeoMaterialInterface.cc.o
[ 97%] Building CXX object CMakeFiles/genfit2.dir/utilities/src/HelixTrackModel.cc.o
[ 98%] Building CXX object CMakeFiles/genfit2.dir/utilities/src/MeasurementCreator.cc.o
[100%] Linking CXX shared library lib/libgenfit2.so
c++: error: missing path after ‘-I’
make[2]: *** [lib/libgenfit2.so.2.2.0] Error 1
make[1]: *** [CMakeFiles/genfit2.dir/all] Error 2
make: *** [all] Error 2

Am I doing something wrong? I basically followed your instructions/the travis config. Is there maybe a problem with the provided CMakeList?

compilation in ubuntu 22.04

Hello everyone, thanks to be here.

I have a problem in the installation, doing the cmake. I think it cannot find a good version of root CERN.
Before launching the command, I sourced a thisroot.sh (v6.30.04) installed via snap.

Thank you !

I get this :

etiennedupont@dell-PowerEdge-R740:/fair_install/genfitInstall/build$ cmake -DCMAKE_INSTALL_PREFIX=/fair_install/GenFit -DCMAKE_PREFIX_PATH=~/fair_install/FairSoft/ -DBUILD_TESTING=OFF ~/fair_install/GenFit/
CMake Deprecation Warning at CMakeLists.txt:1 (CMAKE_MINIMUM_REQUIRED):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.

Update the VERSION argument value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found global svn revision to be Unversioned directory
.
-- Check for ROOT_CONFIG_EXECUTABLE: /snap/root-framework/931/usr/local/bin/root-config
CMake Error at cmake/FindROOT.cmake:128 (MATH):
MATH cannot parse the expression: "6.30.0410000 + 6.30.04100 + 6.30.04":
syntax error, unexpected exp_NUMBER, expecting end of file (5).
Call Stack (most recent call first):
CMakeLists.txt:34 (FIND_PACKAGE)

-- Check for ROOT_EXECUTABLE: /snap/root-framework/931/usr/local/bin/root
-- Check for ROOT_CINT_EXECUTABLE: /snap/root-framework/931/usr/local/bin/rootcling
-- Check for libdl.so: /usr/lib/x86_64-linux-gnu/libdl.a
-- No RAVEPATH or Rave flags given. GFRave will not be built.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Doxygen not installed or found -- API documentation can't be generated!
-- Configuring incomplete, errors occurred!
See also "/home/etiennedupont/fair_install/genfitInstall/build/CMakeFiles/CMakeOutput.log".
etiennedupont@dell-PowerEdge-R740:~/fair_install/genfitInstall/build$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.