Project
Loading...
Searching...
No Matches
TrackMethods.h
Go to the documentation of this file.
1// Copyright 2019-2020 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
15
16#ifndef ALICEO2_TRACKMETHODS_H
17#define ALICEO2_TRACKMETHODS_H
18
22#include <set>
23#include <vector>
24
25namespace o2
26{
28{
29 public:
30 static void countTPCClusters(const o2::tpc::TrackTPC& track,
31 const gsl::span<const o2::tpc::TPCClRefElem>& tpcClusRefs,
32 const gsl::span<const unsigned char>& tpcClusShMap,
33 const o2::tpc::ClusterNativeAccess& tpcClusAcc,
34 uint8_t& shared, uint8_t& found, uint8_t& crossed)
35 {
36 LOGP(debug, "tpcClusRefs {}/{}", (void*)tpcClusRefs.data(), tpcClusRefs.size());
37 LOGP(debug, "tpcClusShMap {}/{}", (void*)tpcClusShMap.data(), tpcClusShMap.size());
38 LOGP(debug, "tpcClusAcc {}/{}", (void*)tpcClusAcc.clustersLinear, tpcClusAcc.nClustersTotal);
39 constexpr int maxRows = 152;
40 constexpr int neighbour = 2;
41 std::array<bool, maxRows> clMap{}, shMap{};
42 uint8_t sectorIndex;
43 uint8_t rowIndex;
44 uint32_t clusterIndex;
45 shared = 0;
46 for (int i = 0; i < track.getNClusterReferences(); i++) {
47 o2::tpc::TrackTPC::getClusterReference(tpcClusRefs, i, sectorIndex, rowIndex, clusterIndex, track.getClusterRef());
48 unsigned int absoluteIndex = tpcClusAcc.clusterOffset[sectorIndex][rowIndex] + clusterIndex;
49 clMap[rowIndex] = true;
50 if (tpcClusShMap[absoluteIndex] & o2::gpu::GPUTPCGMMergedTrackHit::flagShared) {
51 if (!shMap[rowIndex]) {
52 shared++;
53 }
54 shMap[rowIndex] = true;
55 }
56 }
57
58 crossed = 0;
59 found = 0;
60 int last = -1;
61 for (int i = 0; i < maxRows; i++) {
62 if (clMap[i]) {
63 crossed++;
64 found++;
65 last = i;
66 } else if ((i - last) <= neighbour) {
67 crossed++;
68 } else {
69 int lim = std::min(i + 1 + neighbour, maxRows);
70 for (int j = i + 1; j < lim; j++) {
71 if (clMap[j]) {
72 crossed++;
73 }
74 }
75 }
76 }
77 }
78 static bool FulfillsITSHitRequirements(uint8_t itsClusterMap, std::vector<std::pair<int8_t, std::set<uint8_t>>> mRequiredITSHits)
79 {
80 constexpr uint8_t bit = 1;
81 for (auto& itsRequirement : mRequiredITSHits) {
82 auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return itsClusterMap & (bit << requiredLayer); });
83 if ((itsRequirement.first == -1) && (hits > 0)) {
84 return false; // no hits were required in specified layers
85 } else if (hits < itsRequirement.first) {
86 return false; // not enough hits found in specified layers
87 }
88 }
89 return true;
90 }
91
93};
94} // namespace o2
95
96#endif
int32_t i
uint32_t j
Definition RawData.h:0
Definition of the ITS track.
std::ostringstream debug
static bool FulfillsITSHitRequirements(uint8_t itsClusterMap, std::vector< std::pair< int8_t, std::set< uint8_t > > > mRequiredITSHits)
static void countTPCClusters(const o2::tpc::TrackTPC &track, const gsl::span< const o2::tpc::TPCClRefElem > &tpcClusRefs, const gsl::span< const unsigned char > &tpcClusShMap, const o2::tpc::ClusterNativeAccess &tpcClusAcc, uint8_t &shared, uint8_t &found, uint8_t &crossed)
ClassDefNV(TrackMethods, 1)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
unsigned int clusterOffset[constants::MAXSECTOR][constants::MAXGLOBALPADROW]
const ClusterNative * clustersLinear