Project
Loading...
Searching...
No Matches
DigitalCurrentClusterIntegrator.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#ifndef ALICEO2_TPC_DIGITALCURRENTCLUSTERINTEGRATOR_H_
16#define ALICEO2_TPC_DIGITALCURRENTCLUSTERINTEGRATOR_H_
17
18#include <vector>
19#include <memory>
20
23#include "TPCBase/Mapper.h"
24
25namespace o2
26{
27namespace tpc
28{
29
30//This class contains an array or all TPC pads (in selected sectors and rows), and can integrated the charges of clusters
32{
33 public:
36
37 void initRow(int sector, int row)
38 {
39 if (mIntegratedCurrents[sector][row] == nullptr) {
41 mIntegratedCurrents[sector][row].reset(new unsigned long long int[nPads]);
42 memset(&mIntegratedCurrents[sector][row][0], 0, nPads * sizeof(mIntegratedCurrents[sector][row][0]));
43 }
44 }
45 void integrateCluster(int sector, int row, float pad, unsigned int charge)
46 {
47 int ipad = pad + 0.5;
48 if (ipad < 0) {
49 ipad = 0;
50 }
52 if (ipad >= maxPad) {
53 ipad = maxPad - 1;
54 }
55 mIntegratedCurrents[sector][row][ipad] += charge;
56 }
57 void clear(); //Clear all currents to 0
58 void reset(); //Free all allocated current buffers
59
60 private:
61 std::unique_ptr<unsigned long long int[]> mIntegratedCurrents[constants::MAXSECTOR][constants::MAXGLOBALPADROW];
62};
63
64} // namespace tpc
65} // namespace o2
66#endif
Class of a TPC cluster in TPC-native coordinates (row, time)
int16_t charge
Definition RawEventData.h:5
void integrateCluster(int sector, int row, float pad, unsigned int charge)
int getNumberOfPadsInRowSector(int row) const
Definition Mapper.h:340
static Mapper & instance(const std::string mappingDir="")
Definition Mapper.h:44
constexpr int MAXSECTOR
Definition Constants.h:28
constexpr int MAXGLOBALPADROW
Definition Constants.h:34
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< int > row