Skip to content

Commit 14c043f

Browse files
committed
Templated secondary N-prong vertex fitter
1 parent f189c01 commit 14c043f

12 files changed

Lines changed: 1362 additions & 3 deletions

File tree

Detectors/Base/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ if(BUILD_SIMULATION)
4949
VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/${CMAKE_INSTALL_DATADIR})
5050
endif()
5151

52+
o2_add_test(
53+
DCAFitter
54+
SOURCES test/testDCAFitter.cxx
55+
COMPONENT_NAME DetectorsBase
56+
PUBLIC_LINK_LIBRARIES O2::DetectorsBase
57+
LABELS detectorsbase
58+
ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage
59+
VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/${CMAKE_INSTALL_DATADIR})
60+
5261
o2_add_test_root_macro(test/buildMatBudLUT.C
5362
PUBLIC_LINK_LIBRARIES O2::DetectorsBase
5463
LABELS detectorsbase)

Detectors/Base/test/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
\page refDetectorsBasetest Detectors Base test
33
/doxy -->
44

5-
# WORK IN PROGRESS: Mat.Budget LUT classes
5+
# Tests
66

7+
## Mat.Budget LUT classes
78

89
To generate the LUT (at the moment for R<400, with layers above 270 cm not optimized) run
910
```

Detectors/Base/test/testDCAFitter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
1010

11-
#define BOOST_TEST_MODULE Test MCTruthContainer class
11+
#define BOOST_TEST_MODULE Test DCAFitter class
1212
#define BOOST_TEST_MAIN
1313
#define BOOST_TEST_DYN_LINK
1414
#include <boost/test/unit_test.hpp>

Detectors/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ add_subdirectory(TPC)
3030

3131
add_subdirectory(GlobalTracking)
3232
add_subdirectory(GlobalTrackingWorkflow)
33+
add_subdirectory(Vertexing)
3334

3435
if(BUILD_SIMULATION)
3536
add_subdirectory(gconfig)

Detectors/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ There is no module description yet.
1010
This module contains the following submodules:
1111
1212
* \subpage refDetectorsRaw
13+
* \subpage refDetectorsBase
1314
* \subpage refDetectorsBasetest
15+
* \subpage refDetectorsGlobalTracking
16+
* \subpage refDetectorsVertexing
1417
* \subpage refDetectorsEMCAL
1518
* \subpage refDetectorsFIT
1619
* \subpage refDetectorsGeometry
17-
* \subpage refDetectorsGlobalTracking
1820
* \subpage refDetectorsHMPID
1921
* \subpage refDetectorsITSMFT
2022
* \subpage refDetectorsMUON

Detectors/Vertexing/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright CERN and copyright holders of ALICE O2. This software is distributed
2+
# under the terms of the GNU General Public License v3 (GPL Version 3), copied
3+
# verbatim in the file "COPYING".
4+
#
5+
# See http://alice-o2.web.cern.ch/license for full licensing information.
6+
#
7+
# In applying this license CERN does not waive the privileges and immunities
8+
# granted to it by virtue of its status as an Intergovernmental Organization or
9+
# submit itself to any jurisdiction.
10+
11+
o2_add_library(Vertexing
12+
SOURCES src/DCAFitterN.cxx
13+
PUBLIC_LINK_LIBRARIES ROOT::Core
14+
O2::CommonUtils
15+
O2::ReconstructionDataFormats)
16+
17+
o2_target_root_dictionary(Vertexing
18+
HEADERS include/DetectorsVertexing/HelixHelper.h
19+
include/DetectorsVertexing/DCAFitterN.h)
20+
21+
o2_add_test(
22+
DCAFitterN
23+
SOURCES test/testDCAFitterN.cxx
24+
COMPONENT_NAME Vertexing
25+
PUBLIC_LINK_LIBRARIES O2::Vertexing ROOT::Core ROOT::Physics
26+
LABELS vertexing
27+
ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage
28+
VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/${CMAKE_INSTALL_DATADIR})

Detectors/Vertexing/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!-- doxy
2+
\page refDetectorsVertexing Detectors Vertexing
3+
/doxy -->
4+
5+
# Classes for Vertexing
6+
7+
## DCAFitterN
8+
9+
Templated class to fit the Point of Closest Approach (PCA) of secondary vertex with N prongs. Allows minimization of either absolute or weighted Distances of Closest Approach (DCA) of N tracks to their common PCA.
10+
11+
For every N (prongs) a separate specialization must be instantiated, e.g.
12+
```cpp
13+
using Track = o2::track::TrackParCov;
14+
o2::vertexing::DCAFitterN<2,Track> ft2; // 2-prongs fitter
15+
// or, to set at once some parameters
16+
float bz = 5.; // field in kGauss
17+
bool useAbsDCA = true; // use abs. DCA minimizaition instead of default weighted
18+
bool propToDCA = true; // after fit, create a copy of tracks at the found PCA
19+
o2::vertexing::DCAFitterN<3,Track> ft3(bz, useAbsDCA, propToDCA); // 3-prongs fitter
20+
```
21+
One can also use predefined aliases ``o2::vertexing::DCAFitter2`` and ``o2::vertexing::DCAFitter3``;
22+
The main processing method is
23+
```cpp
24+
o2::vertexing::DCAFitterN<N,Track>::process(const Track& trc1,..., cons Track& trcN);
25+
```
26+
27+
The typical use case is (for e.g. 3-prong fitter):
28+
```cpp
29+
using Vec3D = ROOT::Math::SVector<double,3>; // this is a type of the fitted vertex
30+
o2::vertexing::DCAFitter3 ft;
31+
ft.setBz(5.0);
32+
ft.setPropagateToPCA(true); // After finding the vertex, propagate tracks to the DCA. This is default anyway
33+
ft.setMaxR(200); // do not consider V0 seeds with 2D circles crossing above this R. This is default anyway
34+
ft.setMaxDZIni(4); // do not consider V0 seeds with tracks Z-distance exceeding this. This is default anyway
35+
ft.setMinParamChange(1e-3); // stop iterations if max correction is below this value. This is default anyway
36+
ft.setMinRelChi2Change(0.9);// stop iterations if chi2 improves by less that this factor
37+
ft.setMaxChi2(10); // discard vertices with chi2/Nprongs (or sum{DCAi^2}/Nprongs for abs. distance minimization)
38+
39+
Track tr0,tr1,tr2; // decide candidate tracks
40+
int nc = ft.process(tr0,tr1,tr2); // one can have up to 2 candidates, though the 2nd (if any) will have worse quality
41+
if (nc) {
42+
Vec3D vtx = ft.getPCACandidate(); // same as ft.getPCACandidate(0);
43+
LOG(INFO) << "found vertex " << vtx[0] << ' ' << vtx[1] << ' ' << vtx[2];
44+
// access the track's X parameters at PCA
45+
for (int i=0;i<3;i++) {
46+
LOG(INFO) << "Track " << i << " at PCA for X = " << ft.getTrackX(i);
47+
}
48+
// access directly the tracks propagated to the DCA
49+
for (int i=0;i<3;i++) {
50+
const auto& track = ft.getTrack(i);
51+
track.print();
52+
}
53+
}
54+
```
55+
56+
See ``O2/Detectors/Base/test/testDCAFitterN.cxx`` for more extended example.
57+
Currently only 2 and 3 prongs permitted, thought this can be changed by modifying ``DCAFitterN::NMax`` constant.

0 commit comments

Comments
 (0)