Project
Loading...
Searching...
No Matches
BCData.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
14#include <bitset>
15
16using namespace o2::zdc;
17
18void BCData::print(uint32_t triggerMask, int diff) const
19{
20 if (diff == 0) {
21 printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry());
22 } else {
23 printf("%9u.%04u ", ir.orbit, ir.bc);
24 }
25 printf("Read:");
26 for (int ic = 0; ic < NDigiChannels; ic++) {
27 if (ic % NChPerModule == 0) {
28 if (ic == 0) {
29 printf(" %d[", ic / NChPerModule);
30 } else {
31 printf("] %d[", ic / NChPerModule);
32 }
33 }
34 if (channels & (0x1 << ic)) {
35 printf("R");
36 } else {
37 printf(" ");
38 }
39 }
40 printf("]\n");
41 if (diff) {
42 printf("%9u.%04u ", ir.orbit, ir.bc);
43 }
44 printf("Hits:");
45 for (int ic = 0; ic < NDigiChannels; ic++) {
46 if (ic % NChPerModule == 0) {
47 if (ic == 0) {
48 printf(" %d[", ic / NChPerModule);
49 } else {
50 printf("] %d[", ic / NChPerModule);
51 }
52 }
53 bool is_hit = triggers & (0x1 << ic);
54 bool is_trig = triggerMask & (0x1 << ic);
55 if (is_trig) {
56 if (is_hit) {
57 printf("T");
58 } else {
59 printf(".");
60 }
61 } else {
62 if (is_hit) {
63 printf("H");
64 } else {
65 printf(" ");
66 }
67 }
68 }
69 printf("]\n");
70 if (diff) {
71 printf("%9u.%04u ", ir.orbit, ir.bc);
72 }
73 printf("AUTO:");
74 for (int i = 0; i < NModules; i++) {
75 std::bitset<10> bb(moduleTriggers[i]);
76 printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-");
77 }
78 printf("\n");
79 if (diff) {
80 printf("%9u.%04u ", ir.orbit, ir.bc);
81 }
82 printf("ALIT:");
83 for (int i = 0; i < NModules; i++) {
84 std::bitset<10> bb(moduleTriggers[i]);
85 printf(" %d %s%s%s%s ", i, bb[3] ? "3" : "-", bb[2] ? "2" : "-", bb[1] ? "1" : "-", bb[0] ? "0" : "-");
86 }
87 printf("\n");
88}
89
90gsl::span<const ChannelData> BCData::getBunchChannelData(const gsl::span<const ChannelData> tfdata) const
91{
92 // extract the span of channel data for this bunch from the whole TF data
93 return ref.getEntries() ? gsl::span<const ChannelData>(&tfdata[ref.getFirstEntry()], ref.getEntries()) : gsl::span<const ChannelData>();
94}
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
int32_t i
const int16_t bb
Container class to store NTimeBinsPerBC ADC values of single ZDC channel.
constexpr int NModules
Definition Constants.h:68
constexpr int NChPerModule
Definition Constants.h:69
constexpr int NDigiChannels
Definition Constants.h:71
uint32_t orbit
LHC orbit.
uint16_t bc
bunch crossing ID of interaction
uint32_t triggers
Definition BCData.h:60
std::array< uint16_t, NModules > moduleTriggers
Definition BCData.h:57
void print(uint32_t triggerMask=0, int diff=0) const
Definition BCData.cxx:18
uint32_t channels
Definition BCData.h:59
gsl::span< const ChannelData > getBunchChannelData(const gsl::span< const ChannelData > tfdata) const
Definition BCData.cxx:90
o2::InteractionRecord ir
Definition BCData.h:56