ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Global
GlobalSimulation
GlobalSimulation
LArStripCell.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef GLOBALSIM_LARSTRIPCELL_H
6
#define GLOBALSIM_LARSTRIPCELL_H
7
8
#include "
GlobalSimulation/BitSpec.h
"
9
10
namespace
GlobalSim
{
11
12
namespace
v1
{
13
class
LArStripCell
:
public
BitSpec
<LArStripCell,32> {
14
15
// this is the "6-40-4" MLE ... only 6 of the 13 bits of et field will encode energy
16
// the 2 MSB are the "range index" and the remaining bits are the "code" within the range
17
// the LSBs in each range are 40, 40*4, 40*4*4, 40*4*4*4 MeV
18
public
:
19
static
const
int
sBITS
= 6;
20
static
const
int
sLSB
= 40;
// in MeV! Assumes cannot have fractional MeV!
21
static
const
int
sGAIN
= 4;
22
protected
:
23
static
const
size_t
sMAXCODE
= (1<<(
sBITS
-2)) - 1;
// max code in a given range
24
25
static
std::pair<float,float>
et_mld
(std::bitset<13>
et
) {
26
auto
range = std::min (3ul, (
et
.to_ulong() >> (
sBITS
-2)));
27
auto
code = (
et
.to_ulong()) &
sMAXCODE
;
28
int
out = 0;
29
auto
scale =
sLSB
;
30
while
(range>0) {
31
out += scale*
sMAXCODE
;
32
scale *=
sGAIN
;
33
range--;
34
}
35
return
{out + scale*code,out+scale*(code+1)};
36
}
37
38
static
Bitset<13>
et_mle
(
float
et
) {
39
// this code is based off "LArCellPreparationAlg::encodeEnergy"
40
41
if
(
et
< 0)
return
0;
42
int
et_int = std::round(
et
);
// uses only integer MeV values
43
unsigned
int
out_range = 0;
44
auto
scale =
sLSB
;
45
float
offset = 0;
46
while
(et_int >= (offset +
sMAXCODE
*scale)) {
47
out_range++;
48
if
(out_range==4) {
49
// saturated cell, return max code
50
return
(1<<
sBITS
)-1;
51
}
52
offset +=
sMAXCODE
*scale;
53
scale *=
sGAIN
;
54
}
55
// return out_range in top 2 bits, and code in remaining bits
56
return
(out_range << (
sBITS
-2)) + (et_int - offset)/scale;
57
}
58
59
public
:
60
static
inline
const
BitField<0, 12, float>
et
{{.name=
"et"
, .auxvar=
"et"
, .description=
"Transverse energy"
, .encoder=
et_mle
, .decoder=
et_mld
,.centre=0}};
61
static
inline
const
SignedBitField<13, 22, float>
eta
{{.name=
"eta"
, .auxvar=
"eta"
, .description=
"Eta coordinate"
, .scale=0.0125}};
62
static
inline
const
UnclampedBitField<23, 31, float>
phi
{{.name=
"phi"
, .auxvar=
"phi"
, .description=
"Phi coordinate"
, .scale=
M_PI
/ 256}};
63
64
DECLARE_FIELDS
(
et
,
eta
,
phi
);
65
};
66
67
}
68
69
typedef
v1::LArStripCell
LArStripCell
;
70
71
}
72
73
#endif
M_PI
#define M_PI
Definition
ActiveFraction.h:14
BitSpec.h
GlobalSim::BitField
Definition
BitSpec.h:251
GlobalSim::BitSpec
Definition
BitSpec.h:683
GlobalSim::Bitset
Custom Bitset class that can handle clamping of values.
Definition
BitSpec.h:157
GlobalSim::v1::LArStripCell
Definition
LArStripCell.h:13
GlobalSim::v1::LArStripCell::eta
static const SignedBitField< 13, 22, float > eta
Definition
LArStripCell.h:61
GlobalSim::v1::LArStripCell::sBITS
static const int sBITS
Definition
LArStripCell.h:19
GlobalSim::v1::LArStripCell::sMAXCODE
static const size_t sMAXCODE
Definition
LArStripCell.h:23
GlobalSim::v1::LArStripCell::phi
static const UnclampedBitField< 23, 31, float > phi
Definition
LArStripCell.h:62
GlobalSim::v1::LArStripCell::et_mld
static std::pair< float, float > et_mld(std::bitset< 13 > et)
Definition
LArStripCell.h:25
GlobalSim::v1::LArStripCell::DECLARE_FIELDS
DECLARE_FIELDS(et, eta, phi)
GlobalSim::v1::LArStripCell::sLSB
static const int sLSB
Definition
LArStripCell.h:20
GlobalSim::v1::LArStripCell::et_mle
static Bitset< 13 > et_mle(float et)
Definition
LArStripCell.h:38
GlobalSim::v1::LArStripCell::sGAIN
static const int sGAIN
Definition
LArStripCell.h:21
GlobalSim::v1::LArStripCell::et
static const BitField< 0, 12, float > et
Definition
LArStripCell.h:60
GlobalSim::v1
Definition
Global/GlobalSimulation/GlobalSimulation/GenericTOB.h:12
GlobalSim
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition
BitSpec.h:56
GlobalSim::SignedBitField
BitField< Lo, Hi, AuxValue, Value, true > SignedBitField
Definition
BitSpec.h:572
GlobalSim::UnclampedBitField
BitField< Lo, Hi, AuxValue, Value, false, false > UnclampedBitField
Definition
BitSpec.h:575
GlobalSim::LArStripCell
v1::LArStripCell LArStripCell
Definition
LArStripCell.h:69
Generated on
for ATLAS Offline Software by
1.17.0