Project
Loading...
Searching...
No Matches
DigitsMerger.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 DigitsMerger::process(const std::vector<ColumnData>& inDigitStore, const o2::dataformats::MCTruthContainer<MCLabel>& inMCContainer, const std::vector<ROFRecord>& inROFRecords, bool mergeInBunchPileup)
24{
25 process(inDigitStore, inROFRecords, &inMCContainer, mergeInBunchPileup);
26}
27
28void DigitsMerger::process(gsl::span<const ColumnData> inDigitStore, gsl::span<const ROFRecord> inROFRecords, const o2::dataformats::MCTruthContainer<MCLabel>* inMCContainer, bool mergeInBunchPileup)
29{
30 mDigitStore.clear();
31 mMCContainer.clear();
32 mROFRecords.clear();
33
34 for (auto rofIt = inROFRecords.begin(); rofIt != inROFRecords.end(); ++rofIt) {
35 auto nextRofIt = rofIt + 1;
36 bool mergeInteractions = mergeInBunchPileup && nextRofIt != inROFRecords.end() && rofIt->interactionRecord == nextRofIt->interactionRecord;
37
38 for (size_t idigit = rofIt->firstEntry, end = rofIt->getEndIndex(); idigit < end; ++idigit) {
39 mHandler.merge(inDigitStore[idigit], idigit);
40 }
41
42 if (mergeInteractions) {
43 continue;
44 }
45
46 auto firstEntry = mDigitStore.size();
47 auto digits = mHandler.getMerged();
48 mROFRecords.emplace_back(rofIt->interactionRecord, rofIt->eventType, firstEntry, digits.size());
49 mDigitStore.insert(mDigitStore.end(), digits.begin(), digits.end());
50
51 if (inMCContainer) {
52 for (auto imdig = 0; imdig < digits.size(); ++imdig) {
53 auto indexes = mHandler.getMergedIndexes(digits[imdig]);
54 for (auto labelIdx : indexes) {
55 mMCContainer.addElements(firstEntry + imdig, inMCContainer->getLabels(labelIdx));
56 }
57 }
58 }
59 mHandler.clear();
60 }
61}
62} // namespace mid
63} // namespace o2
Digits merger for MID.
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
A container to hold and manage MC truth information/labels.
gsl::span< TruthElement > getLabels(uint32_t dataindex)
void clear()
Clears inner maps.
std::vector< size_t > getMergedIndexes(const ColumnData &col) const
Returns the indexes of the ColumnData merged into this one.
bool merge(const ColumnData &col, size_t idx=0)
Merges digit.
std::vector< ColumnData > getMerged() const
Returns the merged data.
void process(const std::vector< ColumnData > &inDigitStore, const o2::dataformats::MCTruthContainer< MCLabel > &inMCContainer, const std::vector< ROFRecord > &inROFRecords, bool mergeInBunchPileup=true)
Merges the MC digits that are provided per hit into the format that we expect from data.
GLuint GLuint end
Definition glcorearb.h:469
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< Digit > digits