Project
Loading...
Searching...
No Matches
VertexUtils.h
Go to the documentation of this file.
1
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
14
15
#ifndef O2_ITS_TRACKING_VERTEXUTILS_H_
16
#define O2_ITS_TRACKING_VERTEXUTILS_H_
17
18
#include "
DataFormatsITS/Vertex.h
"
19
#include "
SimulationDataFormat/MCCompLabel.h
"
20
#include "
ITStracking/Configuration.h
"
21
22
#include <limits>
23
#include <unordered_map>
24
#include <utility>
25
26
namespace
o2::its
27
{
28
31
template
<
typename
Container>
32
VertexLabel
computeMainVertexLabel
(
const
Container& elements)
33
{
34
// we only care about the source&event of the tracks, not the trackId
35
auto
composeVtxLabel = [](
const
o2::MCCompLabel
& lbl) ->
o2::MCCompLabel
{
36
return
{
o2::MCCompLabel::maxTrackID
(), lbl.
getEventID
(), lbl.getSourceID(), lbl.isFake()};
37
};
38
std::unordered_map<o2::MCCompLabel, size_t> frequency;
39
for
(
const
auto
&
element
: elements) {
40
++frequency[composeVtxLabel(
element
)];
41
}
42
o2::MCCompLabel
elem{};
43
size_t
maxCount
= 0;
44
for
(
const
auto
& [
key
,
count
] : frequency) {
45
if
(
count
>
maxCount
) {
46
maxCount
=
count
;
47
elem =
key
;
48
}
49
}
50
if
(
maxCount
<= 1) {
// need >50%
51
elem.
setFakeFlag
();
52
}
53
return
std::make_pair(elem,
static_cast<
float
>
(
maxCount
) /
static_cast<
float
>
(elements.size()));
54
}
55
56
inline
Vertex
makeDiamondVertex
(
const
TrackingParameters
& trkParam)
57
{
58
Vertex
diamond(trkParam.
Diamond
, trkParam.
DiamondCov
, 1, 1.f);
59
diamond.setTimeStamp({0u, std::numeric_limits<TimeStampErrorType>::max()});
60
return
diamond;
61
}
62
63
}
// namespace o2::its
64
65
#endif
/* O2_ITS_TRACKING_VERTEXUTILS_H_ */
Vertex.h
Configuration.h
element
atype::type element
Definition
ExpressionJSONHelpers.cxx:673
MCCompLabel.h
key
StringRef key
Definition
catch_amalgamated.cxx:4853
o2::MCCompLabel
Definition
MCCompLabel.h:24
o2::MCCompLabel::maxTrackID
static constexpr int maxTrackID()
Definition
MCCompLabel.h:153
o2::MCCompLabel::setFakeFlag
void setFakeFlag(bool v=true)
Definition
MCCompLabel.h:114
o2::MCCompLabel::getEventID
int getEventID() const
Definition
MCCompLabel.h:136
o2::dataformats::Vertex
Definition
Vertex.h:136
count
GLint GLsizei count
Definition
glcorearb.h:399
maxCount
GLsizei maxCount
Definition
glcorearb.h:792
o2::its
Definition
RecoContainer.h:65
o2::its::VertexLabel
std::pair< o2::MCCompLabel, float > VertexLabel
Definition
Vertex.h:27
o2::its::computeMainVertexLabel
VertexLabel computeMainVertexLabel(const Container &elements)
Definition
VertexUtils.h:32
o2::its::makeDiamondVertex
Vertex makeDiamondVertex(const TrackingParameters &trkParam)
Definition
VertexUtils.h:56
o2::its::TrackingParameters
Definition
Configuration.h:53
o2::its::TrackingParameters::Diamond
float Diamond[3]
Definition
Configuration.h:104
o2::its::TrackingParameters::DiamondCov
float DiamondCov[6]
Definition
Configuration.h:105
Detectors
ITSMFT
ITS
tracking
include
ITStracking
VertexUtils.h
Generated on Sat Oct 10 2026 01:25:45 for Project by
1.9.8