Project
Loading...
Searching...
No Matches
Strip.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
12//
13// Strip.cxx: structure to store the TOF digits in strips - useful
14// for clusterization purposes
15// ALICEO2
16//
17#include <cstring>
18#include <tuple>
19
20#include <TMath.h>
21#include <TObjArray.h>
22
23#include "TOFBase/Strip.h"
24
25using namespace o2::tof;
26
28
30
31//_______________________________________________________________________
33 : mStripIndex(index)
34{
35}
36//_______________________________________________________________________
37Int_t Strip::addDigit(Int_t channel, Int_t tdc, Int_t tot, uint64_t bc, Int_t lbl, uint32_t triggerorbit, uint16_t triggerbunch, float geanttime, double t0)
38{
39
40 // return the MC label. We pass it also as argument, but it can change in
41 // case the digit was merged
42
43 auto key = Digit::getOrderingKey(channel, bc, tdc); // the digits are ordered first per channel, then inside the channel per BC, then per time
44 auto dig = findDigit(key);
45 if (dig) {
46 lbl = dig->getLabel(); // getting the label from the already existing digit
47 if (dig->merge(tdc, tot)) { // merging to the existing digit (if new came first upload also MC truth)
48 dig->setTgeant(geanttime);
49 dig->setT0true(t0);
50 }
52 } else {
53 mDigits.emplace(std::make_pair(key, Digit(channel, tdc, tot, bc, lbl, triggerorbit, triggerbunch, geanttime, t0)));
54 }
55
56 return lbl;
57}
58
59//______________________________________________________________________
60void Strip::fillOutputContainer(std::vector<Digit>& digits)
61{
62 // transfer digits that belong to the strip to the output array of digits
63 // we assume that the Strip has stored inside only digits from one readout
64 // window --> we flush them all
65
66 if (mDigits.empty()) {
67 return;
68 }
69 auto itBeg = mDigits.begin();
70 auto iter = itBeg;
71 for (; iter != mDigits.end(); ++iter) {
72 Digit& dig = iter->second;
73 digits.emplace_back(dig);
74 }
75
76 // if (iter!=mDigits.end()) iter--;
77 mDigits.erase(itBeg, iter);
78}
uint64_t bc
Definition RawEventData.h:5
ClassImp(o2::tof::Strip)
StringRef key
TOF digit implementation.
Definition Digit.h:31
ULong64_t getOrderingKey()
Definition Digit.h:44
Container for similated points connected to a given TOF strip This will be used in order to allow a m...
Definition Strip.h:40
void fillOutputContainer(std::vector< o2::tof::Digit > &digits)
Definition Strip.cxx:60
Int_t addDigit(Int_t channel, Int_t tdc, Int_t tot, uint64_t bc, Int_t lbl=0, uint32_t triggerorbit=0, uint16_t triggerbunch=0, float geanttime=0, double t0=0)
Definition Strip.cxx:37
static int mDigitMerged
Definition Strip.h:87
o2::tof::Digit * findDigit(ULong64_t key)
reset points container
Definition Strip.h:97
std::map< ULong64_t, o2::tof::Digit > mDigits
Map of fired digits, possibly in multiple frames.
Definition Strip.h:92
Strip()=default
Default constructor.
GLuint index
Definition glcorearb.h:781
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
Definition glcorearb.h:5034
std::vector< Digit > digits