forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDPLAlpideParam.h
More file actions
119 lines (101 loc) · 4.56 KB
/
DPLAlpideParam.h
File metadata and controls
119 lines (101 loc) · 4.56 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
116
117
118
119
// 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.
#ifndef ALICEO2_ITSMFTDPLBASEPARAM_H_
#define ALICEO2_ITSMFTDPLBASEPARAM_H_
#include "DetectorsCommonDataFormats/DetID.h"
#include "CommonUtils/ConfigurableParam.h"
#include "CommonUtils/ConfigurableParamHelper.h"
#include "CommonConstants/LHCConstants.h"
#include <string_view>
namespace o2
{
namespace itsmft
{
constexpr float DEFStrobeDelay = o2::constants::lhc::LHCBunchSpacingNS * 4; // ~100 ns delay
template <int N>
struct DPLAlpideParam : public o2::conf::ConfigurableParamHelper<DPLAlpideParam<N>> {
static constexpr int getNLayers()
{
return N == o2::detectors::DetID::ITS ? 7 : 10;
}
static constexpr std::string_view getParamName()
{
return N == o2::detectors::DetID::ITS ? ParamName[0] : ParamName[1];
}
public:
int roFrameLengthInBC = DEFROFLengthBC(); ///< ROF length in BC for continuous mode
float roFrameLengthTrig = DEFROFLengthTrig(); ///< length of RO frame in ns for triggered mode
float strobeDelay = DEFStrobeDelay; ///< strobe start (in ns) wrt ROF start
float strobeLengthCont = -1.; ///< if < 0, full ROF length - delay
float strobeLengthTrig = 100.; ///< length of the strobe in ns (sig. over threshold checked in this window only)
int roFrameBiasInBC = DEFROFBiasInBC(); ///< bias of the start of ROF wrt orbit start: t_irof = (irof*roFrameLengthInBC + roFrameBiasInBC)*BClengthMUS
int roFrameLayerLengthInBC[getNLayers()] = {}; ///< staggering ROF length in BC for continuous mode per layer
int roFrameLayerBiasInBC[getNLayers()] = {}; ///< staggering ROF bias in BC for continuous mode per layer
int roFrameLayerDelayInBC[getNLayers()] = {}; ///< staggering ROF delay in BC for continuous mode per layer
static constexpr bool supportsStaggering() noexcept { return (N == o2::detectors::DetID::ITS) ? false : false; }
// test if staggering is on
bool withStaggering() const noexcept
{
if constexpr (!supportsStaggering()) {
return false;
}
for (int i{0}; i < getNLayers(); ++i) {
if (roFrameLayerLengthInBC[i] != 0) {
return true;
}
}
return false;
}
// get ROF length for any layer
int getROFLengthInBC(int layer) const noexcept { return (withStaggering()) ? roFrameLayerLengthInBC[layer] : roFrameLengthInBC; }
int getROFBiasInBC(int layer) const noexcept { return (withStaggering()) ? roFrameLayerBiasInBC[layer] : roFrameBiasInBC; }
int getROFDelayInBC(int layer) const noexcept { return (withStaggering()) ? roFrameLayerDelayInBC[layer] : 0; }
// boilerplate stuff + make principal key
O2ParamDef(DPLAlpideParam, getParamName().data());
private:
static constexpr std::string_view ParamName[2] = {"ITSAlpideParam", "MFTAlpideParam"};
static constexpr int DEFROFLengthBC()
{
// default ROF length in BC for continuous mode
// allowed values: 1,2,3,4,6,9,11,12,18,22,27,33,36
return N == o2::detectors::DetID::ITS ? o2::constants::lhc::LHCMaxBunches / 4 : o2::constants::lhc::LHCMaxBunches / 18;
}
static constexpr float DEFROFLengthTrig()
{
// length of RO frame in ns for triggered mode
return N == o2::detectors::DetID::ITS ? 6000. : 6000.;
}
static constexpr int DEFROFBiasInBC()
{
// default ROF length bias in MC, see https://github.com/AliceO2Group/AliceO2/pull/11108 for ITS
return N == o2::detectors::DetID::ITS ? 64 : 60;
}
static_assert(N == o2::detectors::DetID::ITS || N == o2::detectors::DetID::MFT, "only DetID::ITS orDetID:: MFT are allowed");
static_assert(o2::constants::lhc::LHCMaxBunches % DEFROFLengthBC() == 0); // make sure ROF length is divisor of the orbit
};
template <int N>
DPLAlpideParam<N> DPLAlpideParam<N>::sInstance;
} // namespace itsmft
namespace framework
{
template <typename T>
struct is_messageable;
template <>
struct is_messageable<o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>> : std::true_type {
};
template <typename T>
struct is_messageable;
template <>
struct is_messageable<o2::itsmft::DPLAlpideParam<o2::detectors::DetID::MFT>> : std::true_type {
};
} // namespace framework
} // namespace o2
#endif