forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTurnOnHistos.h
More file actions
115 lines (96 loc) · 3.31 KB
/
TurnOnHistos.h
File metadata and controls
115 lines (96 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \class TurnOnHistos
/// \brief transient CCDB container to collect histos for calculation of trigger maps and turn-on curves
/// \author Dmitri Peresunko, RRC Kurchatov institute
/// \since Apr. 1, 2021
///
///
#ifndef PHOS_TURNONHISTOS_H
#define PHOS_TURNONHISTOS_H
#include <bitset>
#include <array>
#include "TObject.h"
namespace o2
{
namespace phos
{
class TurnOnHistos
{
public:
//class to collect statistics to calculate trigger turn-on curves and trigger bad maps
static constexpr short NCHANNELS = 3136; ///< Number of trigger channels
static constexpr short NDDL = 14; ///< Number of DDLs
static constexpr short Npt = 200; ///< Number of bins in pt distribution
static constexpr float dpt = 0.1; ///< bin width
/// \brief Constructor
TurnOnHistos() = default;
TurnOnHistos& operator=(const TurnOnHistos& other) = default;
/// \brief Destructor
~TurnOnHistos() = default;
/// \brief Merge statistics in two containers
/// \param other Another container to be added to current
void merge(TurnOnHistos& other);
/// \brief Fill spectum of all clusters
/// \param ddl ddl ID
/// \param e cluster energy
void fillTotSp(short ddl, float e)
{
short bin = e / dpt;
if (bin < Npt) {
mTotSp[ddl][bin]++;
}
}
/// \brief Fill spectum of clusters fired trigger
/// \param ddl ddl ID
/// \param e cluster energy
void fillFiredSp(short ddl, float e)
{
short bin = e / dpt;
if (bin < Npt) {
mTrSp[ddl][bin]++;
}
}
/// \brief Collects entries in good map
/// \param bitset with channels fired in event
void fillFiredMap(const std::bitset<NCHANNELS>& bs)
{
for (size_t i = 0; i < NCHANNELS; ++i) {
if (bs[i]) {
mGoodMap[i]++;
}
}
}
/// \brief Collects entries in noisy map
/// \param bitset with channels fired in event
void fillNoisyMap(const std::bitset<NCHANNELS>& bs)
{
for (size_t i = 0; i < NCHANNELS; ++i) {
if (bs[i]) {
mNoisyMap[i]++;
}
}
}
//getters now
const std::array<float, Npt>& getTotSpectrum(short ddl) const { return mTotSp[ddl]; }
const std::array<float, Npt>& getTrSpectrum(short ddl) const { return mTrSp[ddl]; }
const std::array<float, NCHANNELS>& getGoodMap() const { return mGoodMap; }
const std::array<float, NCHANNELS>& getNoisyMap() const { return mNoisyMap; }
private:
std::array<float, NCHANNELS> mGoodMap; ///< Container to collect entries in good map
std::array<float, NCHANNELS> mNoisyMap; ///< Container to collect entries in noisy map
std::array<std::array<float, Npt>, NDDL> mTotSp; ///< Spectrum of all clusters
std::array<std::array<float, Npt>, NDDL> mTrSp; ///< Spectrum of fired trigger cl.
ClassDefNV(TurnOnHistos, 1);
};
} // namespace phos
} // namespace o2
#endif