9#include <trg/gdl/TrgBit.h>
10#include <framework/datastore/StoreObjPtr.h>
23 return _ftdlVersion[nconf_ftdl];
36 _exp = bevt->getExperiment();
37 _run = bevt->getRun();
40 mapNumber(_exp, _run);
44 for (
unsigned i = 0; i < 6; i++) {
45 unsigned i32b = trgsum->getInputBits(i);
46 unsigned f32b = trgsum->getFtdlBits(i);
47 unsigned p32b = trgsum->getPsnmBits(i);
51 for (
unsigned j = 0; j < 32; j++) {
52 if (j + i * 32 < n_input)
53 _itdVector.push_back((i32b & (1 << j)) ? 1 : 0);
54 if (j + i * 32 < n_output) {
55 _ftdVector.push_back((f32b & (1 << j)) ? 1 : 0);
56 _psnVector.push_back((p32b & (1 << j)) ? 1 : 0);
60 timtype = trgsum->getTimType();
61 _isFiredFilled =
true;
72 for (
unsigned i = 0; i < N_BITS_RESERVED; i++) {
73 if (! strcmp(_inputBitNames[i], bitname)) {
77 for (
unsigned i = 0; i < N_BITS_RESERVED; i++) {
78 if (! strcmp(_outputBitNames[i], bitname)) {
88 unsigned bit = _inputMap[nconf_input][a];
89 if (bit == 999)
return false;
94TrgBit::isFiredInput(input a)
const
96 unsigned bit = _inputMap[nconf_input][a];
97 if (bit == 999)
return false;
104 unsigned bit = _outputMap[nconf_ftdl][a];
105 if (bit == 999)
return false;
110TrgBit::isFiredFtdl(output a)
const
112 unsigned bit = _outputMap[nconf_ftdl][a];
113 if (bit == 999)
return false;
118TrgBit::isFiredInput(
unsigned ith_bit)
const
120 return _input.
isFired(ith_bit);
124TrgBit::isFiredInput(
const char* bitname)
const
127 if (bit == 999)
return false;
132TrgBit::isFiredFtdl(
unsigned ith_bit)
const
138TrgBit::isFiredFtdl(
const char* bitname)
const
141 if (bit == 999)
return false;
146TrgBit::isFiredPsnm(output a)
const
148 unsigned bit = _outputMap[nconf_ftdl][a];
149 if (bit == 999)
return false;
154TrgBit::isFiredPsnm(
const char* bitname)
const
157 if (bit == 999)
return false;
162TrgBit::isFiredPsnm(
unsigned ith_bit)
const
176 if (_outputMap[nconf_ftdl][a] == 999)
return 0;
177 return _psnmValues[nconf_psnm][_outputMap[nconf_ftdl][a]];
183 return _psnmValues[nconf_psnm][i];
201 unsigned wd = bit / 32;
202 unsigned position = bit % 32;
203 return (_pattern[wd] >> position) & 1;
209 unsigned wd = bit / 32;
210 unsigned position = bit % 32;
211 return (_pattern[wd] >> position) & 1;
217 if (a >= 32 * N_INPUT_ARRAY)
return 0;
218 const unsigned i = a / 32;
219 const unsigned j = a % 32;
221 if ((_pattern[i] >> j) & 1)
return 1;
228 if (a >= 32 * N_OUTPUT_ARRAY)
return 0;
229 const unsigned i = a / 32;
230 const unsigned j = a % 32;
232 if ((_pattern[i] >> j) & 1)
return 1;
239 for (
unsigned i = 0; i < N_BITS_RESERVED; i++) {
240 unsigned j = _inputMap[nconf_input][i];
241 if (ith_bit == j)
return _inputBitNames[i];
247TrgBit::getOutputBitName(
unsigned ith_bit)
const
249 for (
unsigned i = 0; i < N_BITS_RESERVED; i++) {
250 unsigned j = _outputMap[nconf_ftdl][i];
251 if (ith_bit == j)
return _outputBitNames[i];
259 for (
unsigned i = 0; i < n_output; i++) {
260 for (
unsigned j = 0; j < N_BITS_RESERVED; j++) {
261 unsigned k = _outputMap[nconf_ftdl][j];
263 printf(
"%3u %10s %d\n", i, _outputBitNames[j], _psnmValues[nconf_psnm][i]);
273 printf(
"TrgBit class: exp(%u), run(%u), nconf_psnm(%u), nconf_ftdl(%u), nconf_input(%u), n_input(%u), n_output(%u)\n", _exp, _run,
274 nconf_psnm, nconf_ftdl, nconf_input, n_input, n_output);
291 for (
unsigned i = 0; i < N_BITS_RESERVED; i++) {
292 if (! strcmp(_inputBitNames[i], bitname)) {
293 return _inputMap[nconf_input][i];
302 for (
unsigned i = 0; i < N_BITS_RESERVED; i++) {
303 if (! strcmp(_outputBitNames[i], bitname)) {
304 return _outputMap[nconf_ftdl][i];
313 unsigned bit = _inputMap[nconf_input][a];
314 if (bit == 999)
return false;
321 unsigned bit = _outputMap[nconf_ftdl][a];
322 if (bit == 999)
return false;
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
ETimingType
types of trigger timing source defined in b2tt firmware
int operator[](unsigned)
Bit.
bool isFired(unsigned bit) const
get fired or not
void set(unsigned pattern, unsigned wordPosition)
reads/sets a bit.
const char * getInputBitName(unsigned ith_bit) const
returns bit name
std::vector< unsigned > _itdVector
hit information in vector
bool isFired(output bitname) const
returns true if the psnm bit is fired.
bool isUsed(input a) const
Whether the bit exists for the run.
std::string version(void) const
returns TrgBit version;
std::string versionFTDL(void) const
returns FTDL version;
int getBitNum(const char *bitname) const
returns bit number for the exprun, if >=0 it is input_bitnum if <0 it is -output_bitnum-1
unsigned getOutputBitNum(const char *bitname) const
returns bit number
virtual ~TrgBit()
Destructor.
unsigned getInputBitNum(const char *bitname) const
returns bit number
void printConf(void) const
print configuration values
unsigned preScaleValue(output A) const
returns pre-scale value.
void printPreScaleValues(void) const
print prescale values
TRGSummary::ETimingType getTimingSource(void) const
returns timing source
Abstract base class for different kinds of events.