MUSIC unknown
Analysis for the MUSIC active-target ionization chamber
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
19namespace SOLFlags {
22const UInt_t PILEUP = 0x01;
23const UInt_t EVENT_SATURATION = 0x04;
24const UInt_t POST_SATURATION = 0x08;
25const UInt_t CHARGE_OVERFLOW = 0x10;
26const UInt_t SCA_SELECTED = 0x20;
27const UInt_t FINE_TS_VALID = 0x40;
29
32const UInt_t EXT_INHIBIT = 0x0001;
33const UInt_t UNDER_SAT = 0x0002;
34const UInt_t OVER_SAT = 0x0004;
35const UInt_t EXT_TRIGGER = 0x0008;
36const UInt_t GLOBAL_TRIGGER = 0x0010;
37const UInt_t SW_TRIGGER = 0x0020;
38const UInt_t SELF_TRIGGER = 0x0040;
39const UInt_t LVDS_TRIGGER = 0x0080;
40const UInt_t TRIGGER_64CH = 0x0100;
41const UInt_t ITLA_TRIGGER = 0x0200;
42const UInt_t ITLB_TRIGGER = 0x0400;
44} // namespace SOLFlags
45
70namespace SOLPack {
71const Int_t LOW_SHIFT = 16;
72const UInt_t LOW_MASK = 0x7FF;
73const Int_t HIGH_SHIFT = 27;
74const Int_t HIGH_SKIP = 2;
75const UInt_t HIGH_MASK = 0x1F;
76} // namespace SOLPack
77
94inline 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 its width:
114 // the old shifts (16, 20) overlapped in bits 20-23, making flags unreadable.
115 mapped |= (static_cast<UInt_t>(sol_flags_low) & SOLPack::LOW_MASK)
117 mapped |= ((static_cast<UInt_t>(sol_flags_high) >> SOLPack::HIGH_SKIP) &
120
121 return mapped;
122}
123
134inline RawHit SOLHitToRawHit(const SOLData &sol) {
135 RawHit raw;
136 raw.board = 0;
137 raw.channel = sol.channel;
138 raw.energy = sol.energy;
139 raw.timestamp = sol.timestamp * 1000;
140 raw.flags = MapSOLFlagsToCoMPASS(sol.flags_high, sol.flags_low);
141 return raw;
142}
143
144#endif
UInt_t MapSOLFlagsToCoMPASS(UShort_t sol_flags_high, UShort_t sol_flags_low)
Pack SOLARIS flags into a CoMPASS-compatible word.
RawHit SOLHitToRawHit(const SOLData &sol)
Adapt one SOLARIS hit into the pipeline's RawHit.
SOLARIS status flag bits, from the SOLARIS DAQ source.
const UInt_t EVENT_SATURATION
bit 2
const UInt_t GLOBAL_TRIGGER
bit 4
const UInt_t LVDS_TRIGGER
bit 7
const UInt_t EXT_TRIGGER
bit 3
const UInt_t ITLA_TRIGGER
bit 9
const UInt_t ITLB_TRIGGER
bit 10
const UInt_t POST_SATURATION
bit 3
const UInt_t SW_TRIGGER
bit 5
const UInt_t CHARGE_OVERFLOW
bit 4
const UInt_t EXT_INHIBIT
bit 0
const UInt_t SELF_TRIGGER
bit 6
const UInt_t SCA_SELECTED
bit 5
const UInt_t UNDER_SAT
bit 1
const UInt_t PILEUP
bit 0
const UInt_t FINE_TS_VALID
bit 6
const UInt_t TRIGGER_64CH
bit 8
const UInt_t OVER_SAT
bit 2
Layout of the packed word MapSOLFlagsToCoMPASS() returns.
const Int_t HIGH_SHIFT
Where the flags_high remnant starts.
const UInt_t LOW_MASK
flags_low bits 0-10.
const Int_t LOW_SHIFT
Where flags_low starts.
const Int_t HIGH_SKIP
flags_high bits 0-1 are not carried here.
const UInt_t HIGH_MASK
flags_high bits 2-6.