Project
Loading...
Searching...
No Matches
NoiseCalibData.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
12#ifndef ZDC_NOISECALIB_DATA_H
13#define ZDC_NOISECALIB_DATA_H
14
15#include "Framework/Logger.h"
16#include "ZDCBase/Constants.h"
17#include <array>
18#include <vector>
19#include <map>
20#include <gsl/span>
21
25
26namespace o2
27{
28namespace zdc
29{
30
31// Messageable representation of noise calibration data
33 NoiseCalibBinData() = default;
35 {
36 ibin = (myid << 24) | (myibin & 0x00ffffff);
37 cont = mycont;
38 }
39 uint32_t ibin = 0xff000000;
41 inline uint32_t id() const
42 { // Channel id
43 return (ibin >> 24);
44 }
45 inline uint32_t bin() const
46 { // Bin number
47 return (ibin & 0x00ffffff);
48 }
49 inline uint32_t counts() const
50 { // Channel counts
51 return cont;
52 }
53 void print() const
54 {
55 LOGF(info, "NoiseCalibBinData ch=%2u bin=%4u cont=%u", id(), bin(), counts());
56 }
58};
59
60// Container of the messageable representation of noise calibration data
65 bool mOverflow = false;
66 std::array<bool, NChannels> mOverflowCh{};
67 std::vector<NoiseCalibBinData> mData;
68 void clear();
69 void print() const;
71};
72
73// Working representation of noise channel data
75 NoiseCalibChData() = default;
76 // Variance intermediate data are uint32_t and sparse (~25% channels are filled)
77 // and histogram limits are not known in advance -> use map
78 std::map<uint32_t, uint32_t> mData;
79 bool mOverflow = false;
80 uint64_t getEntries() const;
81 uint32_t getMaxBin() const;
82 int getStat(uint64_t& en, double& mean, double& var) const;
83 inline bool isOverflow() { return mOverflow; };
84 void clear();
86};
87
88// Working representation of noise data
90 NoiseCalibData() = default;
91
94 bool mOverflow = false;
95
98
101 // NoiseCalibData& operator+=(const NoiseCalibSummaryData& s);
103
104 inline void addEntry(int isig, uint32_t val)
105 {
106 if (!mHisto[isig].mOverflow) {
107 int ibin = 0x00ffffff;
108 // Overflow in bin number
109 if (val < 0x00ffffff) {
110 ibin = val;
111 }
112 // Overflow in data
113 if (mHisto[isig].mData[ibin] < 0xffffffff) {
114 mHisto[isig].mData[ibin]++;
115 } else {
116 mHisto[isig].mOverflow = true;
117 mOverflow = true;
118 }
119 }
120 }
121
122 static constexpr int NHA = 3;
123
124 uint64_t getEntries(int is) const;
125 uint32_t getMaxBin(int is) const;
126 int getStat(int is, uint64_t& en, double& mean, double& var) const;
127 void print() const;
128 void clear();
129 void setCreationTime(uint64_t ctime);
130 void mergeCreationTime(uint64_t ctime);
131 void setN(int n);
133 int saveDebugHistos(const std::string fn, bool is_epn = false);
135};
136
137} // namespace zdc
138} // namespace o2
139
140#endif
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 s
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 Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
GLdouble n
Definition glcorearb.h:1982
GLuint GLfloat * val
Definition glcorearb.h:1582
struct o2::upgrades_utils::@482 zdc
structure to keep FT0 information
constexpr int NChannels
Definition Constants.h:65
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
NoiseCalibBinData(uint8_t myid, uint32_t myibin, uint32_t mycont)
uint32_t cont
Encoded channel ID / bin number.
ClassDefNV(NoiseCalibBinData, 1)
uint32_t id() const
Channel counts.
uint64_t getEntries() const
Overflow flag (cannot accept more data)
ClassDefNV(NoiseCalibChData, 1)
int getStat(uint64_t &en, double &mean, double &var) const
std::map< uint32_t, uint32_t > mData
bool mOverflow
Map histogram container.
NoiseCalibSummaryData & getSummary()
int saveDebugHistos(const std::string fn, bool is_epn=false)
NoiseCalibChData mHisto[NChannels]
Overflow at least one ZDC channel.
NoiseCalibData & operator=(const NoiseCalibSummaryData &s)
uint32_t getMaxBin(int is) const
void mergeCreationTime(uint64_t ctime)
uint64_t mCTimeEnd
Time of processed time frame.
NoiseCalibData & operator+=(const NoiseCalibData &other)
Serialized data to be dispatched.
int getStat(int is, uint64_t &en, double &mean, double &var) const
NoiseCalibSummaryData mSummary
Sparse histogram of single channels.
bool mOverflow
Time of processed time frame.
static constexpr int NHA
uint64_t getEntries(int is) const
ClassDefNV(NoiseCalibData, 1)
void setCreationTime(uint64_t ctime)
void addEntry(int isig, uint32_t val)
bool mOverflow
Time of processed time frame.
ClassDefNV(NoiseCalibSummaryData, 1)
uint64_t mCTimeEnd
Time of processed time frame.
void clear()
Data of not empty bins.
std::vector< NoiseCalibBinData > mData
Channel overflow information.
std::array< bool, NChannels > mOverflowCh
Overflow of one channel.
VectorOfTObjectPtrs other