Project
Loading...
Searching...
No Matches
Mapping.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
18
19#ifndef PHOSMAPPING_H_
20#define PHOSMAPPING_H_
21
22#include <string_view>
23#include <vector>
24#include <utility>
25#include "Rtypes.h"
26
27namespace o2
28{
29
30namespace phos
31{
32
34{
35 public:
42 static constexpr short NCHANNELS = 14336;
43 static constexpr short NHWPERDDL = 2048;
44 static constexpr short NMaxHWAddress = 3929;
45 static constexpr short NDDL = 14;
46 static constexpr short NTRUBranchReadoutChannels = 112;
47 static constexpr short NTRUReadoutChannels = 3136;
48 static constexpr short TRUFinalProductionChannel = 123; // The last channel of production bits, contains markesr to choose between 2x2 and 4x4 algorithm
49
53
54 ~Mapping() = default;
55
56 // Getters for unique instance of Mapping
57 static Mapping* Instance();
58 static Mapping* Instance(std::basic_string_view<char> path);
59
61 ErrorStatus hwToAbsId(short ddl, short hw, short& absId, CaloFlag& caloFlag) const;
63 ErrorStatus absIdTohw(short absId, short caloFlag, short& ddl, short& hwAddr) const;
64
66 static void ddlToCrorcLink(short iddl, short& flp, short& crorc, short& link)
67 {
68 // FLP164:
69 // CRORC S/N 0243
70 // channel 0 -> human name M2-0, DDL 3
71 // channel 1 -> human name M2-1, DDL 4
72 // channel 2 -> human name M2-2, DDL 5
73 // channel 3 -> human name M2-3, DDL 6
74 // CRORC S/N 0304
75 // channel 0 -> human name M1-2, DDL 1
76 // channel 1 -> human name M1-3, DDL 2
77
78 // FLP165:
79 // CRORC S/N 0106
80 // channel 0 -> human name M4-0, DDL 11
81 // channel 1 -> human name M4-1, DDL 12
82 // channel 2 -> human name M4-2, DDL 13
83 // channel 3 -> human name M4-3, DDL 14
84 // CRORC S/N 0075
85 // channel 0 -> human name M3-0, DDL 7
86 // channel 1 -> human name M3-1, DDL 8
87 // channel 2 -> human name M3-2, DDL 9
88 // channel 3 -> human name M3-3, DDL 10
89 if (iddl < 6) {
90 flp = 164;
91 if (iddl < 2) {
92 crorc = 304;
93 link = iddl;
94 } else {
95 crorc = 243;
96 link = iddl - 2;
97 }
98 } else {
99 flp = 165;
100 if (iddl < 10) {
101 crorc = 75;
102 } else {
103 crorc = 106;
104 }
105 link = (iddl - 6) % 4;
106 }
107 }
108
110
111 // Select TRU readout channels or TRU flag channels
112 static bool isTRUReadoutchannel(short hwAddress) { return (hwAddress < 112) || (hwAddress >= 2048 && hwAddress < 2048 + 112); }
113
114 protected:
115 Mapping() = default;
116 Mapping(std::basic_string_view<char> path);
117
120
121 private:
122 static Mapping* sMapping;
123 std::string mPath = "";
124 bool mInitialized = false;
125 bool mInvInitialized = false;
126 short mAbsId[NDDL][NMaxHWAddress] = {0};
127 CaloFlag mCaloFlag[NDDL][NMaxHWAddress] = {kTRU};
128 short mAbsToHW[NCHANNELS][3][2] = {0};
129
130 ClassDefNV(Mapping, 1);
131}; // End of Mapping
132
133} // namespace phos
134
135} // namespace o2
136#endif
Checks validity of hardware address (HW) and transform it to digit AbsId index.
~Mapping()=default
static constexpr short NDDL
Total number of DDLs.
Definition Mapping.h:45
static constexpr short NMaxHWAddress
Maximal HW address (size of array)
Definition Mapping.h:44
ErrorStatus constructAbsToHWMatrix()
Construct vector for conversion only if necessary.
static Mapping * Instance()
Definition Mapping.cxx:29
static constexpr short NTRUBranchReadoutChannels
Number of TRU readout channels per branch.
Definition Mapping.h:46
static bool isTRUReadoutchannel(short hwAddress)
Definition Mapping.h:112
static constexpr short NHWPERDDL
Number of HW addressed per DDL.
Definition Mapping.h:43
ErrorStatus setMapping()
Definition Mapping.cxx:122
static constexpr short NCHANNELS
Number of channels starting from 1.
Definition Mapping.h:42
static constexpr short TRUFinalProductionChannel
Definition Mapping.h:48
ErrorStatus hwToAbsId(short ddl, short hw, short &absId, CaloFlag &caloFlag) const
convert hardware address to absId and caloFlag
Definition Mapping.cxx:54
static void ddlToCrorcLink(short iddl, short &flp, short &crorc, short &link)
convert ddl number to crorc and link number
Definition Mapping.h:66
ErrorStatus absIdTohw(short absId, short caloFlag, short &ddl, short &hwAddr) const
convert absId and caloflag to hardware address and ddl
Definition Mapping.cxx:89
static constexpr short NTRUReadoutChannels
Total number of TRU readout channels.
Definition Mapping.h:47
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...