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 O2_TRACK_METHODS_STUDY_H
17#define O2_TRACK_METHODS_STUDY_H
18
24#include <set>
25#include <vector>
26
27namespace o2
28{
29namespace its
30{
31namespace study
32{
34{
35 public:
36 static void countTPCClusters(const o2::tpc::TrackTPC& track,
37 const gsl::span<const o2::tpc::TPCClRefElem>& tpcClusRefs,
38 const gsl::span<const unsigned char>& tpcClusShMap,
39 const o2::tpc::ClusterNativeAccess& tpcClusAcc,
40 uint8_t& shared, uint8_t& found, uint8_t& crossed)
41 {
42 LOGP(info, "tpcClusRefs {}/{}", (void*)tpcClusRefs.data(), tpcClusRefs.size());
43 LOGP(info, "tpcClusShMap {}/{}", (void*)tpcClusShMap.data(), tpcClusShMap.size());
44 LOGP(info, " tpcClusAcc{}/{}", (void*)tpcClusAcc.clustersLinear, tpcClusAcc.nClustersTotal);
45 constexpr int maxRows = 152;
46 constexpr int neighbour = 2;
47 std::array<bool, maxRows> clMap{}, shMap{};
48 uint8_t sectorIndex;
49 uint8_t rowIndex;
50 uint32_t clusterIndex;
51 shared = 0;
52 for (int i = 0; i < track.getNClusterReferences(); i++) {
53 o2::tpc::TrackTPC::getClusterReference(tpcClusRefs, i, sectorIndex, rowIndex, clusterIndex, track.getClusterRef());
54 unsigned int absoluteIndex = tpcClusAcc.clusterOffset[sectorIndex][rowIndex] + clusterIndex;
55 clMap[rowIndex] = true;
56 if (tpcClusShMap[absoluteIndex] & o2::gpu::GPUTPCGMMergedTrackHit::flagShared) {
57 if (!shMap[rowIndex]) {
58 shared++;
59 }
60 shMap[rowIndex] = true;
61 }
62 }
63
64 crossed = 0;
65 found = 0;
66 int last = -1;
67 for (int i = 0; i < maxRows; i++) {
68 if (clMap[i]) {
69 crossed++;
70 found++;
71 last = i;
72 } else if ((i - last) <= neighbour) {
73 crossed++;
74 } else {
75 int lim = std::min(i + 1 + neighbour, maxRows);
76 for (int j = i + 1; j < lim; j++) {
77 if (clMap[j]) {
78 crossed++;
79 }
80 }
81 }
82 }
83 }
84 static bool FulfillsITSHitRequirements(uint8_t itsClusterMap, std::vector<std::pair<int8_t, std::set<uint8_t>>> mRequiredITSHits)
85 {
86 constexpr uint8_t bit = 1;
87 for (auto& itsRequirement : mRequiredITSHits) {
88 auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return itsClusterMap & (bit << requiredLayer); });
89 if ((itsRequirement.first == -1) && (hits > 0)) {
90 return false; // no hits were required in specified layers
91 } else if (hits < itsRequirement.first) {
92 return false; // not enough hits found in specified layers
93 }
94 }
95 return true;
96 }
97
98 private:
99 std::vector<std::pair<int8_t, std::set<uint8_t>>> mRequiredITSHits{};
100 ClassDefNV(TrackMethods, 1);
101};
102} // namespace study
103} // namespace its
104} // namespace o2
105
106#endif
Class to perform track cuts.
int32_t i
uint32_t j
Definition RawData.h:0
Definition of the ITS track.
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)
static bool FulfillsITSHitRequirements(uint8_t itsClusterMap, std::vector< std::pair< int8_t, std::set< uint8_t > > > mRequiredITSHits)
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