 |
Belle II Software
release-05-01-25
|
16 #define TRGCDC_SHORT_NAMES
20 #include "trg/trg/Debug.h"
21 #include "trg/trg/State.h"
22 #include "trg/trg/Channel.h"
23 #include "trg/cdc/TRGCDC.h"
24 #include "trg/cdc/Wire.h"
25 #include "trg/cdc/Segment.h"
26 #include "trg/cdc/Tracker2D.h"
27 #include "trg/cdc/TrackSegmentFinder.h"
37 unsigned TRGCDCTracker2D::_nTSF = 0;
38 vector<unsigned> TRGCDCTracker2D::_n;
39 TRGState TRGCDCTracker2D::_ts(160 + 192 + 256 + 320 + 384);
41 TRGCDCTracker2D::TRGCDCTracker2D(
const std::string& name,
46 :
TRGBoard(name, systemClock, dataClock, userClockInput, userClockOutput)
57 return (
"TRGCDCTracker2D version 0.00");
63 std::vector<const TRGCDCTrackSegmentFinder*>::push_back(a);
76 const string sn =
"TRGCDC 2D simulate : " +
name();
79 static bool first =
true;
87 for (
unsigned i = 0; i <
nOutput(); i++)
95 for (
unsigned i = 0; i < 5; i++) {
99 for (
unsigned j = 0; j < b->size(); j++) {
100 isb.push_back((* b)[j]);
108 const string no =
name() +
"OutputSignalBundle";
114 TCTracker2D::packer);
121 TCTracker2D::packer(
const TRGState& input,
123 bool& logicStillActive)
136 for (
unsigned i = 0; i < nTSF() / 2; i++) {
139 registers.
set(i * 16, s);
144 unpacker(input, registers);
147 hitInformation(registers);
154 logicStillActive = registers.
active();
156 return TRGState(256);
160 TCTracker2D:: unpacker(
const TRGState& input,
164 const string sn =
"TRGCDC 2D unpacker";
169 const unsigned sizeSB = 420;
170 const unsigned sizeTS = 21;
171 const unsigned sizeID = 8;
172 const unsigned posID = 13;
175 unsigned tsfId[5][20];
176 bool hitFound =
false;
177 for (
unsigned i = 0; i < 5; i++) {
178 for (
unsigned j = 0; j < 20; j++) {
179 unsigned jr = 20 - j - 1;
180 tsfId[i][jr] = input.subset(i * sizeSB + sizeTS * jr + posID,
182 if (tsfId[i][jr] != 0) {
183 output.set(tsfId[i][jr] * 16,
true);
192 for (
unsigned i = 0; i < 5; i++) {
194 <<
" < " << nTSF(i) / 2 << endl;
196 for (
unsigned j = 0; j < 20; j++) {
197 cout << tsfId[i][j] <<
",";
207 TCTracker2D::hitInformation(
const TRGState& registers)
214 for (
unsigned i = 0; i < nTSF() / 2; i++) {
215 bool active = registers.subset(i * 16, 16).active();
222 TCTracker2D::setConstants(
void)
228 for (
unsigned i = 0; i < 5; i++) {
229 const unsigned n = cdc.nSegments(i * 2);
235 if (_nTSF != nTSF()) {
236 cout <<
"TRGCDCTracker2D !!! # of TSF is inconsistent internally"
238 cout <<
" _nTSF,nTSF()=" << _nTSF <<
"," << nTSF()
241 for (
unsigned i = 0; i < 5; i++) {
242 if (_n[i] != nTSF(i)) {
243 cout <<
"TRGCDCTracker2D !!! # of TSF is inconsistent internally"
245 cout <<
" i,_n[i],nTSF(i)=" << i <<
","
246 << _n[i] <<
"," << nTSF(i) << endl;
250 if (_nTSF != _ts.size()) {
251 cout <<
"TRGCDCTracker2D !!! # of TSF is inconsistent internally"
253 cout <<
" _nTSF,_ts.size()=" << _nTSF <<
","
254 << _ts.size() << endl;
A class to represent a trigger board.
static int level(void)
returns the debug level.
const TRGClock & clockData(void) const
returns data clock.
TRGState subset(unsigned i, unsigned n) const
returns subset from i with n bits.
void simulate(void)
simulates firmware.
A class to represent a state of multi bits.
A class to represent a bundle of SignalVectors.
const std::string & name(void) const
returns name.
bool active(void) const
returns true if there are active bits.
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
TRGSignalBundle * signal(void) const
returns signal.
TRGChannel * output(unsigned i) const
returns output channel i.
const TRGState & set(unsigned position, bool state=true)
sets state at bit i.
static std::string version(void)
returns version.
a class of TrackSegmentFinder in TRGCDC
unsigned nOutput(void) const
returns output channels.
Abstract base class for different kinds of events.
static TRGCDC * getTRGCDC(void)
returns TRGCDC object.
static unsigned _nTSF
# of TSFs.
static std::string tab(void)
returns tab spaces.
void push_back(const TRGCDCTrackSegmentFinder *)
Appends a TSF board.
virtual ~TRGCDCTracker2D()
Destructor.
static void leaveStage(const std::string &stageName)
Declare that you leave a stage.
static void enterStage(const std::string &stageName)
Declare that you enter new stage.
A class to represent a digitized signal. Unit is nano second.
const TRGChannel * input(unsigned i) const
returns input channel i.
void setConstants(void)
Sets constants.