MUSIC
unknown
Analysis for the MUSIC active-target ionization chamber
Toggle main menu visibility
Loading...
Searching...
No Matches
HitAdapter.hpp
Go to the documentation of this file.
1
#ifndef HIT_ADAPTER_HPP
2
#define HIT_ADAPTER_HPP
3
4
#include "BinaryUtils.hpp"
5
#include <Rtypes.h>
6
17
19
namespace
SOLFlags
{
22
const
UInt_t
PILEUP
= 0x01;
23
const
UInt_t
EVENT_SATURATION
= 0x04;
24
const
UInt_t
POST_SATURATION
= 0x08;
25
const
UInt_t
CHARGE_OVERFLOW
= 0x10;
26
const
UInt_t
SCA_SELECTED
= 0x20;
27
const
UInt_t
FINE_TS_VALID
= 0x40;
29
32
const
UInt_t
EXT_INHIBIT
= 0x0001;
33
const
UInt_t
UNDER_SAT
= 0x0002;
34
const
UInt_t
OVER_SAT
= 0x0004;
35
const
UInt_t
EXT_TRIGGER
= 0x0008;
36
const
UInt_t
GLOBAL_TRIGGER
= 0x0010;
37
const
UInt_t
SW_TRIGGER
= 0x0020;
38
const
UInt_t
SELF_TRIGGER
= 0x0040;
39
const
UInt_t
LVDS_TRIGGER
= 0x0080;
40
const
UInt_t
TRIGGER_64CH
= 0x0100;
41
const
UInt_t
ITLA_TRIGGER
= 0x0200;
42
const
UInt_t
ITLB_TRIGGER
= 0x0400;
44
}
// namespace SOLFlags
45
70
namespace
SOLPack
{
71
const
Int_t
LOW_SHIFT
= 16;
72
const
UInt_t
LOW_MASK
= 0x7FF;
73
const
Int_t
HIGH_SHIFT
= 27;
74
const
Int_t
HIGH_SKIP
= 2;
75
const
UInt_t
HIGH_MASK
= 0x1F;
76
}
// namespace SOLPack
77
94
inline
UInt_t
MapSOLFlagsToCoMPASS
(UShort_t sol_flags_high,
95
UShort_t sol_flags_low) {
96
UInt_t mapped = 0;
97
98
// SOLARIS high-priority pileup -> CoMPASS PILEUP
99
if
(sol_flags_high &
SOLFlags::PILEUP
) {
100
mapped |= CoMPASSData::PILEUP;
101
}
102
103
// SOLARIS event saturation -> CoMPASS SATURATION_IN_GATE
104
if
(sol_flags_high &
SOLFlags::EVENT_SATURATION
) {
105
mapped |= CoMPASSData::SATURATION_IN_GATE;
106
}
107
108
// SOLARIS post-saturation -> CoMPASS INPUT_SATURATING
109
if
(sol_flags_high &
SOLFlags::POST_SATURATION
) {
110
mapped |= CoMPASSData::INPUT_SATURATING;
111
}
112
113
// The rest, packed per the layout above. Each word is masked to the width it
114
// actually defines; the previous shifts (16 and 20) overlapped in bits 20-23,
115
// so flags_high bits 4-7 and flags_low bits 0-3 were ORed on top of each
116
// other and neither could be read back.
117
mapped |= (
static_cast<
UInt_t
>
(sol_flags_low) &
SOLPack::LOW_MASK
)
118
<<
SOLPack::LOW_SHIFT
;
119
mapped |= ((
static_cast<
UInt_t
>
(sol_flags_high) >>
SOLPack::HIGH_SKIP
) &
120
SOLPack::HIGH_MASK
)
121
<<
SOLPack::HIGH_SHIFT
;
122
123
return
mapped;
124
}
125
133
inline
UShort_t
SOLFlagsLowFrom
(UInt_t mapped) {
134
return
UShort_t((mapped >>
SOLPack::LOW_SHIFT
) &
SOLPack::LOW_MASK
);
135
}
136
144
inline
UShort_t
SOLFlagsHighFrom
(UInt_t mapped) {
145
return
UShort_t(((mapped >>
SOLPack::HIGH_SHIFT
) &
SOLPack::HIGH_MASK
)
146
<<
SOLPack::HIGH_SKIP
);
147
}
148
159
inline
RawHit
SOLHitToRawHit
(
const
SOLHit &sol) {
160
RawHit raw;
161
raw.board = 0;
162
raw.channel = sol.channel;
163
raw.energy = sol.energy;
164
raw.timestamp = sol.timestamp * 1000;
165
raw.flags =
MapSOLFlagsToCoMPASS
(sol.flags_high, sol.flags_low);
166
return
raw;
167
}
168
172
inline
std::vector<RawHit>
173
SOLHitsToRawHits
(
const
std::vector<SOLHit> &sol_hits) {
174
std::vector<RawHit> raw_hits;
175
raw_hits.reserve(sol_hits.size());
176
for
(Int_t i = 0; i < Int_t(sol_hits.size()); i++) {
177
raw_hits.push_back(
SOLHitToRawHit
(sol_hits[i]));
178
}
179
return
raw_hits;
180
}
181
182
#endif
SOLFlagsLowFrom
UShort_t SOLFlagsLowFrom(UInt_t mapped)
Recover the SOLARIS low-priority word from a packed value.
Definition
HitAdapter.hpp:133
SOLFlagsHighFrom
UShort_t SOLFlagsHighFrom(UInt_t mapped)
Recover the SOLARIS high-priority word from a packed value.
Definition
HitAdapter.hpp:144
SOLHitToRawHit
RawHit SOLHitToRawHit(const SOLHit &sol)
Adapt one SOLARIS hit into the pipeline's RawHit.
Definition
HitAdapter.hpp:159
MapSOLFlagsToCoMPASS
UInt_t MapSOLFlagsToCoMPASS(UShort_t sol_flags_high, UShort_t sol_flags_low)
Pack SOLARIS flags into a CoMPASS-compatible word.
Definition
HitAdapter.hpp:94
SOLHitsToRawHits
std::vector< RawHit > SOLHitsToRawHits(const std::vector< SOLHit > &sol_hits)
Adapt a whole run's SOLARIS hits.
Definition
HitAdapter.hpp:173
SOLFlags
SOLARIS status flag bits, from the SOLARIS DAQ source.
Definition
HitAdapter.hpp:19
SOLFlags::EVENT_SATURATION
const UInt_t EVENT_SATURATION
bit 2
Definition
HitAdapter.hpp:23
SOLFlags::GLOBAL_TRIGGER
const UInt_t GLOBAL_TRIGGER
bit 4
Definition
HitAdapter.hpp:36
SOLFlags::LVDS_TRIGGER
const UInt_t LVDS_TRIGGER
bit 7
Definition
HitAdapter.hpp:39
SOLFlags::EXT_TRIGGER
const UInt_t EXT_TRIGGER
bit 3
Definition
HitAdapter.hpp:35
SOLFlags::ITLA_TRIGGER
const UInt_t ITLA_TRIGGER
bit 9
Definition
HitAdapter.hpp:41
SOLFlags::ITLB_TRIGGER
const UInt_t ITLB_TRIGGER
bit 10
Definition
HitAdapter.hpp:42
SOLFlags::POST_SATURATION
const UInt_t POST_SATURATION
bit 3
Definition
HitAdapter.hpp:24
SOLFlags::SW_TRIGGER
const UInt_t SW_TRIGGER
bit 5
Definition
HitAdapter.hpp:37
SOLFlags::CHARGE_OVERFLOW
const UInt_t CHARGE_OVERFLOW
bit 4
Definition
HitAdapter.hpp:25
SOLFlags::EXT_INHIBIT
const UInt_t EXT_INHIBIT
bit 0
Definition
HitAdapter.hpp:32
SOLFlags::SELF_TRIGGER
const UInt_t SELF_TRIGGER
bit 6
Definition
HitAdapter.hpp:38
SOLFlags::SCA_SELECTED
const UInt_t SCA_SELECTED
bit 5
Definition
HitAdapter.hpp:26
SOLFlags::UNDER_SAT
const UInt_t UNDER_SAT
bit 1
Definition
HitAdapter.hpp:33
SOLFlags::PILEUP
const UInt_t PILEUP
bit 0
Definition
HitAdapter.hpp:22
SOLFlags::FINE_TS_VALID
const UInt_t FINE_TS_VALID
bit 6
Definition
HitAdapter.hpp:27
SOLFlags::TRIGGER_64CH
const UInt_t TRIGGER_64CH
bit 8
Definition
HitAdapter.hpp:40
SOLFlags::OVER_SAT
const UInt_t OVER_SAT
bit 2
Definition
HitAdapter.hpp:34
SOLPack
Layout of the packed word MapSOLFlagsToCoMPASS() returns.
Definition
HitAdapter.hpp:70
SOLPack::HIGH_SHIFT
const Int_t HIGH_SHIFT
Where the flags_high remnant starts.
Definition
HitAdapter.hpp:73
SOLPack::LOW_MASK
const UInt_t LOW_MASK
flags_low bits 0-10.
Definition
HitAdapter.hpp:72
SOLPack::LOW_SHIFT
const Int_t LOW_SHIFT
Where flags_low starts.
Definition
HitAdapter.hpp:71
SOLPack::HIGH_SKIP
const Int_t HIGH_SKIP
flags_high bits 0-1 are not carried here.
Definition
HitAdapter.hpp:74
SOLPack::HIGH_MASK
const UInt_t HIGH_MASK
flags_high bits 2-6.
Definition
HitAdapter.hpp:75
tooling
include
HitAdapter.hpp
Generated by
1.17.0