Browse Source

Latest version of P. Batyuk's code

Petr Parfenov 2 years ago
commit
5c769ad61e
100 changed files with 35266 additions and 0 deletions
  1. 55 0
      .gitignore
  2. 199 0
      .gitlab-ci.yml
  3. 3 0
      .gitmodules
  4. 35 0
      CDash_Env_MpdRoot.sh
  5. 47 0
      CDash_ShortHelp.txt
  6. 33 0
      CDash_Test.sh
  7. 280 0
      CMakeLists.txt
  8. 291 0
      CMakeListst_new.txt
  9. 10 0
      CTestConfig.cmake
  10. 131 0
      CTestCustom.cmake
  11. 141 0
      Dart.sh
  12. 231 0
      INSTALL
  13. 25 0
      INSTALL.JINR
  14. 111 0
      KFParticle/CMakeLists.txt
  15. 28 0
      KFParticle/KFLinkDef.h
  16. 176 0
      KFParticle/KFParticle/KFPEmcCluster.cxx
  17. 123 0
      KFParticle/KFParticle/KFPEmcCluster.h
  18. 370 0
      KFParticle/KFParticle/KFPInputData.h
  19. 109 0
      KFParticle/KFParticle/KFPSimdAllocator.h
  20. 84 0
      KFParticle/KFParticle/KFPTrack.cxx
  21. 220 0
      KFParticle/KFParticle/KFPTrack.h
  22. 412 0
      KFParticle/KFParticle/KFPTrackVector.cxx
  23. 396 0
      KFParticle/KFParticle/KFPTrackVector.h
  24. 20 0
      KFParticle/KFParticle/KFPVertex.cxx
  25. 124 0
      KFParticle/KFParticle/KFPVertex.h
  26. 492 0
      KFParticle/KFParticle/KFParticle.cxx
  27. 1021 0
      KFParticle/KFParticle/KFParticle.h
  28. 3455 0
      KFParticle/KFParticle/KFParticleBase.cxx
  29. 297 0
      KFParticle/KFParticle/KFParticleBase.h
  30. 4121 0
      KFParticle/KFParticle/KFParticleBaseSIMD.cxx
  31. 341 0
      KFParticle/KFParticle/KFParticleBaseSIMD.h
  32. 98 0
      KFParticle/KFParticle/KFParticleDatabase.cxx
  33. 176 0
      KFParticle/KFParticle/KFParticleDatabase.h
  34. 145 0
      KFParticle/KFParticle/KFParticleDef.h
  35. 190 0
      KFParticle/KFParticle/KFParticleField.h
  36. 3119 0
      KFParticle/KFParticle/KFParticleFinder.cxx
  37. 462 0
      KFParticle/KFParticle/KFParticleFinder.h
  38. 359 0
      KFParticle/KFParticle/KFParticlePVReconstructor.cxx
  39. 107 0
      KFParticle/KFParticle/KFParticlePVReconstructor.h
  40. 1035 0
      KFParticle/KFParticle/KFParticleSIMD.cxx
  41. 1100 0
      KFParticle/KFParticle/KFParticleSIMD.h
  42. 1187 0
      KFParticle/KFParticle/KFParticleTopoReconstructor.cxx
  43. 278 0
      KFParticle/KFParticle/KFParticleTopoReconstructor.h
  44. 139 0
      KFParticle/KFParticle/KFVertex.cxx
  45. 88 0
      KFParticle/KFParticle/KFVertex.h
  46. 119 0
      KFParticle/KFParticlePerformance/KFMCCounter.h
  47. 36 0
      KFParticle/KFParticlePerformance/KFMCParticle.cxx
  48. 102 0
      KFParticle/KFParticlePerformance/KFMCParticle.h
  49. 82 0
      KFParticle/KFParticlePerformance/KFMCTrack.h
  50. 38 0
      KFParticle/KFParticlePerformance/KFMCVertex.cxx
  51. 95 0
      KFParticle/KFParticlePerformance/KFMCVertex.h
  52. 164 0
      KFParticle/KFParticlePerformance/KFPHistogram/KFPHistogram.h
  53. 109 0
      KFParticle/KFParticlePerformance/KFPHistogram/KFPHistogram1D.h
  54. 168 0
      KFParticle/KFParticlePerformance/KFPHistogram/KFPHistogramSet.cxx
  55. 68 0
      KFParticle/KFParticlePerformance/KFPHistogram/KFPHistogramSet.h
  56. 220 0
      KFParticle/KFParticlePerformance/KFPVEfficiencies.h
  57. 16 0
      KFParticle/KFParticlePerformance/KFPartEfficiencies.cxx
  58. 1327 0
      KFParticle/KFParticlePerformance/KFPartEfficiencies.h
  59. 48 0
      KFParticle/KFParticlePerformance/KFPartMatch.h
  60. 1073 0
      KFParticle/KFParticlePerformance/KFParticlePerformanceBase.cxx
  61. 195 0
      KFParticle/KFParticlePerformance/KFParticlePerformanceBase.h
  62. 2181 0
      KFParticle/KFParticlePerformance/KFTopoPerformance.cxx
  63. 162 0
      KFParticle/KFParticlePerformance/KFTopoPerformance.h
  64. 649 0
      KFParticle/MpdKfParticleFinder.cxx
  65. 226 0
      KFParticle/MpdKfParticleFinder.h
  66. 22 0
      KFParticle/Vc/.appveyor.yml
  67. 130 0
      KFParticle/Vc/.clang-format
  68. 77 0
      KFParticle/Vc/.github/CONTRIBUTING.md
  69. 11 0
      KFParticle/Vc/.github/ISSUE_TEMPLATE.md
  70. 9 0
      KFParticle/Vc/.gitignore
  71. 6 0
      KFParticle/Vc/.gitmodules
  72. 131 0
      KFParticle/Vc/.travis.yml
  73. 268 0
      KFParticle/Vc/CMakeLists.txt
  74. 15 0
      KFParticle/Vc/CTestConfig.cmake
  75. 21 0
      KFParticle/Vc/CTestCustom.cmake
  76. 1 0
      KFParticle/Vc/INSTALL
  77. 23 0
      KFParticle/Vc/LICENSE
  78. 172 0
      KFParticle/Vc/README.md
  79. 138 0
      KFParticle/Vc/Test_all_compilers.sh
  80. 22 0
      KFParticle/Vc/Test_vc.sh
  81. 283 0
      KFParticle/Vc/Vc/Allocator
  82. 268 0
      KFParticle/Vc/Vc/IO
  83. 43 0
      KFParticle/Vc/Vc/Memory
  84. 35 0
      KFParticle/Vc/Vc/SimdArray
  85. 44 0
      KFParticle/Vc/Vc/Utils
  86. 43 0
      KFParticle/Vc/Vc/Vc
  87. 1 0
      KFParticle/Vc/Vc/algorithm
  88. 315 0
      KFParticle/Vc/Vc/array
  89. 58 0
      KFParticle/Vc/Vc/avx/README
  90. 305 0
      KFParticle/Vc/Vc/avx/casts.h
  91. 157 0
      KFParticle/Vc/Vc/avx/const.h
  92. 100 0
      KFParticle/Vc/Vc/avx/const_data.h
  93. 124 0
      KFParticle/Vc/Vc/avx/debug.h
  94. 290 0
      KFParticle/Vc/Vc/avx/deinterleave.tcc
  95. 2303 0
      KFParticle/Vc/Vc/avx/detail.h
  96. 119 0
      KFParticle/Vc/Vc/avx/helperimpl.h
  97. 670 0
      KFParticle/Vc/Vc/avx/intrinsics.h
  98. 87 0
      KFParticle/Vc/Vc/avx/limits.h
  99. 33 0
      KFParticle/Vc/Vc/avx/macros.h
  100. 0 0
      KFParticle/Vc/Vc/avx/mask.h

+ 55 - 0
.gitignore

@@ -0,0 +1,55 @@
+# Executables
+*.exe
+*.out
+*.app
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.ko
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+*.lib
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+
+# CMake
+CMakeCache.txt
+CMakeFiles
+Makefile
+cmake_install.cmake
+install_manifest.txt
+
+# CTest
+Testing/
+
+# build directory & data directory
+
+build/
+examples/advanced/Tutorial3/macro/data/*
+!examples/advanced/Tutorial3/macro/data/dummy.txt
+examples/MQ/serialization/data_io/*
+!examples/MQ/serialization/data_io/README.md
+examples/MQ/9-PixelDetector/macros/*.root
+examples/MQ/9-PixelDetector/macros/*.dat
+core_dump*
+gphysi.dat
+FairRunInfo_*
+html/
+
+# diverse
+.DS_Store
+
+#editor tmp files
+.*.swp
+
+# VS Code directory
+.vscode

+ 199 - 0
.gitlab-ci.yml

@@ -0,0 +1,199 @@
+stages:
+ - check_permissions
+ - build
+ - test_runMC
+ - test_run_reco
+ - deploy
+ 
+before_script:
+ - export SIMPATH=/cvmfs/nica.jinr.ru/$OS_TYPE/fairsoft/mpd
+ - export FAIRROOTPATH=/cvmfs/nica.jinr.ru/$OS_TYPE/fairroot/mpd
+ - sed -i "s/\/opt\/fairsoft\/install/\/cvmfs\/nica.jinr.ru\/$OS_TYPE\/fairsoft\/mpd/g" SetEnv.sh
+ - sed -i "s/\/opt\/fairroot\/install/\/cvmfs\/nica.jinr.ru\/$OS_TYPE\/fairroot\/mpd/g" SetEnv.sh
+ - source ./SetEnv.sh
+ 
+variables:
+ GIT_SUBMODULE_STRATEGY: recursive
+ GREEN: '\033[1;32m'
+ RED: '\033[1;31m'
+ NC: '\033[0m'
+
+.only-default: &only-default
+  only:
+    - merge_requests
+    - dev
+    - tags
+
+check_permissions:
+  image: git.jinr.ru:5005/nica/docker-images/centos7/base:latest
+  variables:
+    OS_TYPE: "centos7"
+    PERMISSIONS_MESSAGE_FAUILURE: "Permissions check: ${RED}FAILED${NC}. You don't have permission to change some files, please contact your project maintainers."
+    PERMISSIONS_MESSAGE_SUCCESS: "Permissions check: ${GREEN}PASSED${NC}."
+  before_script:
+    - echo "Skipping global before_script"
+  tags:
+    - docker
+  stage: check_permissions
+  script:
+    - >
+      if git diff HEAD~ --name-only|grep .gitlab-ci.yml; then
+        if grep -q $GITLAB_USER_LOGIN <<< $MAINTAINERS; then echo -e $PERMISSIONS_MESSAGE_SUCCESS $(exit 0); else echo -e $PERMISSIONS_MESSAGE_FAUILURE; $(exit -1); fi
+      fi;
+  allow_failure: false
+  <<: *only-default
+
+.build_template: &build
+  stage: build
+  artifacts:
+    paths:
+      - build
+  script:
+    - mkdir build
+    - cd build
+    - cmake "$CI_PROJECT_DIR"
+    - make -j 5
+  allow_failure: false
+  <<: *only-default
+  
+build:centos:
+  image: git.jinr.ru:5005/nica/docker-images/centos7/base:latest
+  variables:
+    OS_TYPE: "centos7"
+  tags:
+    - docker
+    - cvmfs
+  <<: *build
+
+build:ubuntu:
+  image: git.jinr.ru:5005/nica/docker-images/ubuntu/base:latest
+  variables:
+    OS_TYPE: "ubuntu"
+  tags: 
+    - docker
+    - cvmfs
+  <<: *build 
+  
+.runMC_template: &runMC
+  stage: test_runMC
+  tags:
+    - docker
+    - cvmfs
+  artifacts:
+    paths:
+      - macro/mpd/evetest.root
+  script:
+    - source build/config.sh
+    - root -b -q -l '$CI_PROJECT_DIR/macro/mpd/runMC.C("auau.09gev.mbias.98k.ftn14","$VMCWORKDIR/macro/mpd/evetest.root",0,2)' | tee output.txt
+    - (if grep -q "Macro finished successfully." output.txt; then $(exit 0); else $(exit -1); fi);
+  allow_failure: false
+  <<: *only-default
+  
+runMC:centos:
+  image: git.jinr.ru:5005/nica/docker-images/centos7/base:latest
+  variables:
+    OS_TYPE: "centos7"
+  dependencies:
+    - build:centos
+  <<: *runMC
+
+runMC:ubuntu:
+  image: git.jinr.ru:5005/nica/docker-images/ubuntu/base:latest
+  variables:
+    OS_TYPE: "ubuntu"
+  dependencies:
+    - build:ubuntu
+  <<: *runMC
+  
+.run_reco_template: &run_reco
+  stage: test_run_reco
+  tags:
+    - docker
+    - cvmfs
+  script:
+    - source build/config.sh
+    - root -b -q -l "$CI_PROJECT_DIR/macro/mpd/reco.C" | tee output.txt
+    - (if grep -q "Macro finished successfully." output.txt; then $(exit 0); else $(exit -1); fi);
+  allow_failure: false
+  <<: *only-default
+  
+run_reco:centos:
+  image: git.jinr.ru:5005/nica/docker-images/centos7/base:latest
+  variables:
+    OS_TYPE: "centos7"
+  dependencies:
+    - build:centos
+    - runMC:centos
+  <<: *run_reco
+  
+run_reco:ubuntu:
+  image: git.jinr.ru:5005/nica/docker-images/ubuntu/base:latest
+  variables:
+    OS_TYPE: "ubuntu"
+  dependencies:
+    - build:ubuntu
+    - runMC:ubuntu
+  <<: *run_reco
+  
+.deploy_template: &deploy
+  stage: deploy
+  before_script:
+    - echo "Skipping global before_script"
+  script:
+    - eval $(ssh-agent -s)
+    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add /dev/stdin > /dev/null
+    - mkdir -p ~/.ssh
+    - chmod 700 ~/.ssh
+    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
+    - chmod 644 ~/.ssh/known_hosts
+    - rm -rf /cvmfs/nica.jinr.ru/$CI_ENVIRONMENT_NAME/mpdroot/$CI_COMMIT_REF_NAME
+    - rm -rf build
+    - mkdir build
+    - cd build
+    - | 
+      if [ $CI_ENVIRONMENT_NAME = "sl6" ]; then
+        scl enable python27 sclo-git212 - << \EOF
+        sed -i "s/\/opt\/fairsoft\/install/\/cvmfs\/nica.jinr.ru\/sl6\/fairtest\/fairsoft\/install/g" ../SetEnv.sh
+        sed -i "s/\/opt\/fairroot\/install/\/cvmfs\/nica.jinr.ru\/sl6\/fairtest\/fairroot\/install/g" ../SetEnv.sh
+        source /cvmfs/nica.jinr.ru/sl6/fairtest/AIO_export.sh
+        source ../SetEnv.sh
+        echo "/cvmfs/nica.jinr.ru/$CI_ENVIRONMENT_NAME/mpdroot/$CI_COMMIT_REF_NAME"
+        cmake -DCMAKE_INSTALL_PREFIX=/cvmfs/nica.jinr.ru/$CI_ENVIRONMENT_NAME/mpdroot/$CI_COMMIT_REF_NAME ..
+        make -j 5
+        make install
+      EOF
+      else
+        sed -i "s/\/opt\/fairsoft\/install/\/cvmfs\/nica.jinr.ru\/$CI_ENVIRONMENT_NAME\/fairsoft\/jun19p1/g" ../SetEnv.sh
+        sed -i "s/\/opt\/fairroot\/install/\/cvmfs\/nica.jinr.ru\/$CI_ENVIRONMENT_NAME\/fairroot\/v18.2.0/g" ../SetEnv.sh
+        source ../SetEnv.sh
+        echo "/cvmfs/nica.jinr.ru/$CI_ENVIRONMENT_NAME/mpdroot/$CI_COMMIT_REF_NAME"
+        cmake -DCMAKE_INSTALL_PREFIX=/cvmfs/nica.jinr.ru/$CI_ENVIRONMENT_NAME/mpdroot/$CI_COMMIT_REF_NAME ..
+        make -j 5
+        make install
+      fi;
+    - ssh $STRATUM_0 "sudo cvmfs_server transaction nica.jinr.ru"
+    - rsync --filter='-p .cvmfscatalog' --filter='-p .cvmfsautocatalog' -a /cvmfs/nica.jinr.ru/$CI_ENVIRONMENT_NAME/mpdroot/$CI_COMMIT_REF_NAME $STRATUM_0:/cvmfs/nica.jinr.ru/$CI_ENVIRONMENT_NAME/mpdroot/
+    - ssh $STRATUM_0 "sudo cvmfs_server publish nica.jinr.ru"
+    - ssh-agent -k
+  only:
+    - tags
+    - dev
+  allow_failure: false
+  
+deploy:sl6:
+  image: git.jinr.ru:5005/nica/docker-images/sl6/fair-mpd:latest
+  environment:
+    name: sl6
+  tags:
+    - docker
+    - no-cvmfs
+  <<: *deploy
+  
+deploy:centos7:
+  image: git.jinr.ru:5005/nica/docker-images/centos7/fair:latest
+  environment:
+    name: centos7
+  tags:
+    - docker
+    - no-cvmfs
+  <<: *deploy

+ 3 - 0
.gitmodules

@@ -0,0 +1,3 @@
+[submodule "macro/mpd_scheduler"]
+	path = macro/mpd_scheduler
+	url = https://git.jinr.ru/nica_modules/mpd_scheduler.git

+ 35 - 0
CDash_Env_MpdRoot.sh

@@ -0,0 +1,35 @@
+#!/bin/bash
+
+if [ "$#" -lt "1" ]; then
+  export CDASHUSERPATH=$(pwd)
+else
+  export CDASHUSERPATH=$1
+fi
+
+export SIMPATH=/opt/fairsoft/install
+export FAIRROOTPATH=/opt/fairroot/install
+export SOURCEDIR=$CDASHUSERPATH
+export BUILDDIR=$HOME/CDASH/mpdroot_build_$(hostname -s)
+export LINUX_FLAVOUR=$(uname -o)
+export FAIRSOFT_VERSION=oct17p1
+
+if [ "$#" -gt "1" ]; then
+if [ "$#" -gt "2" ]; then
+export FAIRSOFT_VERSION=$3
+else
+export FAIRSOFT_VERSION=oct17p1
+fi
+export BUILDDIR=$2
+fi
+
+echo "CDASHUSERPATH: " $CDASHUSERPATH
+echo "SIMPATH: " $SIMPATH
+echo "FAIRROOTPATH: " $FAIRROOTPATH
+echo "SOURCEDIR: " $SOURCEDIR
+echo "BUILDDIR: " $BUILDDIR
+echo "LINUX_FLAVOUR: " $LINUX_FLAVOUR
+echo "FAIRSOFT_VERSION: " $FAIRSOFT_VERSION
+
+DARTMACHINE=$(uname -n)
+
+source $BUILDDIR/config.sh

+ 47 - 0
CDash_ShortHelp.txt

@@ -0,0 +1,47 @@
+****************************************
+
+      Short Help for MpdRoot users
+
+      HowTo work with MpdRoot CDash
+
+***************************************
+
+   Current mpdroot version in repository: 512
+
+***************************************
+
+1)  Macro subdirectories for testing are listed the file:
+
+    your_mpdroot_trunk/macro/CMakeLists.txt
+
+    Each subdirectory has own file CMakeLists.txt with the list of tests.
+    You can add more tests if you like.
+    For each test you should add at least 3 lines.
+
+2)  Please, check the file
+
+    your_mpdroot_trunk/CDash_Env_MpdRoot.sh
+
+    and edit path to your build directory if necessary
+
+3)  To check the configuration, type one of these commands:
+
+    a) cd your_mpdroot_trunk
+       ./Dart.sh Experimental  > CDash_test_experimental_1.log 2>&1 &
+
+    b) your_mpdroot_trunk/Dart.sh Experimental your_mpdroot_trunk > CDash_test_experimental_2.log 2>&1 &
+
+    c) your_mpdroot_trunk/Dart.sh Experimental your_mpdroot_trunk your_CDash_Env_MpdRoot.sh > CDash_test_experimental_3.log 2>&1 &
+
+4) In some time the information about your build and tests will be available at 
+
+        http://mpd.jinr.ru/cdash/index.php?project=MpdRoot
+
+5)  To send Nightly builds and tests, use cron daemon (man crontab):
+
+your_mpdroot_trunk/Dart.sh Nightly your_mpdroot_trunk > CDash_test_Nightly.log 2>&1 & 
+
+******************************************
+
+                           litvin@nf.jinr.ru   17-09-2009
+    

+ 33 - 0
CDash_Test.sh

@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# CDASH check script
+#
+
+HOST="$(hostname -s)"
+BRANCH="$(git branch | grep \* | awk '{print $2}')"
+SOURCE_DIR="$HOME/CDASH/mpdroot_$HOST"
+LOG="$HOME/CDASH/LOGS/mpdroot_cdash_$HOST.log"
+
+mkdir -p $HOME/CDASH/LOGS
+
+date +"START TEST %y-%m-%d at %H:%M:%S" > $LOG
+
+if [[ $1 = "Nightly" ]]; then
+	if [ -e "$SOURCE_DIR" ]
+	then
+        	cd $SOURCE_DIR
+		git reset --hard HEAD
+	else
+        	git clone git@git.jinr.ru:nica/mpdroot.git $SOURCE_DIR
+        	cd $SOURCE_DIR
+	fi
+
+	./Dart.sh Nightly >> $LOG 2>&1
+else
+	rm -rf $SOURCE_DIR
+	git clone -b $BRANCH git@git.jinr.ru:nica/mpdroot.git $SOURCE_DIR
+	cd $SOURCE_DIR
+	./Dart.sh Experimental >> $LOG 2>&1
+fi
+
+date +"FINISH TEST %y-%m-%d at %H:%M:%S" >> $LOG

+ 280 - 0
CMakeLists.txt

@@ -0,0 +1,280 @@
+# The name of our project is "MPDROOT".  CMakeLists files in this project can
+# refer to the root source directory of the project as ${MPDROOT_SOURCE_DIR} 
+# or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as 
+# ${MPDROOT_BINARY_DIR} or ${CMAKE_BINARY_DIR}.
+
+# Check if cmake has the required version
+CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)
+
+### CMP0025   Compiler id for Apple Clang is now AppleClang.
+### CMP0042   MACOSX_RPATH is enabled by default.
+
+foreach(p
+  CMP0025 # CMake 3.0
+  CMP0028 # double colon for imported and alias targets
+  CMP0042 # CMake 3.0
+  CMP0054 # Only interpret ``if()`` arguments as variables or keywords when unquoted.
+  )
+  if(POLICY ${p})
+  cmake_policy(SET ${p} NEW)
+  endif()
+endforeach()
+
+# Set name of our project to "MPDROOT". Has to be done
+# after check of cmake version                        
+project(MPDROOT)
+
+#In case you need Fortran
+enable_language(Fortran)
+set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy")
+
+Option(USE_PATH_INFO "Information from PATH and LD_LIBRARY_PATH are used." ON)
+Option(ALIBUILD "Flag if we are building with AliBuild." OFF)
+
+#Check if necessary environment variables are set
+#If not stop execution
+IF (NOT ALIBUILD)
+ IF(NOT DEFINED ENV{FAIRROOTPATH})
+  MESSAGE(FATAL_ERROR "You did not define the environment variable FAIRROOTPATH which is needed to find FairRoot. Please set this variable and execute cmake again.")
+ ENDIF(NOT DEFINED ENV{FAIRROOTPATH})
+ IF(NOT DEFINED ENV{SIMPATH})
+  MESSAGE(FATAL_ERROR "You did not define the environment variable SIMPATH which is nedded to find the external packages. Please set this variable and execute cmake again.") 
+ ENDIF(NOT DEFINED ENV{SIMPATH})
+
+ SET(SIMPATH $ENV{SIMPATH})
+ SET(FAIRROOTPATH $ENV{FAIRROOTPATH})
+ELSE (NOT ALIBUILD)
+  SET(FAIRROOTPATH $ENV{FAIRROOT_ROOT})
+  SET(GEANT3_PATH $ENV{GEANT3_ROOT})
+  SET(BOOST_ROOT $ENV{BOOST_ROOT})
+  SET(GSL_DIR $ENV{GSL_ROOT})
+ENDIF (NOT ALIBUILD)
+
+# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ 
+# is checked
+set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH})
+set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH})
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/KFParticle/Vc/cmake" ${CMAKE_MODULE_PATH})
+
+Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks")
+
+find_package(FairRoot REQUIRED)
+
+# Load some basic macros which are needed later on
+include(FairMacros)
+include(WriteConfigFile)
+include(CTest)
+include(CheckCompiler)
+include(CheckFortran)
+include(InstallNicaFemto)
+include(CreateMpdConfig)
+
+# Set the build type: None, Debug, Release, RelWithDebInfo or MinSizeRel 
+If(NOT CMAKE_BUILD_TYPE)
+  Message("Set BuildType RelWithDebInfo")
+  set(CMAKE_BUILD_TYPE RelWithDebInfo)
+EndIf(NOT CMAKE_BUILD_TYPE)
+
+#Check the compiler and set the compile and link flags
+Check_Compiler()
+#custom flags for build type if you so desire
+#set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g ") # -Wall -Wextra  -std=c++17
+#tune for local cpu: -march=native/rocketlake/znver2 -mtune=znver2
+
+set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
+set(INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
+Set(VMCWORKDIR ${CMAKE_SOURCE_DIR})
+
+If(USE_PATH_INFO)
+  Set(PATH "$PATH")
+  If (APPLE)
+    Set(LD_LIBRARY_PATH $ENV{DYLD_LIBRARY_PATH})
+  Else (APPLE)
+    Set(LD_LIBRARY_PATH $ENV{LD_LIBRARY_PATH})
+  EndIf (APPLE)
+Else(USE_PATH_INFO)
+  STRING(REGEX MATCHALL "[^:]+" PATH $ENV{PATH})
+EndIf(USE_PATH_INFO)
+
+# Check if the user wants to build the project in the source
+# directory and if the install directory is different from the build
+# directory
+CHECK_OUT_OF_SOURCE_BUILD()
+CHECK_INSTALL_DIRECTORY()
+
+# Check if we are on an UNIX system. If not stop with an error
+# message
+IF(NOT UNIX)
+  MESSAGE(FATAL_ERROR "You're not on an UNIX system. The project was up to now only tested on UNIX systems, so we break here. If you want to go on please edit the CMakeLists.txt in the source directory.")
+ENDIF(NOT UNIX)
+
+# Check if the external packages are installed into a separate install
+# directory
+CHECK_EXTERNAL_PACKAGE_INSTALL_DIR()
+
+# searches for needed packages
+# REQUIRED means that cmake will stop if this packages are not found
+# For example the framework can run without GEANT4, but ROOT is
+# mandatory
+find_package(ROOT 6.10.08 REQUIRED)
+find_package(Pythia8)
+find_package(Pythia6)
+find_package(GEANT3 REQUIRED)
+find_package(GEANT4)
+find_package(GEANT4DATA)
+find_package(GEANT4VMC)
+find_package(CLHEP REQUIRED)
+find_package(SSE)
+find_package(PLUTO)
+find_package(GENERATORS REQUIRED)
+find_package(XML2 REQUIRED)
+find_package(FFTW REQUIRED)
+find_package(TDAQ)
+
+#find_package(HEPMC)
+#find_package(CUDA)
+#find_package(IWYU)
+#find_package(ZeroMQ)
+#find_package(Protobuf)
+#find_package(DDS)
+
+IF (NOT ALIBUILD)
+Set(Boost_NO_SYSTEM_PATHS TRUE)
+Set(Boost_NO_BOOST_CMAKE TRUE)
+If(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
+  set(BOOST_ROOT ${SIMPATH})
+  set(GSL_DIR ${SIMPATH})
+Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
+  set(BOOST_ROOT ${SIMPATH}/basics/boost)
+  set(GSL_DIR ${SIMPATH}/basics/gsl)
+EndIf(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
+ENDIF (NOT ALIBUILD)
+Message("-- Looking for Boost ...")
+# If an older version of boost is found both of the variables below are
+# cached and in a second cmake run, a good boost version is found even 
+# if the version is to old. 
+# To overcome this problem both variables are cleared before checking
+# for boost.
+Unset(Boost_INCLUDE_DIR CACHE)
+Unset(Boost_LIBRARY_DIRS CACHE)
+find_package(Boost 1.41)
+If (Boost_FOUND)
+  Set(Boost_Avail 1)
+Else (Boost_FOUND)
+  Set(Boost_Avail 0)
+EndIf (Boost_FOUND)
+
+find_package(GSL REQUIRED)
+
+# set a variable which should be used in all CMakeLists.txt
+# Defines all basic include directories from fairbase
+SetBasicVariables()
+find_package(FairLogger)
+SET(PATH ${EXECUTABLE_OUTPUT_PATH} ${PATH})
+set(MPDROOT TRUE)
+add_definitions(-DMPDROOT)
+
+# Set the library version in the main CMakeLists.txt
+SET(FAIRROOT_MAJOR_VERSION 0)
+SET(FAIRROOT_MINOR_VERSION 0)
+SET(FAIRROOT_PATCH_VERSION 0)
+SET(FAIRROOT_VERSION "${FAIRROOT_MAJOR_VERSION}.${FAIRROOT_MINOR_VERSION}.${FAIRROOT_PATCH_VERSION}")
+SET(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES}
+    VERSION "${FAIRROOT_VERSION}"
+    SOVERSION "${FAIRROOT_MAJOR_VERSION}"
+    SUFFIX ".so"
+)
+
+Generate_Version_Info()
+
+# Recurse into the given subdirectories. This does not actually
+# cause another cmake executable to run. The same process will walk through
+# the project's entire directory structure.
+add_subdirectory (passive)
+add_subdirectory (mpdbase)
+add_subdirectory (mpdfield)
+add_subdirectory (kalman) #MpdBase MpdField
+add_subdirectory (shield_pack)
+add_subdirectory (generators/unigen_format)
+add_subdirectory (generators) # MpdMcDst
+add_subdirectory (mcstack) # MpdGen
+add_subdirectory (mpdpid) # MpdMCStack MpdBase
+add_subdirectory (lhetrack) # MpdBase Kalman Sts Tof
+add_subdirectory (mpddst) # MpdBase LHETrack MpdPid
+
+add_subdirectory (tof) # MpdMCStack Kalman
+add_subdirectory (tpc) # Tof
+add_subdirectory (etof)
+add_subdirectory (zdc)
+add_subdirectory (clustering)
+add_subdirectory (emc) # Cluster
+add_subdirectory (ffd)
+add_subdirectory (sts)
+add_subdirectory (cpc)
+add_subdirectory (bmd)
+add_subdirectory (mcord)
+add_subdirectory (physics) #MpdBase MpdMCStack Kalman MpdPid LHETrack
+add_subdirectory (eventdisplay) #Emc
+
+#add_subdirectory (macro)
+#add_subdirectory (strawendcap)
+#add_subdirectory (strawECT)
+#add_subdirectory (bbc)
+#add_subdirectory (sft)
+#add_subdirectory (stt)
+#add_subdirectory (fsa)
+#add_subdirectory (ndet)
+#add_subdirectory (tgem)
+#add_subdirectory (dch)
+            
+add_subdirectory (KFParticle/Vc)
+add_subdirectory (KFParticle)
+            
+if(EXISTS "${CMAKE_SOURCE_DIR}/macro/mpd_scheduler/CMakeLists.txt")
+ add_subdirectory (macro/mpd_scheduler)
+endif()
+InstallNicaFemto()
+
+Option(BUILD_DOXYGEN "Build Doxygen" OFF)
+if(BUILD_DOXYGEN)
+  MESSAGE(STATUS "*** Building the Doxygen documentaion ***")
+  ADD_SUBDIRECTORY(doxygen)
+endif(BUILD_DOXYGEN)
+
+WRITE_CONFIG_FILE(config.sh)
+
+SET(VMCWORKDIR ${CMAKE_INSTALL_PREFIX})
+SET(ROOT_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include ${ROOT_INCLUDE_PATH})
+WRITE_CONFIG_FILE(install_config.sh)
+
+configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake 
+               ${CMAKE_BINARY_DIR}/CTestCustom.cmake
+              )
+
+# Summary ######################################################################
+if(CMAKE_CXX_FLAGS)
+  message(STATUS "  ")
+  message(STATUS "  ${Cyan}GLOBAL CXX FLAGS${CR}  ${BGreen}${CMAKE_CXX_FLAGS}${CR}")
+endif()
+if(CMAKE_CONFIGURATION_TYPES)
+  message(STATUS "  ")
+  message(STATUS "  ${Cyan}BUILD TYPE         CXX FLAGS${CR}")
+  string(TOUPPER "${CMAKE_BUILD_TYPE}" selected_type)
+  foreach(type IN LISTS CMAKE_CONFIGURATION_TYPES)
+   string(TOUPPER "${type}" type_upper)
+   if(type_upper STREQUAL selected_type)
+     pad("${type}" 18 " " type_padded)
+     message(STATUS "${BGreen}* ${type_padded}${CMAKE_CXX_FLAGS_${type_upper}}${CR}")
+   else()
+     pad("${type}" 18 " " type_padded)
+     message(STATUS "  ${BWhite}${type_padded}${CR}${CMAKE_CXX_FLAGS_${type_upper}}")
+   endif()
+   unset(type_padded)
+   unset(type_upper)
+ endforeach()
+message(STATUS "  ")
+message(STATUS "  (Change the build type with ${BMagenta}-DCMAKE_BUILD_TYPE=...${CR})")
+endif()
+################################################################################

+ 291 - 0
CMakeListst_new.txt

@@ -0,0 +1,291 @@
+# The name of our project is โ€œMPDROOTโ€.  CMakeLists files in this project can
+# refer to the root source directory of the project as ${MPDROOT_SOURCE_DIR}
+# or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as
+# ${MPDROOT_BINARY_DIR} or ${CMAKE_BINARY_DIR}.
+# This difference is important for the base classes which are in FAIRROOT
+# and the experiment part.
+
+# Check if cmake has the required version
+CMAKE_MINIMUM_REQUIRED(VERSION 3.11.0 FATAL_ERROR)
+cmake_policy(VERSION 3.11...3.21)
+
+# Set name of our project to โ€œMPDROOT". Has to be done
+# after check of cmake version since this is a new feature
+project(MPDROOT)
+
+#In case you need Fortran
+enable_language(Fortran)
+set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy")
+
+Option(USE_PATH_INFO "Information from PATH and LD_LIBRARY_PATH are used." ON)
+Option(ALIBUILD "Flag if we are building with AliBuild." OFF)
+
+
+# Check for needed environment variables
+IF(NOT DEFINED ENV{FAIRROOTPATH})
+  MESSAGE(FATAL_ERROR "You did not define the environment variable FAIRROOTPATH which is needed to find FairRoot. Please set this variable and execute cmake again.")
+ENDIF(NOT DEFINED ENV{FAIRROOTPATH})
+
+IF(NOT DEFINED ENV{SIMPATH})
+   MESSAGE(FATAL_ERROR "You did not define the environment variable SIMPATH which is nedded to find the external packages. Please set this variable and execute cmake again.")
+ENDIF(NOT DEFINED ENV{SIMPATH})
+
+SET(SIMPATH $ENV{SIMPATH})
+#SET(ROOTSYS $ENV{ROOTSYS})
+SET(FAIRROOTPATH $ENV{FAIRROOTPATH})
+
+# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
+# is checked
+  set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules"  ${CMAKE_MODULE_PATH})
+  set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old"  ${CMAKE_MODULE_PATH})
+  #set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
+  set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules_new" ${CMAKE_MODULE_PATH})
+  
+Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks")
+
+#find_package(FairCMakeModules 0.1 QUIET)
+if(NOT FairCMakeModules_FOUND)
+  message(WARNING "Could not find FairCMakeModules, falling back to local copy. "
+          "It is recommended to install https://github.com/FairRootGroup/FairCMakeModules")
+  list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/fallback")
+endif()
+include(FairFindPackage2)
+
+find_package2(PUBLIC FairRoot)
+
+# Load some basic macros which are needed later on
+include(FairMacros)
+include(WriteConfigFile)
+include(CTest)
+include(CheckCompiler)
+include(CheckFortran)
+include(InstallNicaFemto)
+include(CreateMpdConfig)
+
+#Check the compiler and set the compile and link flags
+If(NOT CMAKE_BUILD_TYPE)
+  Message("Set BuildType RelWithDebInfo")
+  set(CMAKE_BUILD_TYPE RelWithDebInfo)
+EndIf(NOT CMAKE_BUILD_TYPE)
+Check_Compiler()
+#set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -march=znver2 -mtune=znver2 -std=c++17") # -Wall -Wextra
+
+set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
+set(INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
+Set(VMCWORKDIR ${CMAKE_SOURCE_DIR})
+
+If(USE_PATH_INFO)
+  Set(PATH "$PATH")
+  If (APPLE)
+    Set(LD_LIBRARY_PATH $ENV{DYLD_LIBRARY_PATH})
+  Else (APPLE)
+    Set(LD_LIBRARY_PATH $ENV{LD_LIBRARY_PATH})
+  EndIf (APPLE)
+Else(USE_PATH_INFO)
+  STRING(REGEX MATCHALL "[^:]+" PATH $ENV{PATH})
+EndIf(USE_PATH_INFO)
+
+
+# Check if the user wants to build the project in the source
+# directory
+CHECK_OUT_OF_SOURCE_BUILD()
+CHECK_INSTALL_DIRECTORY()
+
+# Check if we are on an UNIX system. If not stop with an error
+# message
+IF(NOT UNIX)
+  MESSAGE(FATAL_ERROR "You're not on an UNIX system. The project was up to now only tested on UNIX systems, so we break here. If you want to go on please edit the CMakeLists.txt in the source directory.")
+ENDIF(NOT UNIX)
+
+# Check if the external packages are installed into a separate install
+# directory
+CHECK_EXTERNAL_PACKAGE_INSTALL_DIR()
+
+# searches for needed packages
+# REQUIRED means that cmake will stop if this packages are not found
+# For example the framework can run without GEANT4, but ROOT is
+# mandatory
+
+if(SIMPATH)
+  set(CMAKE_PREFIX_PATH ${SIMPATH} ${CMAKE_PREFIX_PATH})
+  set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${SIMPATH}/lib)
+endif()
+
+
+find_package2(PUBLIC ROOT REQUIRED)
+SET(ROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIR} ${ROOT_INCLUDE_DIRS})	
+
+include(ROOTMacros)
+if(ROOT_vmc_FOUND)
+  set(VMCLIB ROOT::VMC)
+else()
+  find_package2(PUBLIC VMC REQUIRED)
+  set(VMCLIB VMCLibrary)
+endif()
+find_package2(PUBLIC FairLogger  VERSION 1.2.0 REQUIRED)
+foreach(dep IN LISTS FairLogger_PACKAGE_DEPENDENCIES)
+  if(NOT dep STREQUAL "Boost")
+    find_package2(PUBLIC ${dep} REQUIRED VERSION ${FairLogger_${dep}_VERSION})
+    set(PROJECT_${dep}_VERSION ${FairLogger_${dep}_VERSION})
+  endif()
+endforeach()
+find_package2(PUBLIC Pythia6)
+find_package2(PUBLIC Pythia8)
+find_package2(PUBLIC Geant3)
+find_package2(PUBLIC Geant4)
+Find_Package2(PUBLIC VGM)
+find_package2(PUBLIC Geant4VMC)
+find_package(HEPMC)
+find_package(XML2 REQUIRED)
+
+SET(GEANT3_INCLUDE_DIR ${GEANT3_INCLUDE_DIR} ${Geant3_INCLUDE_DIRS})	
+  
+If(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
+  set(BOOST_ROOT ${SIMPATH})
+  set(GSL_DIR ${SIMPATH})
+Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
+  set(BOOST_ROOT ${SIMPATH}/basics/boost)
+  set(GSL_DIR ${SIMPATH}/basics/gsl)
+EndIf(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
+
+if(NOT DEFINED Boost_NO_SYSTEM_PATHS)
+  Set(Boost_NO_SYSTEM_PATHS TRUE)
+endif()
+if(NOT DEFINED Boost_NO_BOOST_CMAKE AND CMAKE_VERSION VERSION_LESS 3.15)
+  Set(Boost_NO_BOOST_CMAKE TRUE)
+endif()
+if(Boost_NO_BOOST_CMAKE)
+  # If an older version of boost is found both of the variables below are
+  # cached and in a second cmake run, a good boost version is found even
+  # if the version is to old.
+  # To overcome this problem both variables are cleared before checking
+  # for boost.
+  Unset(Boost_INCLUDE_DIR CACHE)
+  Unset(Boost_LIBRARY_DIRS CACHE)
+endif()
+
+find_package2(PUBLIC Boost
+  VERSION 1.67
+  ADD_REQUIREMENTS_OF FairRoot FairMQ FairLogger
+)
+
+If (Boost_FOUND)
+  Set(Boost_Avail 1)
+Else (Boost_FOUND)
+  Set(Boost_Avail 0)
+EndIf (Boost_FOUND)
+
+# set a variable which should be used in all CMakeLists.txt
+# Defines all basic include directories from fairbase
+SetBasicVariables()
+find_package(FairLogger)
+SET(PATH ${EXECUTABLE_OUTPUT_PATH} ${PATH})
+set(MPDROOT TRUE)
+add_definitions(-DMPDROOT)
+
+# Set the library version in the main CMakeLists.txt
+SET(FAIRROOT_MAJOR_VERSION 0)
+SET(FAIRROOT_MINOR_VERSION 0)
+SET(FAIRROOT_PATCH_VERSION 0)
+SET(FAIRROOT_VERSION "${FAIRROOT_MAJOR_VERSION}.${FAIRROOT_MINOR_VERSION}.${FAIRROOT_PATCH_VERSION}")
+
+set(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES}
+  VERSION "${FAIRROOT_VERSION}"
+  SOVERSION "${FAIRROOT_MAJOR_VERSION}.${FAIRROOT_MINOR_VERSION}"
+)
+set(PROJECT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES})
+
+configure_file(${FAIRROOTPATH}/share/fairbase/cmake/scripts/FairRootConfigVersion.cmake.in "${CMAKE_BINARY_DIR}/FairRootConfigVersion.cmake" @ONLY)
+
+Generate_Version_Info()
+
+SET(_LIBDIR ${CMAKE_BINARY_DIR}/lib)
+SET(LD_LIBRARY_PATH  ${_LIBDIR} ${LD_LIBRARY_PATH})
+
+
+# Recurse into the given subdirectories.  This does not actually
+# cause another cmake executable to run.  The same process will walk through
+# the project's entire directory structure.
+add_subdirectory (passive)
+add_subdirectory (mpdbase)
+add_subdirectory (mpdfield)
+add_subdirectory (kalman) #MpdBase MpdField
+add_subdirectory (shield_pack)
+add_subdirectory (generators/unigen_format)
+add_subdirectory (generators) # MpdMcDst
+add_subdirectory (mcstack) # MpdGen
+add_subdirectory (mpdpid) # MpdMCStack MpdBase
+add_subdirectory (lhetrack) # MpdBase Kalman Sts Tof
+add_subdirectory (mpddst) # MpdBase LHETrack MpdPid
+
+add_subdirectory (tof) # MpdMCStack Kalman
+add_subdirectory (tpc) # Tof
+add_subdirectory (etof)
+add_subdirectory (zdc)
+add_subdirectory (clustering)
+add_subdirectory (emc) # Cluster
+add_subdirectory (ffd)
+add_subdirectory (sts)
+add_subdirectory (cpc)
+add_subdirectory (bmd)
+add_subdirectory (mcord)
+add_subdirectory (physics) #MpdBase MpdMCStack Kalman MpdPid LHETrack
+add_subdirectory (eventdisplay) #Emc
+
+#add_subdirectory (macro)
+#add_subdirectory (strawendcap)
+#add_subdirectory (strawECT)
+#add_subdirectory (bbc)
+#add_subdirectory (sft)
+#add_subdirectory (stt)
+#add_subdirectory (fsa)
+#add_subdirectory (ndet)
+#add_subdirectory (tgem)
+#add_subdirectory (dch)
+
+#if(EXISTS "${CMAKE_SOURCE_DIR}/macro/mpd_scheduler/CMakeLists.txt")
+# add_subdirectory (macro/mpd_scheduler)
+#endif()
+#InstallNicaFemto()
+
+Option(BUILD_DOXYGEN "Build Doxygen" OFF)
+if(BUILD_DOXYGEN)
+  MESSAGE(STATUS "*** Building the Doxygen documentaion ***")
+  ADD_SUBDIRECTORY(doxygen)
+endif(BUILD_DOXYGEN)
+
+
+WRITE_CONFIG_FILE(config.sh)
+SET(VMCWORKDIR ${CMAKE_INSTALL_PREFIX})
+SET(ROOT_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include ${ROOT_INCLUDE_PATH})
+
+configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake
+               ${CMAKE_BINARY_DIR}/CTestCustom.cmake
+              )
+# Summary ######################################################################
+if(CMAKE_CXX_FLAGS)
+  message(STATUS "  ")
+  message(STATUS "  ${Cyan}GLOBAL CXX FLAGS${CR}  ${BGreen}${CMAKE_CXX_FLAGS}${CR}")
+endif()
+if(CMAKE_CONFIGURATION_TYPES)
+  message(STATUS "  ")
+  message(STATUS "  ${Cyan}BUILD TYPE         CXX FLAGS${CR}")
+  string(TOUPPER "${CMAKE_BUILD_TYPE}" selected_type)
+  foreach(type IN LISTS CMAKE_CONFIGURATION_TYPES)
+   string(TOUPPER "${type}" type_upper)
+   if(type_upper STREQUAL selected_type)
+     pad("${type}" 18 " " type_padded)
+     message(STATUS "${BGreen}* ${type_padded}${CMAKE_CXX_FLAGS_${type_upper}}${CR}")
+   else()
+     pad("${type}" 18 " " type_padded)
+     message(STATUS "  ${BWhite}${type_padded}${CR}${CMAKE_CXX_FLAGS_${type_upper}}")
+   endif()
+   unset(type_padded)
+   unset(type_upper)
+ endforeach()
+message(STATUS "  ")
+message(STATUS "  (Change the build type with ${BMagenta}-DCMAKE_BUILD_TYPE=...${CR})")
+endif()
+
+   ################################################################################

+ 10 - 0
CTestConfig.cmake

@@ -0,0 +1,10 @@
+# Dashboard is opened for submissions for a 24 hour period starting at
+# the specified NIGHLY_START_TIME. Time is specified in 24 hour format.
+set(CTEST_PROJECT_NAME "MpdRoot")
+set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
+
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "mpd.jinr.ru")
+set(CTEST_DROP_LOCATION "/cdash/submit.php?project=MpdRoot")
+set(CTEST_DROP_SITE_CDASH TRUE)
+

+ 131 - 0
CTestCustom.cmake

@@ -0,0 +1,131 @@
+# -*- mode: cmake -*-
+
+#message(" -- Read CTestCustom.cmake --")
+
+# -----------------------------------------------------------
+# -- Number of warnings to display
+# -----------------------------------------------------------
+
+#set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "999" )
+
+# -----------------------------------------------------------
+# -- Number of errors to display
+# -----------------------------------------------------------
+
+#set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS   "0" )
+
+# -----------------------------------------------------------
+# -- Maximum size of passed and failed tests output
+# -----------------------------------------------------------
+
+set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE   "102400")
+set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE   "102400")
+
+# -----------------------------------------------------------
+# -- Warning execptions
+# -----------------------------------------------------------
+
+set(CTEST_CUSTOM_WARNING_EXCEPTION
+	${CTEST_CUSTOM_WARNING_EXCEPTION}
+
+	# -- doxygen warnings
+# 	"of command \@param is not found in the argument list of" 
+#	"for \\link command"
+#	"for \\ref command"
+#	"\\class statement"
+#	"\\file statement"
+#	"are not documented:"
+#	"Skipping documentation"
+#	"has a brief description"
+
+ 	# -- CLHEP and Pluto warnings
+        "/include/CLHEP/"
+        "PDataBase.h"
+	"PMesh.h" 
+        "PParticle.h"
+        "PStaticData.h"
+        "PUtils.h"
+        "include/pluto/"
+
+        # -- warnings from ubuntu systems which are a little to much
+        # -- probably defined warn-unused-result. ignoring the result
+        # -- of fgets is common practice. A work around would be to
+        # -- store the return value in a dummy variable
+        "ignoring return value of 'char* fgets(char*, int, FILE*)'"
+        "ignoring return value of 'char* fscanf(char*, int, FILE*)'"
+
+        # -- boost warnings
+        "/include/boost/exception/exception.hpp:"
+        "/include/boost/smart_ptr/detail/sp_convertible.hpp:"
+        "/include/boost/smart_ptr/shared_ptr.hpp:"  
+
+        # -- Root warnings when installed in installation dir
+        "/include/root/"
+        # -- Root warnings which should not show up in the test setup
+        "/include/G__ci.h:"
+        "/include/TAttImage.h:"
+        "/include/TBuffer.h:"
+        "/include/TCollectionProxyInfo.h"
+        "/include/TCut.h:"
+        "/include/TChainElement.h:"
+        "/include/TEveBoxSet.h:"
+        "/include/TEveTrackPropagator.h:"
+        "/include/TEveTrackPropagator.h:"
+        "/include/TEveVector.h:"
+        "/include/TFcnAdapter.h:"
+        "/include/TFitterMinuit.h:"
+        "/include/TGeoMatrix.h:"
+        "/include/TGeoPainter.h:"
+        "/include/TList.h:"
+        "/include/TMap.h:"
+        "/include/TMatrixT.h:"
+        "/include/TMatrixTSym.h:"
+        "/include/TMemberInspector.h:"
+        "/include/TObjArray.h:"
+        "/include/TRefArray.h:"
+        "/include/TString.h:"
+        "/include/Minuit2/BasicFunctionGradient.h:"
+        "/include/Minuit2/MnUserParameterState.h:"
+        "/include/Minuit2/StackAllocator.h:"
+        "/include/TMVA/ClassInfo.h:"
+        "/include/TMVA/Config.h:"
+        "/include/TMVA/Configurable.h:"
+        "/include/TMVA/DataInputHandler.h:"
+        "/include/TMVA/DataSet.h:"
+        "/include/TMVA/DataSetInfo.h:"
+        "/include/TMVA/DataSetManager.h:"
+        "/include/TMVA/Event.h:"
+        "/include/TMVA/Factory.h:"
+        "/include/TMVA/KDEKernel.h:"
+        "/include/TMVA/Option.h:"
+        "/include/TMVA/PDF.h:"
+        "/include/TMVA/Reader.h:"
+        "/include/TMVA/Types.h:"
+
+        # -- Geant3 warnings
+        "TGeant3/TGeant3.h:"
+        "TGeant3/TGeant3TGeo.h:"
+
+        # -- Errors which are filtered for the time being
+        # -- MbsAPI is only a copy from elsewhere so don't know what to do
+	"MbsAPI"
+        "/MbsAPI/f_evcli.c"
+        "FairTSBufferFunctional.*std::binary_function"
+  )
+
+# -----------------------------------------------------------
+# -- Warning addon's
+# -----------------------------------------------------------
+set(CTEST_CUSTOM_WARNING_MATCH	${CTEST_CUSTOM_WARNING_MATCH}
+	)
+
+Set (CTEST_CUSTOM_COVERAGE_EXCLUDE
+     ".*Dict.h"
+     ".*Dict.cxx"
+     ".*GTest.*"
+    )
+
+#Set (CTEST_CUSTOM_COVERAGE_EXCLUDE
+#     "Dict.h"
+#     "Dict.cxx"
+#    )

+ 141 - 0
Dart.sh

@@ -0,0 +1,141 @@
+#!/bin/bash
+
+
+function print_example(){
+echo "##################################################################"
+echo "# To set the required parameters as source and the build         #"
+echo "# directory for ctest, the linux flavour and the SIMPATH         #"
+echo "# put the export commands below to a separate file which is read #"
+echo "# during execution and which is defined on the command line.     #"
+echo "# Set all parameters according to your needs.                    #"
+echo "# LINUX_FLAVOUR should be set to the distribution you are using  #"
+echo "# eg Debian, SuSe etc.                                           #"
+echo "# For example                                                    #"
+echo "#!/bin/bash                                                      #"
+echo "#export LINUX_FLAVOUR=Etch32                                     #"
+echo "#export FAIRSOFT_VERSION=mar08                                   #"
+echo "#export SIMPATH=<path_to_installation_of_external_packages>      #"
+echo "#export BUILDDIR=/tmp/fairroot/build_cbm_\${FAIRSOFT_VERSION}     #"
+echo "#export SOURCEDIR=/misc/uhlig/SVN/ctest/cbmroot                  #"
+echo "##################################################################"
+}
+
+#if test  "x$SIMPATH" = "x" ; then
+#  echo ""                                                             
+#  echo "-- Error -- You don't set the needed variables in this shell script."
+#  echo "-- Error -- Please edit the script and do so."
+#  echo ""
+#  exit 1
+#fi
+
+if [ "$#" -lt "1" ]; then
+  echo ""
+  echo "-- Error -- Please start script with one,two,three, four or five parameters:"
+  echo "-- Error -- 1st parameter - Nightly or Experimental "
+  echo "-- Error -- 2nd parameter - path to your *.cmake files (trunk)"
+  echo "-- Error -- 3rd parameter - CDash_Env_MpdRoot.sh     (default)"
+  echo "-- Error -- 4th parameter - path to your config.sh     (build)"
+  echo "-- Error -- 5th parameter - fairsoft: jul09(default), jan10, or jun11"
+  echo ""
+  print_example
+  exit 1
+fi
+
+# test if a ctest model is either Experimantal or Nightly
+if [ "$1" == "Experimental" -o "$1" == "Nightly" -o "$1" == "Continuous" ]; then
+  echo ""
+else
+  echo "-- Error -- This ctest model is not supported."
+  echo "-- Error -- Possible arguments are Nightly, Experimental or Continuous."
+  exit 1
+fi 
+
+# test if the input file exists and execute it
+# if [ "$#" -gt "2" ]; then
+if [ -e "$2" ]; then
+  cd $2
+  if [ "$#" -gt "4" ]; then
+      sleep 2
+      source $3 $2 $4 $5
+  else
+      if [ -e "$4" ]; then
+          sleep 2
+	  source $3 $2 $4
+      else
+	  if [ -e "$3" ]; then
+              sleep 2
+	      source $3 $2
+	  else
+              sleep 2
+	      source CDash_Env_MpdRoot.sh  $2 
+	  fi
+      fi
+  fi
+else
+  if [ "$#" -gt "1" ]; then
+    cd $2
+    sleep 2
+    source CDash_Env_MpdRoot.sh $2
+  else
+    sleep 2
+    source CDash_Env_MpdRoot.sh $(pwd) 
+  fi
+fi
+
+# set the ctest model to command line parameter
+export ctest_model=$1
+# test for architecture
+arch=$(uname -s | tr '[A-Z]' '[a-z]')
+chip=$(uname -m | tr '[A-Z]' '[a-z]')
+
+# extract information about the system and the machine and set
+# environment variables used by ctest
+SYSTEM=$arch-$chip
+if test -z $CXX ; then
+  COMPILER=gcc;
+  GCC_VERSION=$(gcc -dumpversion)
+else
+  COMPILER=$CXX;
+  GCC_VERSION=$($CXX -dumpversion)
+fi
+
+export LABEL1=${LINUX_FLAVOUR}-$SYSTEM-$COMPILER$GCC_VERSION-fairsoft_$FAIRSOFT_VERSION
+export LABEL=$(echo $LABEL1 | sed -e 's#/#_#g')
+
+# get the number of processors
+# and information about the host
+if [ "$arch" = "linux" ];
+then
+  if [ "$NCPU" != "" ];
+  then
+    export number_of_processors=$NCPU
+  else 
+    export number_of_processors=$(cat /proc/cpuinfo | grep processor | wc -l)
+  fi
+  export SITE=$(hostname -f)
+elif [ "$arch" = "darwin" ];
+then
+  if [ "$NCPU" != "" ];
+  then
+    export number_of_processors=$NCPU
+  else 
+    export number_of_processors=$(sysctl -n hw.ncpu)
+  fi
+  export SITE=$(hostname -s)
+fi
+
+echo "************************"
+date
+echo "LABEL: " $LABEL
+echo "SITE: " $SITE
+echo "Model: " ${ctest_model}
+echo "Nr. of processes: " $number_of_processors
+echo "************************"
+
+cd $SOURCEDIR
+# cd $BUILDDIR
+
+ctest -S $SOURCEDIR/MpdRoot_test.cmake -V --VV
+
+
+echo "******************* end of Dart.sh  *****"

+ 231 - 0
INSTALL

@@ -0,0 +1,231 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PREFIX', the package will
+use PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+

+ 25 - 0
INSTALL.JINR

@@ -0,0 +1,25 @@
+// Installation procedure for MPDRoot at JINR
+=============================================
+  configure the required packages
+
+ create a build directory
+
+It is more convenient to have separate build directory for the the
+different systems
+
+       > bash
+       > mkdir MyBuild
+ 
+configure mpdroot
+   
+       > cd  "MpdRoot_top_directory"
+       > . ./SetEnv.sh
+       > cd  MyBuild
+       > cmake "MpdRoot_top_directory"
+
+
+build the framework
+
+       > .  ./config.sh
+       > make
+       > make install

+ 111 - 0
KFParticle/CMakeLists.txt

@@ -0,0 +1,111 @@
+cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
+
+#project(KFParticleLibrary)
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/KFParticle/Vc/cmake" ${CMAKE_MODULE_PATH})
+
+
+
+set(FIXTARGET FALSE CACHE BOOL "Compile for fix target geometry.")
+
+#find_package(ROOT REQUIRED COMPONENTS Core Hist Matrix Physics EG Gpad Graf Graf3d RIO MathCore)
+#If(DEFINED Vc_INCLUDE_DIR AND Vc_LIBRARIES)
+#  Message("Vc found")
+#Else()
+#  find_package(Vc REQUIRED)
+#EndIf()
+
+Set(INCLUDE_DIRECTORIES
+  ${BASE_INCLUDE_DIRECTORIES}
+  ${CMAKE_SOURCE_DIR}/KFParticle
+  ${CMAKE_SOURCE_DIR}/KFParticle/Vc
+  ${CMAKE_SOURCE_DIR}/KFParticle/KFParticle
+  ${CMAKE_SOURCE_DIR}/KFParticle/KFParticlePerformance
+
+  ${CMAKE_SOURCE_DIR}/kalman
+  ${CMAKE_SOURCE_DIR}/mcstack
+  ${CMAKE_SOURCE_DIR}/mpdbase
+  ${CMAKE_SOURCE_DIR}/mpddst
+  ${CMAKE_SOURCE_DIR}/mpddst/MpdMiniEvent
+)
+
+Set(SYSTEM_INCLUDE_DIRECTORIES
+ ${ROOT_INCLUDE_DIR} 
+ ${CLHEP_INCLUDE_DIR}
+ ${Boost_INCLUDE_DIRS}
+)
+
+set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
+Include_Directories( ${CMAKE_SOURCE_DIR} ${Vc_INCLUDE_DIR} ${INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRECTORIES})
+set(CMAKE_INCLUDE_DIRECTORIES_BEFORE OFF)
+
+set(LINK_DIRECTORIES
+  ${ROOT_LIBRARY_DIR}
+  ${FAIRROOT_LIBRARY_DIR}
+)
+ 
+link_directories( ${LINK_DIRECTORIES})
+
+set (SRCS
+  KFParticle/KFParticleTopoReconstructor.cxx
+  KFParticle/KFVertex.cxx
+  KFParticle/KFPTrack.cxx
+  KFParticle/KFPTrackVector.cxx
+  KFParticle/KFPVertex.cxx
+  KFParticle/KFParticlePVReconstructor.cxx
+  KFParticle/KFParticleDatabase.cxx
+  KFParticle/KFParticleBase.cxx
+  KFParticle/KFParticleBaseSIMD.cxx
+  KFParticle/KFParticle.cxx
+  KFParticle/KFParticleSIMD.cxx
+  KFParticle/KFParticleFinder.cxx
+  KFParticle/KFPEmcCluster.cxx
+
+  KFParticlePerformance/KFMCVertex.cxx
+  KFParticlePerformance/KFParticlePerformanceBase.cxx
+  KFParticlePerformance/KFTopoPerformance.cxx
+  KFParticlePerformance/KFMCParticle.cxx
+
+  MpdKfParticleFinder.cxx
+)
+
+set (HEADERS
+  KFParticle/KFParticleBase.h
+  KFParticle/KFParticle.h
+  KFParticle/KFVertex.h
+  KFParticlePerformance/KFPartEfficiencies.h
+  KFParticlePerformance/KFMCParticle.h
+
+  MpdKfParticleFinder.h
+)
+
+Set(NODICT_HEADERS
+  KFParticle/KFParticleTopoReconstructor.h
+  KFParticle/KFParticlePVReconstructor.h
+  KFParticle/KFPVertex.h
+  KFParticle/KFPTrack.h
+  KFParticle/KFParticleFinder.h
+  KFParticle/KFParticleSIMD.h
+  KFParticle/KFParticleBaseSIMD.h
+  KFParticle/KFParticleDef.h
+  KFParticle/KFPSimdAllocator.h
+  KFParticle/KFPTrackVector.h
+  KFParticle/KFPEmcCluster.h
+  KFParticle/KFParticleField.h
+  KFParticle/KFPTrackVector.h
+  KFParticle/KFParticleDatabase.h
+  KFParticlePerformance/KFTopoPerformance.h
+  KFParticlePerformance/KFParticlePerformanceBase.h
+  KFParticlePerformance/KFMCCounter.h
+  KFParticlePerformance/KFPVEfficiencies.h
+  KFParticlePerformance/KFMCVertex.h
+  KFParticlePerformance/KFMCTrack.h
+  KFParticlePerformance/KFPartMatch.h
+)
+
+Set(HEADERS)
+Set(NODICT_HEADERS)
+Set(LINKDEF KFLinkDef.h)
+Set(LIBRARY_NAME MpdKfParticle)
+Set(DEPENDENCIES Core Hist Matrix Physics EG Gpad Graf Graf3d RIO MathCore Vc Kalman MpdDst)
+
+GENERATE_LIBRARY()

+ 28 - 0
KFParticle/KFLinkDef.h

@@ -0,0 +1,28 @@
+#if defined(__CINT__) || defined(__CLING__)
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+//KFParticle
+#pragma link C++ class  KFParticleBase+;
+#pragma link C++ class  KFParticle+;
+#pragma link C++ class  KFPTrack++;
+#pragma link C++ class  KFVertex+;
+#pragma link C++ class  KFPartEfficiencies+;
+#pragma link C++ class  KFMCParticle+;
+#pragma link C++ class  KFParticle+;
+// #pragma link C++ class  KFParticlePerformanceBase+;
+// #pragma link C++ class  KFTopoPerformance+;
+
+// MpdKfParticleFinder
+#pragma link C++ class  MpdKfParticleFinder++;
+#pragma link C++ class  ExtendedMpdTpcKalmanTrack++;
+#pragma link C++ class  TrackCuts++;
+
+#endif
+
+
+
+
+

+ 176 - 0
KFParticle/KFParticle/KFPEmcCluster.cxx

@@ -0,0 +1,176 @@
+//----------------------------------------------------------------------------
+// Implementation of the KFParticle class
+// .
+// @author  I.Kisel, I.Kulakov, M.Zyzak
+// @version 1.0
+// @since   20.08.13
+// 
+// 
+//  -= Copyright &copy ALICE HLT and CBM L1 Groups =-
+//____________________________________________________________________________
+
+#include "KFPEmcCluster.h"
+#include <iostream>
+
+void KFPEmcCluster::SetParameter(const float_v& value, int iP, int iTr)
+{ 
+  /** Copies the SIMD vector "value" to the parameter vector KFPEmcCluster::fP[iP]
+   ** starting at the position "iTr".
+   ** \param[in] value - SIMD vector with the values to be stored
+   ** \param[in] iP - number of the parameter vector
+   ** \param[in] iTr - starting position in the parameter vector where the values should be stored
+   **/
+  if( (iTr+float_vLen) < Size())
+    reinterpret_cast<float_v&>(fP[iP][iTr]) = value;
+  else
+  {
+    const uint_v index(uint_v::IndexesFromZero());
+    (reinterpret_cast<float_v&>(fP[iP][iTr])).gather(reinterpret_cast<const float*>(&value), index, simd_cast<float_m>(index<(Size() - iTr)));
+  }
+}
+void KFPEmcCluster::SetCovariance(const float_v& value, int iC, int iTr) 
+{ 
+  /** Copies the SIMD vector "value" to the element of the covariance matrix vector KFPEmcCluster::fC[iC]
+   ** starting at the position "iTr".
+   ** \param[in] value - SIMD vector with the values to be stored
+   ** \param[in] iC - number of the element of the covariance matrix
+   ** \param[in] iTr - starting position in the parameter vector where the values should be stored
+   **/
+  if( (iTr+float_vLen) < Size())
+    reinterpret_cast<float_v&>(fC[iC][iTr]) = value;
+  else
+  {
+    const uint_v index(uint_v::IndexesFromZero());
+    (reinterpret_cast<float_v&>(fC[iC][iTr])).gather(reinterpret_cast<const float*>(&value), index, simd_cast<float_m>(index<(Size() - iTr)));
+  }
+}
+
+void KFPEmcCluster::Resize(const int n)
+{
+  /** Resizes all vectors in the class to a given value.
+   ** \param[in] n - new size of the vector
+   **/
+  for(int i=0; i<4; i++)
+    fP[i].resize(n);
+  for(int i=0; i<10; i++)
+    fC[i].resize(n);
+  fId.resize(n);
+}
+
+void KFPEmcCluster::Set(KFPEmcCluster& v, int vSize, int offset)
+{
+  /** Copies "vSize" clusters from the KFPEmcCluster "v" to the current object.
+   ** Tracks are put starting from the "offset" position.
+   ** \param[in] v - external KFPEmcCluster with input clusters to be copied
+   ** \param[in] vSize - number of clusters to be copied from "v"
+   ** \param[in] offset - offset position in the current object, starting from which input clusters will be stored
+   **/
+  for(int iV=0; iV<vSize; iV++)
+  {
+    for(int i=0; i<4; i++)
+      fP[i][offset+iV] = v.fP[i][iV];
+    for(int i=0; i<10; i++)
+      fC[i][offset+iV] = v.fC[i][iV];
+    fId[offset+iV] = v.fId[iV];
+  }
+}
+
+void KFPEmcCluster::SetTracks(const KFPEmcCluster& track, const kfvector_uint& trackIndex, const int nIndexes)
+{
+  /** The current object is resised to "nIndexes", clusters with indices "trackIndex" are copied to the current object.
+   ** \param[in] track - input vector of clusters
+   ** \param[in] trackIndex - indices of clusters in a vector "track", which should be stored to the current object
+   ** \param[in] nIndexes - number of clusters to be copied, defines the new size of the current object
+   **/
+
+  if(nIndexes == 0) return;
+  
+  Resize(nIndexes);
+
+  for(int iP=0; iP<4; iP++)
+  {
+    int iElement = 0;
+    for(iElement=0; iElement<nIndexes-float_vLen; iElement += float_vLen)
+    {
+      const uint_v& index = reinterpret_cast<const uint_v&>(trackIndex[iElement]);
+      float_v& vec = reinterpret_cast<float_v&>(fP[iP][iElement]);
+      vec.gather(&(track.fP[iP][0]), index);
+    }
+    const uint_v& index = reinterpret_cast<const uint_v&>(trackIndex[iElement]);
+    float_v& vec = reinterpret_cast<float_v&>(fP[iP][iElement]);
+    vec.gather(&(track.fP[iP][0]), index, simd_cast<float_m>(iElement+uint_v::IndexesFromZero()<nIndexes));
+    
+  }
+  for(int iC=0; iC<10; iC++)
+  {
+    int iElement=0;
+    for(iElement=0; iElement<nIndexes-float_vLen; iElement += float_vLen)
+    {
+      const uint_v& index = reinterpret_cast<const uint_v&>(trackIndex[iElement]);
+      float_v& vec = reinterpret_cast<float_v&>(fC[iC][iElement]);
+      vec.gather(&(track.fC[iC][0]), index);
+    }
+    const uint_v& index = reinterpret_cast<const uint_v&>(trackIndex[iElement]);
+    float_v& vec = reinterpret_cast<float_v&>(fC[iC][iElement]);
+    vec.gather(&(track.fC[iC][0]), index, simd_cast<float_m>(iElement+uint_v::IndexesFromZero()<nIndexes));
+  }
+  {
+    int iElement=0;
+    for(iElement=0; iElement<nIndexes-float_vLen; iElement += float_vLen)
+    {
+      const uint_v& index = reinterpret_cast<const uint_v&>(trackIndex[iElement]);
+      int_v& vec = reinterpret_cast<int_v&>(fId[iElement]);
+      vec.gather(&(track.fId[0]), index);
+    }
+    const uint_v& index = reinterpret_cast<const uint_v&>(trackIndex[iElement]);
+    int_v& vec = reinterpret_cast<int_v&>(fId[iElement]);
+    vec.gather(&(track.fId[0]), index, int_m(iElement+uint_v::IndexesFromZero()<nIndexes));
+  }
+}
+
+void KFPEmcCluster::PrintTrack(int n)
+{
+  /** Prints parameters of the cluster with index "n".
+   ** \param[in] n - index of cluster to be printed
+   **/
+  for(int i=0; i<4; i++)
+    std::cout << fP[i][n] << " ";
+  std::cout << std::endl;
+  for(int i=0; i<10; i++)
+    std::cout << fC[i][n] << " ";
+  std::cout << std::endl;
+  
+  std::cout << fId[n] << std::endl;
+}
+
+void KFPEmcCluster::PrintTracks()
+{
+  /** Prints all field of the current object. **/
+    
+  std::cout << "NTracks " << Size() << std::endl;
+  if( Size()==0 ) return;
+  
+  std::cout << "Parameters: " << std::endl;
+  for(int iP=0; iP<4; iP++)
+  {
+    std::cout << "  iP " << iP << ": ";
+    for(int iTr=0; iTr<Size(); iTr++)
+      std::cout << Parameter(iP)[iTr]<< " ";
+    std::cout << std::endl;
+  }
+
+  std::cout << "Cov matrix: " << std::endl;
+  for(int iC=0; iC<10; iC++)
+  {
+    std::cout << "  iC " << iC << ": ";
+    for(int iTr=0; iTr<Size(); iTr++)
+      std::cout << Covariance(iC)[iTr]<< " ";
+    std::cout << std::endl;
+  }
+  
+  std::cout << "Id: " << std::endl;
+  for(int iTr=0; iTr<Size(); iTr++)
+    std::cout <<  Id()[iTr] << " ";
+  std::cout << std::endl;
+}
+  

+ 123 - 0
KFParticle/KFParticle/KFPEmcCluster.h

@@ -0,0 +1,123 @@
+//----------------------------------------------------------------------------
+// Implementation of the KFParticle class
+// .
+// @author  I.Kisel, I.Kulakov, M.Zyzak
+// @version 1.0
+// @since   20.08.13
+// 
+// 
+//  -= Copyright &copy ALICE HLT and CBM L1 Groups =-
+//____________________________________________________________________________
+
+#ifndef KFPEmcCluster_H
+#define KFPEmcCluster_H
+
+#include "KFParticleDef.h"
+
+/** @class KFPEmcCluster
+ ** @brief A class to store vectors of input cluster from the electro-magnetic calorimeter.
+ ** @author  M.Zyzak, I.Kisel
+ ** @date 05.02.2019
+ ** @version 1.0
+ **
+ ** A cluster is described with the state vector { X, Y, Z, E }
+ ** and the corresponding covariance matrix. Also contains a unique id.
+ ** The data model implemented in the class is "Structure Of Arrays":
+ ** each parameter is stroed in a separate vector. Such data structure
+ ** allows fast vectorised access to the aligned data providing the
+ ** maximum possible speed for data reading, and at the same time easy
+ ** random access to the data members.
+ **/
+
+class KFPEmcCluster
+{
+ public:
+  KFPEmcCluster():fP(), fC(), fId() { }
+  ~KFPEmcCluster() { }
+
+  /**Returns size of the vectors. All data vectors have the same size. */
+  int Size() const { return fP[0].size(); }
+  
+  void Resize(const int n);
+  void Set(KFPEmcCluster& v, int vSize, int offset);
+  void SetTracks(const KFPEmcCluster& track, const kfvector_uint& trackIndex, const int nIndexes);
+  
+  const kfvector_float& X()  const { return fP[0]; } ///< Returns constant reference to the vector with X coordinates.
+  const kfvector_float& Y()  const { return fP[1]; } ///< Returns constant reference to the vector with Y coordinates.
+  const kfvector_float& Z()  const { return fP[2]; } ///< Returns constant reference to the vector with Z coordinates.
+  const kfvector_float& E() const { return fP[3]; }  ///< Returns constant reference to the vector with energy of the cluster.
+
+  const kfvector_float& Parameter(const int i)  const { return fP[i]; }  ///< Returns constant reference to the parameter vector with index "i".
+  const kfvector_float& Covariance(const int i)  const { return fC[i]; } ///< Returns constant reference to the vector of the covariance matrix elements with index "i".
+  const kfvector_int& Id()    const { return fId; }                      ///< Returns constant reference to the vector with unique id of the clusters.
+
+  //modifiers 
+  void SetParameter (float value, int iP, int iTr) { fP[iP][iTr] = value; } ///< Sets the "value" of the parameter "iP" of the cluster with index "iTr".
+  void SetCovariance(float value, int iC, int iTr) { fC[iC][iTr] = value; } ///< Sets the "value" of the element of covariance matrix "iC" of the cluster with index "iTr".
+
+  void SetParameter (const float_v& value, int iP, int iTr);  
+  void SetCovariance(const float_v& value, int iC, int iTr);
+
+  void SetId        (int value, int iTr)           { fId[iTr] = value; } ///< Sets the "value" of the id of the cluster with index "iTr".
+  
+  void PrintTrack(int n);
+  void PrintTracks();
+  
+  KFPEmcCluster(const KFPEmcCluster& clusters): fId()
+  {
+    /** Copy-constructor. Makes one-to-one copy.*/
+    const int localSize = clusters.Size();
+    
+    for(int i=0; i<4; i++)
+    {
+      fP[i].resize(localSize);
+      for(int n=0; n<localSize; n++)
+        fP[i][n] = clusters.fP[i][n];
+    }
+
+    for(int i=0; i<10; i++)
+    {
+      fC[i].resize(localSize);
+      for(int n=0; n<localSize; n++)
+        fC[i][n] = clusters.fC[i][n];
+    }
+    
+    fId.resize(localSize);
+    for(int n=0; n<localSize; n++)
+      fId[n] = clusters.fId[n];    
+  }
+  
+  const KFPEmcCluster& operator = (const KFPEmcCluster& clusters)
+  {
+    /** Operator to copy one KFPEmcCluster object to another. Makes one-to-one copy.*/
+    const int localSize = clusters.Size();
+    
+    for(int i=0; i<4; i++)
+    {
+      fP[i].resize(localSize);
+      for(int n=0; n<localSize; n++)
+        fP[i][n] = clusters.fP[i][n];
+    }
+
+    for(int i=0; i<10; i++)
+    {
+      fC[i].resize(localSize);
+      for(int n=0; n<localSize; n++)
+        fC[i][n] = clusters.fC[i][n];
+    }
+    
+    fId.resize(localSize);
+    for(int n=0; n<localSize; n++)
+      fId[n] = clusters.fId[n];
+    
+    return *this;
+  }
+  
+ private:  
+  kfvector_float fP[4];  ///< Coordinates of the cluster and energy: X, Y, Z, E.
+  kfvector_float fC[10]; ///< Covariance matrix of the parameters of the cluster.
+
+  kfvector_int fId; ///< Vector with unique ids of the clusters.
+};
+
+#endif

+ 370 - 0
KFParticle/KFParticle/KFPInputData.h

@@ -0,0 +1,370 @@
+//----------------------------------------------------------------------------
+// Structures with input data for KF Particle Finder
+// .
+// @author  M.Zyzak
+// @version 1.0
+// @since   20.08.13
+// 
+// 
+//  -= Copyright &copy ALICE HLT and CBM L1 Groups =-
+//____________________________________________________________________________
+
+#ifndef KFPINPUTDATA_H
+#define KFPINPUTDATA_H
+
+#include "KFPTrackVector.h"
+#include "KFParticle.h"
+
+#include <vector>
+#include <string>
+#include <fstream>
+
+/** @class KFPTrackIndex
+ ** @brief Helper structure to sort tracks in the KFPTrackVector object.
+ ** @author  M.Zyzak, I.Kisel
+ ** @date 05.02.2019
+ ** @version 1.0
+ **
+ ** The structure is used in the KFParticleTopoReconstructor::SortTracks() function.
+ ** Tracks are sorted according to their pdg hypothesis: electrons, muons, pions,
+ ** tracks without pdg (-1), kaons, protons, deuterons, tritons, He3, He4.
+ ** Teh structure contains pdg hypothesis of the track and its index in the 
+ ** KFPTrackVector object.
+ **/
+
+struct KFPTrackIndex
+{
+  int fIndex; ///< index of the track in the KFPTrackVector object.
+  int fPdg;   ///< PDG hypothesis of the track
+  
+  static bool Compare(const KFPTrackIndex& a, const KFPTrackIndex& b)
+  {
+    /** Static sorting function for comparison of the two input objects of class KFPTrackIndex.
+     ** Objects are sorted according to the PDG hypothesis: electrons, muons, pions,
+     ** tracks without pdg (-1), kaons, protons, deuterons, tritons, He3, He4.
+     ** Return "true" if a.fPdg < b.fPdg, otherwise returns "false". 
+     ** \param[in] a - first object
+     ** \param[in] b - second object
+     **/
+    int pdg1 = a.fPdg == -1 ? 250 : a.fPdg;
+    int pdg2 = b.fPdg == -1 ? 250 : b.fPdg;
+
+    return (abs(pdg1) < abs(pdg2));
+  }
+};
+
+
+/** @class KFPInputData
+ ** @brief Class with the input data for KF Particle Finder: tracks, primary vertex and magnetic field.
+ ** @author  M.Zyzak, I.Kisel
+ ** @date 05.02.2019
+ ** @version 1.0
+ **
+ ** The class is used to transfer the data between devices: CPU and Intel Xeon Phi. The memory is aligned
+ ** with the size of the SIMD vectors.
+ **/
+
+class KFPInputData
+{
+ public:
+   
+  void *operator new(size_t size) { return _mm_malloc(size, sizeof(float_v)); }      ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void *operator new[](size_t size) { return _mm_malloc(size, sizeof(float_v)); }    ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void *operator new(size_t size, void *ptr) { return ::operator new(size, ptr);}    ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void *operator new[](size_t size, void *ptr) { return ::operator new(size, ptr);}  ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void operator delete(void *ptr, size_t) { _mm_free(ptr); }                         ///< delete operator for the SIMD-alligned dynamic memory release
+  void operator delete[](void *ptr, size_t) { _mm_free(ptr); }                       ///< delete operator for the SIMD-alligned dynamic memory release
+  
+  KFPInputData():fPV(0),fBz(0.f) {};
+  ~KFPInputData() {};
+
+  bool ReadDataFromFile( std::string prefix )
+  {
+    /** Reads the input data from the input file with the name defined by "prefix".
+     ** \param[in] prefix - string with the name of the input file
+     **/ 
+    std::ifstream ifile(prefix.data());
+    if ( !ifile.is_open() ) return 0;
+    int nSets;
+    ifile >> fBz;
+    ifile >> nSets;
+    for(int iSet=0; iSet<nSets; iSet++)
+    {
+      int nTracks = 0;
+      ifile >> nTracks;
+      fTracks[iSet].Resize(nTracks);
+      
+      for(int iP=0; iP<6; iP++)
+      {
+        float value;
+        for(int iTr=0; iTr<fTracks[iSet].Size(); iTr++)
+        {
+          ifile >> value;
+          fTracks[iSet].SetParameter(value, iP, iTr);
+        }
+      }
+
+      for(int iC=0; iC<21; iC++)
+      {
+        float value;
+        for(int iTr=0; iTr<fTracks[iSet].Size(); iTr++)
+        {
+          ifile >> value;
+          fTracks[iSet].SetCovariance(value, iC, iTr);
+        }
+      }
+
+      int tmpInt;
+      for(int iTr=0; iTr<fTracks[iSet].Size(); iTr++)
+      {
+        ifile >> tmpInt;
+        fTracks[iSet].SetId(tmpInt, iTr);
+      }
+      
+      for(int iTr=0; iTr<fTracks[iSet].Size(); iTr++)
+      {
+        ifile >> tmpInt;
+        fTracks[iSet].SetPDG(tmpInt, iTr);
+      }
+
+      for(int iTr=0; iTr<fTracks[iSet].Size(); iTr++)
+      {
+        ifile >> tmpInt;
+        fTracks[iSet].SetQ(tmpInt, iTr);
+      }
+      
+      for(int iTr=0; iTr<fTracks[iSet].Size(); iTr++)
+      {
+        ifile >> tmpInt;
+        fTracks[iSet].SetPVIndex(tmpInt, iTr);
+      }
+      
+      ifile >> tmpInt;
+      fTracks[iSet].SetLastElectron(tmpInt);
+      ifile >> tmpInt;
+      fTracks[iSet].SetLastMuon    (tmpInt);
+      ifile >> tmpInt;
+      fTracks[iSet].SetLastPion    (tmpInt);
+      ifile >> tmpInt;
+      fTracks[iSet].SetLastKaon    (tmpInt);
+      ifile >> tmpInt;
+      fTracks[iSet].SetLastProton  (tmpInt);
+    }
+
+    int nPV;
+    ifile>>nPV;
+    fPV.resize(nPV);
+    for(unsigned int iPV=0; iPV < fPV.size(); iPV++)
+    {
+      for(int iP=0; iP<3; iP++)
+        ifile >> fPV[iPV].Parameter(iP);
+  
+      for(int iC=0; iC<6; iC++)
+        ifile >> fPV[iPV].Covariance(iC);
+    }
+    
+    ifile.close();
+    return 1;
+  }
+  
+  void SetDataToVector(int* data, int& dataSize)
+  {
+    /** Stores information to the memory under pointer "data".
+     ** \param[out] data - memory, where input information will be stored
+     ** \param[out] dataSize - size of the stored memory in "int" (or bloks of 4 bytes, or 32 bits)
+     **/
+    dataSize = NInputSets + 1 + 1; //sizes of the track vectors and pv vector, and field
+    for(int iSet=0; iSet<NInputSets; iSet++)
+      dataSize += fTracks[iSet].DataSize();
+    dataSize += fPV.size() * 9;
+        
+    for(int iSet=0; iSet<NInputSets; iSet++)
+      data[iSet] = fTracks[iSet].Size();
+    data[NInputSets] = fPV.size();
+    
+    float& field = reinterpret_cast<float&>(data[NInputSets+1]);
+    field = fBz;
+    
+    int offset = NInputSets+2;
+        
+    for(int iSet=0; iSet<NInputSets; iSet++)
+      fTracks[iSet].SetDataToVector(data, offset);
+    
+    for(int iP=0; iP<3; iP++)
+    {
+      for(unsigned int iPV=0; iPV<fPV.size(); iPV++)
+      {
+        float& tmpFloat = reinterpret_cast<float&>(data[offset + iPV]);
+        tmpFloat = fPV[iPV].Parameter(iP);
+      }
+      offset += fPV.size();
+    }
+    
+    for(int iC=0; iC<6; iC++)
+    {
+      for(unsigned int iPV=0; iPV<fPV.size(); iPV++)
+      {
+        float& tmpFloat = reinterpret_cast<float&>(data[offset + iPV]);
+        tmpFloat = fPV[iPV].Covariance(iC);
+      }
+      offset += fPV.size();
+    }    
+  }
+
+  void ReadDataFromVector(int* data)
+  {
+    /** Reads input data from the given memory.
+     ** \param[in] data - pointer to the memory with the input data
+     **/
+    int offset = NInputSets+2;
+    for(int iSet=0; iSet<NInputSets; iSet++)
+    {
+      fTracks[iSet].Resize(data[iSet]);
+      fTracks[iSet].ReadDataFromVector(data, offset);
+    }
+    
+    float& field = reinterpret_cast<float&>(data[NInputSets+1]);
+    fBz = field;
+    
+    fPV.resize(data[NInputSets]);
+                
+    for(int iP=0; iP<3; iP++)
+    {
+      for(unsigned int iPV=0; iPV<fPV.size(); iPV++)
+      {
+        float& tmpFloat = reinterpret_cast<float&>(data[offset + iPV]);
+        fPV[iPV].Parameter(iP) = tmpFloat;
+      }
+      offset += fPV.size();
+    }
+    
+    for(int iC=0; iC<6; iC++)
+    {
+      for(unsigned int iPV=0; iPV<fPV.size(); iPV++)
+      {
+        float& tmpFloat = reinterpret_cast<float&>(data[offset + iPV]);
+        fPV[iPV].Covariance(iC) = tmpFloat;
+      }
+      offset += fPV.size();
+    }        
+  }
+  
+  void Print()
+  {
+    /**Prints all fields of the current object.*/
+    for(int iSet=0; iSet<NInputSets; iSet++)
+      fTracks[iSet].Print();
+    std::cout << "N PV: " << fPV.size() << std::endl;
+    
+    std::cout << "X: ";
+    for(unsigned int iPV=0; iPV<fPV.size(); iPV++)
+      std::cout << fPV[iPV].X() <<" ";
+    std::cout << std::endl;
+        std::cout << "Y: ";
+    for(unsigned int iPV=0; iPV<fPV.size(); iPV++)
+      std::cout << fPV[iPV].Y() <<" ";
+    std::cout << std::endl;
+    std::cout << "Z: ";
+    for(unsigned int iPV=0; iPV<fPV.size(); iPV++)
+      std::cout << fPV[iPV].Z() <<" ";
+    std::cout << std::endl;
+
+    std::cout << "Cov matrix: " << std::endl;
+    for(int iC=0; iC<6; iC++)
+    {
+      std::cout << "  iC " << iC << ":  ";
+      for(unsigned int iPV=0; iPV<fPV.size(); iPV++)
+        std::cout << fPV[iPV].Covariance(iC) <<" ";
+      std::cout << std::endl;
+    }
+    
+    std::cout << "Field: " << fBz << std::endl;
+  }
+  
+  KFPTrackVector* GetTracks()  { return fTracks; } ///< Returns pointer to the array with track vectors.
+  float GetBz() const { return fBz; } ///< Returns value of the constant field Bz.
+  const std::vector<KFParticle>& GetPV() const { return fPV; } ///< Returns vector with primary vertices.
+
+  const KFPInputData& operator = (const KFPInputData& data)
+  {
+    /** Copies input data from object "data" to the current object. Returns the current object. \param[in] data - input data*/
+    for(int i=0; i<NInputSets; i++)
+      fTracks[i] = data.fTracks[i];
+    fPV = data.fPV;
+    fBz = data.fBz;
+    
+    return *this;
+  }
+  KFPInputData(const KFPInputData& data):fPV(0),fBz(0.f)
+  {
+    /** Copies input data from object "data" to the current object. \param[in] data - input data */
+    for(int i=0; i<NInputSets; i++)
+      fTracks[i] = data.fTracks[i];
+    fPV = data.fPV;
+    fBz = data.fBz;
+  }
+  
+ protected:
+  /** Array of track vectors: \n
+   ** 0 - positive secondary tracks stored at the first point; \n
+   ** 1 - negative secondary tracks stored at the first point; \n
+   ** 2 - positive primary tracks stored at the first point; \n
+   ** 3 - positive primary tracks stored at the first point; \n
+   ** 4 - positive secondary tracks stored at the last point; \n
+   ** 5 - negative secondary tracks stored at the last point; \n
+   ** 6 - positive primary tracks stored at the last point; \n
+   ** 7 - positive primary tracks stored at the last point.
+   ** \see KFPTrackVector for documentation.
+   **/
+  KFPTrackVector fTracks[NInputSets]__attribute__((aligned(sizeof(float_v)))); 
+  std::vector<KFParticle> fPV; ///< Vector with primary vertices.
+  float fBz; ///< Constant homogenious one-component magnetic field Bz.
+} __attribute__((aligned(sizeof(float_v))));
+
+/** @class KFPInputDataArray
+ ** @brief Structure with the set of the input data for KF Particle Finder.
+ ** @author  M.Zyzak, I.Kisel
+ ** @date 05.02.2019
+ ** @version 1.0
+ **
+ ** The structure contains pointer to array of KFPInputData objects. Copying of the 
+ ** objects of this structure is disabled.
+ **/
+
+struct KFPInputDataArray{
+  KFPInputDataArray():fInput(0){};
+  ~KFPInputDataArray() { if(fInput) delete [] fInput; }
+
+  KFPInputData *fInput; ///< Pointer to the array of the input data objects.
+  
+ private:
+   const KFPInputDataArray& operator = (const KFPInputDataArray&);
+   KFPInputDataArray(const KFPInputDataArray&);
+};
+
+
+/** @class KFPLinkedList
+ ** @brief Structure to creat a linked list of the input data.
+ ** @author  M.Zyzak, I.Kisel
+ ** @date 05.02.2019
+ ** @version 1.0
+ **
+ ** The structure contains pointer to array of KFPInputData objects. Copying of the 
+ ** objects of this structure is disabled. The list is used to create a queue for processing
+ ** at the device side (Intel Xeon Phi).
+ **/
+
+struct KFPLinkedList
+{
+  void *operator new(size_t size) { return _mm_malloc(size, sizeof(float_v)); }      ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void *operator new[](size_t size) { return _mm_malloc(size, sizeof(float_v)); }    ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void *operator new(size_t size, void *ptr) { return ::operator new(size, ptr);}    ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void *operator new[](size_t size, void *ptr) { return ::operator new(size, ptr);}  ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void operator delete(void *ptr, size_t) { _mm_free(ptr); }                         ///< delete operator for the SIMD-alligned dynamic memory release
+  void operator delete[](void *ptr, size_t) { _mm_free(ptr); }                       ///< delete operator for the SIMD-alligned dynamic memory release
+  
+  KFPInputData data __attribute__((aligned(sizeof(float_v)))); ///< Input data for KF Particle Finder \see KFPInputData.
+  KFPLinkedList* next; ///< Link to the nex object in the linked list.
+} __attribute__((aligned(sizeof(float_v))));
+
+#endif

+ 109 - 0
KFParticle/KFParticle/KFPSimdAllocator.h

@@ -0,0 +1,109 @@
+//----------------------------------------------------------------------------
+// Allocator for SIMDised KF Particle
+// .
+// @author  I.Kisel, I.Kulakov, M.Zyzak
+// @version 1.0
+// @since   20.08.13
+// 
+// 
+//  -= Copyright &copy ALICE HLT and CBM L1 Groups =-
+//____________________________________________________________________________
+
+#ifndef KFPSimdAllocator_H
+#define KFPSimdAllocator_H
+
+#include <Vc/Vc>
+
+/** @class KFPSimdAllocator
+ ** @brief Allocator which is needed to allocate memory in std::vector aligned by the size of SIMD vectors.
+ ** @author  M.Zyzak, I.Kisel
+ ** @date 05.02.2019
+ ** @version 1.0
+ **/
+
+template <class T>
+class KFPSimdAllocator {
+ public:
+ // type definitions
+  typedef T        value_type;
+  typedef T*       pointer;
+  typedef const T* const_pointer;
+  typedef T&       reference;
+  typedef const T& const_reference;
+  typedef std::size_t    size_type;
+  typedef std::ptrdiff_t difference_type;
+
+  /** @class rebind
+   ** @brief Rebind allocator to type U of the SIMD allocator.
+   ** @author  M.Zyzak, I.Kisel
+   ** @date 05.02.2019
+   ** @version 1.0
+   **/
+  template <class U>
+  struct rebind {
+    typedef KFPSimdAllocator<U> other;
+  };
+
+  /** Return address of "value". */
+  pointer address (reference value) const {
+    return &value;
+  }
+  /** Return address of "value". */
+  const_pointer address (const_reference value) const {
+    return &value;
+  }
+
+  /* constructors and destructor
+        * - nothing to do because the allocator has no state
+  */
+  KFPSimdAllocator() throw() { }
+  KFPSimdAllocator(const KFPSimdAllocator&) throw() {  }
+  template <class U>
+  KFPSimdAllocator (const KFPSimdAllocator<U>&) throw() {  }
+  ~KFPSimdAllocator() throw() {  }
+
+  /** Return maximum number of elements that can be allocated. */
+  size_type max_size () const throw() {
+    return std::numeric_limits<std::size_t>::max() / sizeof(T);
+  }
+
+  /** Allocate but don't initialize num elements of type T. */
+  pointer allocate (size_type num, const void* = 0) {
+//               print message and allocate memory with global new
+    pointer ret = reinterpret_cast<pointer>( /*T::*/operator new(num*sizeof(T)) );
+    return ret;
+  }
+
+  /** Initialize elements of allocated storage "p" with an empty element. */
+  void construct (pointer p) {
+  // initialize memory with placement new
+    new(p) T();
+  }
+  
+  /** Initialize elements of allocated storage "p" with value "value". */
+  void construct (pointer p, const T& value) {
+    new(p) T(value);
+  }
+
+  /** Destroy elements of initialized storage "p". */
+  void destroy (pointer p) {
+  // destroy objects by calling their destructor
+    p->~T();
+  }
+
+  /** Deallocate storage p of deleted elements. */
+  void deallocate (pointer p, size_type num) {
+  // print message and deallocate memory with global delete
+    /*T::*/operator delete(static_cast<void*>(p), num*sizeof(T));
+
+  }
+
+  void *operator new(size_t size, void *ptr) { return ::operator new(size, ptr);}      ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void *operator new[](size_t size, void *ptr) { return ::operator new(size, ptr);}    ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void *operator new(size_t size) { return _mm_malloc(size, sizeof(Vc::float_v)); }    ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void *operator new[](size_t size) { return _mm_malloc(size, sizeof(Vc::float_v)); }  ///< new operator for allocation of the SIMD-alligned dynamic memory allocation
+  void operator delete(void *ptr, size_t) { _mm_free(ptr); }                           ///< delete operator for the SIMD-alligned dynamic memory release
+  void operator delete[](void *ptr, size_t) { _mm_free(ptr); }                         ///< delete operator for the SIMD-alligned dynamic memory release
+}; // KFPSimdAllocator
+      
+#endif //KFPSimdAllocator

+ 84 - 0
KFParticle/KFParticle/KFPTrack.cxx

@@ -0,0 +1,84 @@
+//----------------------------------------------------------------------------
+// Implementation of the KFParticle class
+// .
+// @author  I.Kisel, I.Kulakov, M.Zyzak
+// @version 1.0
+// @since   20.08.13
+// 
+// 
+//  -= Copyright &copy ALICE HLT and CBM L1 Groups =-
+//____________________________________________________________________________
+
+#include "KFPTrack.h"
+
+#ifdef __ROOT__
+ClassImp(KFPTrack);
+#endif
+
+void KFPTrack::RotateXY( float alpha )
+{
+  /** Rotates the parameters of the track on an angle alpha in the XY plane.
+   ** Can be used in case of the transforamtion of the coordinate system.
+   ** The rotation matrix is:
+   ** \verbatim
+   {  cos(A), -sin(A),  0,        0,        0,   0 }
+   {  sin(A),  cos(A),  0,        0,        0,   0 }
+   {       0,       0,  1,        0,        0,   0 }
+   {       0,       0,  0,   cos(A),  -sin(A),   0 }
+   {       0,       0,  0,   sin(A),   cos(A),   0 }
+   {       0,       0,  0,        0,        0,   1 } 
+   \endverbatim
+   ** \param[in] alpha - rotation angle
+   **/
+  const float cA = cos( alpha );
+  const float sA = sin( alpha );
+
+  //float J[6][6] = { {  cA, -sA,  0,    0,    0,   0 }, // X
+  //                  {  sA,  cA,  0,    0,    0,   0 }, // Y
+  //                  {  0,   0,   1,    0,    0,   0 }, // Z
+  //                  {  0,   0,   0,   cA,  -sA,   0 }, // Px
+  //                  {  0,   0,   0,   sA,   cA,   0 }, // Py
+  //                  {  0,   0,   0,    0,    0,   1 } }; // Pz
+
+  const float x  = GetX(),  y = GetY();
+
+  SetX( -(x*sA +  y*cA) );
+  SetY( x*cA -  y*sA );
+
+  const float px  = GetPx(),  py = GetPy();
+
+  SetPx( -(px*sA + py*cA)  );
+  SetPy( px*cA - py*sA );
+
+  float cov[21];
+  for(int iC=0; iC<21; iC++)
+    cov[iC] = fC[iC];
+
+  fC[0] = cA*cA*  cov[2] + 2* cA* cov[1]* sA + cov[0]*sA* sA;
+  
+  fC[1] = -(cA*cA * cov[1]) + cA* (-cov[0] + cov[2])* sA + cov[1]*sA* sA;
+  fC[2] = cA*cA*  cov[0] - 2* cA* cov[1]* sA + cov[2]*sA* sA; 
+  
+  fC[3] = -(cA* cov[4]) - cov[3]* sA;
+  fC[4] = cA* cov[3] - cov[4]* sA;
+  fC[5] = cov[5]; 
+  
+  fC[6] = cA*cA*  cov[11] + cA *(cov[10] + cov[7])* sA + cov[6]*sA* sA;
+  fC[7] = -(cA*cA * cov[10]) + cA* (cov[11] - cov[6])* sA + cov[7] *sA*sA;
+  fC[8] = -(cA *cov[12]) - cov[8] *sA;
+  fC[9] = cA*cA*  cov[14] + 2 *cA* cov[13]* sA + cov[9]* sA*sA;
+
+  fC[10] = -(cA*cA*  cov[7]) + cA* (cov[11] - cov[6])* sA + cov[10]*sA* sA; 
+  fC[11] = cA*cA*  cov[6] - cA* (cov[10] + cov[7]) *sA + cov[11]*sA* sA;
+  fC[12] = cA* cov[8] - cov[12]* sA; 
+  fC[13] = -(cA*cA*  cov[13]) + cA* (cov[14] - cov[9])* sA + cov[13]* sA*sA;
+  fC[14] = cA*cA*  cov[9] - 2* cA* cov[13]* sA + cov[14]* sA*sA;
+  
+  fC[15] = -(cA* cov[16]) - cov[15]* sA;
+  fC[16] = cA* cov[15] - cov[16]* sA;
+  fC[17] = cov[17]; 
+  fC[18] = -(cA* cov[19]) - cov[18]* sA;
+  fC[19] = cA* cov[18] - cov[19]* sA;
+  fC[20] = cov[20];
+
+}

+ 220 - 0
KFParticle/KFParticle/KFPTrack.h

@@ -0,0 +1,220 @@
+//----------------------------------------------------------------------------
+// Implementation of the KFParticle class
+// .
+// @author  I.Kisel, I.Kulakov, M.Zyzak
+// @version 1.0
+// @since   20.08.13
+// 
+// 
+//  -= Copyright &copy ALICE HLT and CBM L1 Groups =-
+//____________________________________________________________________________
+
+#ifndef KFPTrack_H
+#define KFPTrack_H
+
+/** @class KFPTrack
+ ** @brief A scalar class for storage of the track in the cartesian parametrisation.
+ ** @author  M.Zyzak, I.Kisel
+ ** @date 05.02.2019
+ ** @version 1.0
+ **
+ ** A track is described with the state vector { X, Y, Z, Px, Py, Pz }
+ ** and the corresponding covariance matrix. Also contains charge of the
+ ** track, chi2 of the track fit, the corresponding number of degrees of freedom,
+ ** the unique Id of the track and the field approximation along the track trajectory.
+ **/
+
+#include <cmath>
+#include "TObject.h"
+class KFPTrack 
+//#ifdef __ROOT__
+: public TObject
+//#endif
+{
+
+public:
+  KFPTrack():fChi2(-1.f), fQ(0), fNDF(-1), fId(-1) { }
+  ~KFPTrack() { }
+
+  int    GetID() const { return fId; } ///< Returns Id of the track.
+  
+  bool   GetXYZPxPyPz(float *p) const 
+  {
+    /** Fills an array p with the parameters of the track.
+     ** \param[out] p - array where { X, Y, Z, Px, Py, Pz } are copied
+     **/
+    for(int i=0; i<6; i++)
+      p[i] = fP[i];
+    return 1;
+  }
+  bool   GetCovarianceXYZPxPyPz(float cv[21]) const
+  {
+    /** Copies the covariance matrix of the track to the array of floats.
+     ** \param[out] cv[21] - the output array, where the covariance matrix is copied
+     **/
+    for (int i=0; i<21; i++)
+      cv[i] = fC[i];
+    return 1;
+  }
+  bool   GetCovarianceXYZPxPyPz(double cv[21]) const
+  {
+    /** Copies the covariance matrix of the track to the array of doubles.
+     ** \param[out] cv[21] - the output array, where the covariance matrix is copied
+     **/
+    for (int i=0; i<21; i++)
+      cv[i] = fC[i];
+    return 1;
+  }
+
+  /** Copies position of the track to the output array of floats. \param[out] position - the output array with the position of the track **/
+  void   GetXYZ(float *position)    const {position[0] = fP[0]; position[1] = fP[1]; position[2] = fP[2];}
+  /** Copies 3 momentum components of the track to the output array of floats. \param[out] position - the output array with the momentum of the track **/
+  void   GetPxPyPz(float *position) const {position[0] = fP[3]; position[1] = fP[4]; position[2] = fP[5];}
+  /** Copies position of the track to the output array of floats. \param[out] position - the output array with the position of the track **/
+  void   XvYvZv(float *position)    const {position[0] = fP[0]; position[1] = fP[1]; position[2] = fP[2];}
+  /** Copies 3 momentum components of the track to the output array of floats. \param[out] position - the output array with the momentum of the track **/
+  void   PxPyPz(float *position) const {position[0] = fP[3]; position[1] = fP[4]; position[2] = fP[5];}
+  /** Copies position of the track to the output array of doubles. \param[out] position - the output array with the position of the track **/
+  void   XvYvZv(double *position)    const {position[0] = fP[0]; position[1] = fP[1]; position[2] = fP[2];}
+  /** Copies 3 momentum components of the track to the output array of doubles. \param[out] position - the output array with the momentum of the track **/
+  void   PxPyPz(double *position) const {position[0] = fP[3]; position[1] = fP[4]; position[2] = fP[5];}
+
+  float GetX() const { return fP[0]; }  ///< Returns X coordinate of the track.
+  float GetY() const { return fP[1]; }  ///< Returns Y coordinate of the track.
+  float GetZ() const { return fP[2]; }  ///< Returns Z coordinate of the track.
+  float GetPx() const { return fP[3]; } ///< Returns Px component of the momentum of the track.
+  float GetPy() const { return fP[4]; } ///< Returns Py component of the momentum of the track.
+  float GetPz() const { return fP[5]; } ///< Returns Pz component of the momentum of the track.
+
+  float GetPt() const { return sqrt(fP[3]*fP[3]+fP[4]*fP[4]); } ///< Returns Pt - transverse momentum of the track.
+  float GetP()  const { return sqrt(fP[3]*fP[3]+fP[4]*fP[4]+fP[5]*fP[5]); } ///< Returns P - momentum of the track.
+
+  void GetCovarianceMatrix(float *covmatrix)
+  {
+    /** Copies the covariance matrix of the track to the array of floats.
+     ** \param[out] covmatrix[21] - the output array, where the covariance matrix is copied
+     **/
+    for (int i=0; i<21; i++)
+      covmatrix[i] = fC[i];
+  }
+  float GetParameter(int i) const { return fP[i]; }  ///< Returns parameter "i" of the track. \param[in] i - index of the parameter to be returned
+  float GetCovariance(int i) const { return fC[i]; } ///< Returns element of the covariance matrix "i" of the track. \param[in] i - index of the element to be returned
+
+  int    Charge()        const { return fQ; }        ///< Returns charge of the track.
+  float GetChi2perNDF() const { return fChi2/fNDF; } ///< Returns Chi2/NDF of the track, NDF is a number of degrees of freedom.
+  float GetChi2()       const { return fChi2;      } ///< Returns Chi2 of the track.
+  int    GetNDF()        const { return fNDF; }      ///< Returns number of degrees of freedom of the track.
+
+  const float * GetTrack() const { return fP; }     ///< Returns a pointer to the array of track parameters.
+  const float * GetCovMatrix() const { return fC; } ///< Returns a pointer to the array of the covariance matrix elements stored in a lower triangular form.
+
+  void SetParameters(const float *position) 
+  {
+    /** Sets parameters { X, Y, Z, Px, Py, Pz } of the track from the input array of floats.
+     ** \param[in] position - input array with the track parameters
+     **/
+    for(int i=0; i<6; i++)
+      fP[i] = position[i];
+  }
+  void SetParameters(double *position) 
+  { 
+    /** Sets parameters { X, Y, Z, Px, Py, Pz } of the track from the input array of doubles.
+     ** \param[in] position - input array with the track parameters
+     **/
+    for(int i=0; i<6; i++)
+      fP[i] = position[i];
+  }
+  void SetParameters(float x, float y, float z, float px, float py, float pz) 
+  { 
+    /** Sets parameters { X, Y, Z, Px, Py, Pz } of the track.
+     ** \param[in] x - X coordinate to be set
+     ** \param[in] y - Y coordinate to be set
+     ** \param[in] z - Z coordinate to be set
+     ** \param[in] Px - Px momentum component to be set
+     ** \param[in] Py - Py momentum component to be set
+     ** \param[in] Pz - Pz momentum component to be set
+     **/
+    fP[0] = x;  fP[1] = y;  fP[2] = z;
+    fP[3] = px; fP[4] = py; fP[5] = pz;
+  }
+  void SetXYZ(float x, float y, float z) 
+  { 
+    /** Sets position { X, Y, Z } of the track.
+     ** \param[in] x - X coordinate to be set
+     ** \param[in] y - Y coordinate to be set
+     ** \param[in] z - Z coordinate to be set
+     **/
+    fP[0] = x;  fP[1] = y;  fP[2] = z;
+  }
+  void SetPxPyPz(float px, float py, float pz) 
+  { 
+    /** Sets momentum { Px, Py, Pz } of the track.
+     ** \param[in] Px - Px momentum component to be set
+     ** \param[in] Py - Py momentum component to be set
+     ** \param[in] Pz - Pz momentum component to be set
+     **/
+    fP[3] = px; fP[4] = py; fP[5] = pz;
+  }
+  void SetID(int id)       {fId = id;}      ///< Sets Id of the track.
+
+  void SetX(float x)      { fP[0] = x; }    ///< Sets X coordinate of the track.
+  void SetY(float y)      { fP[1] = y; }    ///< Sets Y coordinate of the track.
+  void SetZ(float z)      { fP[2] = z; }    ///< Sets Z coordinate of the track.
+  void SetPx(float px)      { fP[3] = px; } ///< Sets Px component of the track momentum.
+  void SetPy(float py)      { fP[4] = py; } ///< Sets Py component of the track momentum.
+  void SetPz(float pz)      { fP[5] = pz; } ///< Sets Pz component of the track momentum.
+  void SetCharge(int q) { fQ = q; }         ///< Sets charge of the track.
+  void SetChi2(float chi) { fChi2 = chi; }  ///< Sets a value of the track Chi2.
+  void SetNDF(int ndf)     { fNDF = ndf; }  ///< Sets a value of the number of degrees of freedom.
+
+  void SetCovarianceMatrix(const float *C)
+  {
+    /** Sets the covariance matrix from the input array of floats.
+     ** \param[in] C[21] - array with the input elements of the covariance matrix stored in the lower triangular form
+     **/
+    for (int i=0; i<21; i++)
+      fC[i] = C[i];
+  }
+  void SetCovarianceMatrix(const double *C)
+  {
+    /** Sets the covariance matrix from the input array of doubles.
+     ** \param[in] C[21] - array with the input elements of the covariance matrix stored in the lower triangular form
+     **/
+    for (int i=0; i<21; i++)
+      fC[i] = C[i];
+  }
+  
+  /** Sets an element of the covariance matrix with index "i". \param[in] c - value to be set \param[in] i - index of the element */
+  void SetCovariance(const int i, const float c) { fC[i]=c; } 
+  
+  void RotateXY( float alpha ); // rotate on alpha in XY plane. Should be useful for CS change
+
+  int Id() const { return fId; }    ///< Returns Id of the track.
+  void SetId( int id ){ fId = id; } ///< Sets Id of the track.
+
+#ifdef NonhomogeneousField
+  const float* GetFieldCoeff() const { return fieldRegion; } ///< Returns array of the coefficients for field approximation.
+  /** Sets a field coefficient with index "i". \param[in] c - value to be set \param[in] i - index of the element */
+  void SetFieldCoeff(float c, int i) { fieldRegion[i] = c; } 
+#endif
+ private:
+
+  float fP[6];  ///< Parameters of the track: { X, Y, Z, Px, Py, Pz }.
+  float fC[21]; ///< Covariance matrix of the track parameters. Stored in the lower triangular form.
+  float fChi2;  ///< Chi-square of the track fit.
+  char fQ;      ///< Charge of the track.
+  short fNDF;   ///< Number of degree of freedom of the fit.
+  int fId;      ///< Id of the track.
+  
+#ifdef NonhomogeneousField
+  /** \brief Approximation of the magnetic field along the track trajectory.
+   ** Each component (Bx, By, Bz) is approximated with the parabola depending on Z coordinate. Is defined in case of #ifdef NonhomogeneousField.
+   **/
+  float fieldRegion[10];
+#endif
+//#ifdef __ROOT__
+  ClassDef(KFPTrack,1)
+//#endif
+};
+
+#endif

+ 412 - 0
KFParticle/KFParticle/KFPTrackVector.cxx

@@ -0,0 +1,412 @@
+//----------------------------------------------------------------------------
+// Implementation of the KFParticle class
+// .
+// @author  I.Kisel, I.Kulakov, M.Zyzak
+// @version 1.0
+// @since   20.08.13
+// 
+// 
+//  -= Copyright &copy ALICE HLT and CBM L1 Groups =-
+//____________________________________________________________________________
+
+#include "KFPTrackVector.h"
+#include <iostream>
+
+void KFPTrackVector::SetParameter(const float_v& value, int iP, int iTr)
+{ 
+  /** Copies the SIMD vector "value" to the parameter vector KFPTrackVector::fP[iP]
+   ** starting at the position "iTr".
+   ** \param[in] value - SIMD vector with the values to be stored
+   ** \param[in] iP - number of the parameter vector
+   ** \param[in] iTr - starting position in the parameter vector where the values should be stored
+   **/
+// gather caused errors at XeonPhi, temporarly replaced with the simple copying
+//   if( (iTr+float_vLen) < Size())
+//     reinterpret_cast<float_v&>(fP[iP][iTr]) = value;
+//   else
+//   {
+//     const uint_v index(uint_v::IndexesFromZero());
+//     (reinterpret_cast<float_v&>(fP[iP][iTr])).gather(reinterpret_cast<const float*>(&value), index, float_m(index<(Size() - iTr)));
+//   }
+  
+  if( (iTr+float_vLen) < Size())
+    reinterpret_cast<float_v&>(fP[iP][iTr]) = value;
+  else
+    for(int i=0; i<float_v::Size; i++)
+    {
+      if(iTr + i >= Size()) continue;
+      fP[iP][iTr+i] = value[i];
+    } 
+}
+void KFPTrackVector::SetCovariance(const float_v& value, int iC, int iTr) 
+{