Project
Loading...
Searching...
No Matches
PreClusterLabeler.cxx
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
17
18namespace o2
19{
20namespace mid
21{
22
23void PreClusterLabeler::process(gsl::span<const PreCluster> preClusters, const o2::dataformats::MCTruthContainer<MCLabel>& inMCContainer, gsl::span<const ROFRecord> rofRecordsPC, gsl::span<const ROFRecord> rofRecordsData)
24{
26 mMCContainer.clear();
27 auto dataROFIt = rofRecordsData.begin();
28 for (auto pcROFIt = rofRecordsPC.begin(); pcROFIt != rofRecordsPC.end(); ++pcROFIt) {
29 for (size_t ipc = pcROFIt->firstEntry; ipc < pcROFIt->firstEntry + pcROFIt->nEntries; ++ipc) {
30 for (size_t idata = dataROFIt->firstEntry; idata < dataROFIt->firstEntry + dataROFIt->nEntries; ++idata) {
31 auto labels = inMCContainer.getLabels(idata);
32 for (auto& label : labels) {
33 if (label.getCathode() != preClusters[ipc].cathode) {
34 continue;
35 }
36 if (label.getDEId() != preClusters[ipc].deId) {
37 continue;
38 }
39 int columnId = label.getColumnId();
40 if (columnId < preClusters[ipc].firstColumn || columnId > preClusters[ipc].lastColumn) {
41 continue;
42 }
43 int firstStrip = MCLabel::getStrip(preClusters[ipc].firstStrip, preClusters[ipc].firstLine);
44 int lastStrip = MCLabel::getStrip(preClusters[ipc].lastStrip, preClusters[ipc].lastLine);
45 if ((columnId == preClusters[ipc].firstColumn && label.getLastStrip() < firstStrip) || (columnId == preClusters[ipc].lastColumn && label.getFirstStrip() > lastStrip)) {
46 continue;
47 }
48
49 addLabel(ipc, label);
50 }
51 }
52 }
53 ++dataROFIt;
54 }
55}
56
57bool PreClusterLabeler::isDuplicated(size_t idx, const MCLabel& label) const
58{
60 if (idx >= mMCContainer.getIndexedSize()) {
61 return false;
62 }
63
64 for (auto& lb : mMCContainer.getLabels(idx)) {
65 if (label.compare(lb) == 1) {
66 return true;
67 }
68 }
69
70 return false;
71}
72
73bool PreClusterLabeler::addLabel(size_t idx, const MCLabel& label)
74{
76 if (isDuplicated(idx, label)) {
77 return false;
78 }
79 MCCompLabel lb(label.getTrackID(), label.getEventID(), label.getSourceID(), label.isFake());
80 mMCContainer.addElement(idx, lb);
81 return true;
82}
83
84} // namespace mid
85} // namespace o2
PreClusterLabeler for MID.
A container to hold and manage MC truth information/labels.
gsl::span< TruthElement > getLabels(uint32_t dataindex)
static int getStrip(int strip, int line)
Gets the strip.
Definition MCLabel.h:81
void process(gsl::span< const PreCluster > preClusters, const o2::dataformats::MCTruthContainer< MCLabel > &inMCContainer, gsl::span< const ROFRecord > rofRecordsPC, gsl::span< const ROFRecord > rofRecordsData)
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
gsl::span< const PreCluster > preClusters(preClusterizer.getPreClusters().data(), preClusterizer.getPreClusters().size())
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...