13#define TRGCDC_SHORT_NAMES
17#include "trg/trg/Debug.h"
18#include "trg/trg/State.h"
19#include "trg/trg/Channel.h"
20#include "trg/cdc/TRGCDC.h"
21#include "trg/cdc/Wire.h"
22#include "trg/cdc/Segment.h"
23#include "trg/cdc/Tracker2D.h"
24#include "trg/cdc/TrackSegmentFinder.h"
43 :
TRGBoard(name, systemClock, dataClock, userClockInput, userClockOutput)
54 return (
"TRGCDCTracker2D version 0.00");
60 std::vector<const TRGCDCTrackSegmentFinder*>::push_back(a);
73 const string sn =
"TRGCDC 2D simulate : " +
name();
76 static bool first =
true;
84 for (
unsigned i = 0; i <
nOutput(); i++)
85 if (output(i)->signal())
86 delete output(i)->signal();
92 for (
unsigned i = 0; i < 5; i++) {
96 for (
unsigned j = 0; j < b->size(); j++) {
97 isb.push_back((* b)[j]);
105 const string no =
name() +
"OutputSignalBundle";
111 TCTracker2D::packer);
112 output(0)->signal(osb);
120 bool& logicStillActive)
133 for (
unsigned i = 0; i <
nTSF() / 2; i++) {
136 registers.
set(i * 16, s);
151 logicStillActive = registers.
active();
161 const string sn =
"TRGCDC 2D unpacker";
166 const unsigned sizeSB = 420;
167 const unsigned sizeTS = 21;
168 const unsigned sizeID = 8;
169 const unsigned posID = 13;
172 unsigned tsfId[5][20];
173 bool hitFound =
false;
174 for (
unsigned i = 0; i < 5; i++) {
175 for (
unsigned j = 0; j < 20; j++) {
176 unsigned jr = 20 - j - 1;
177 tsfId[i][jr] = input.subset(i * sizeSB + sizeTS * jr + posID,
179 if (tsfId[i][jr] != 0) {
180 output.set(tsfId[i][jr] * 16,
true);
189 for (
unsigned i = 0; i < 5; i++) {
191 <<
" < " <<
nTSF(i) / 2 << endl;
193 for (
unsigned j = 0; j < 20; j++) {
194 cout << tsfId[i][j] <<
",";
211 for (
unsigned i = 0; i <
nTSF() / 2; i++) {
225 for (
unsigned i = 0; i < 5; i++) {
226 const unsigned n = cdc.nSegments(i * 2);
233 cout <<
"TRGCDCTracker2D !!! # of TSF is inconsistent internally"
235 cout <<
" _nTSF,nTSF()=" <<
_nTSF <<
"," <<
nTSF()
238 for (
unsigned i = 0; i < 5; i++) {
240 cout <<
"TRGCDCTracker2D !!! # of TSF is inconsistent internally"
242 cout <<
" i,_n[i],nTSF(i)=" << i <<
","
243 <<
_n[i] <<
"," <<
nTSF(i) << endl;
248 cout <<
"TRGCDCTracker2D !!! # of TSF is inconsistent internally"
250 cout <<
" _nTSF,_ts.size()=" <<
_nTSF <<
","
A class to represent a trigger board.
a class of TrackSegmentFinder in TRGCDC
The instance of TRGCDC is a singleton.
A class to represent a digitized signal. Unit is nano second.
A class to represent a bundle of SignalVectors.
A class to represent a state of multi bits.
TRGCDCTracker2D(const std::string &name, const TRGClock &systemClock, const TRGClock &dataClock, const TRGClock &userClockInput, const TRGClock &userClockOutput)
Constructor.
unsigned size(void) const
returns bit size.
static TRGState packer(const TRGState &input, TRGState ®isters, bool &logicStillActive)
Packer for 3D tracker.
static std::string tab(void)
returns tab spaces.
static void unpacker(const TRGState &input, TRGState &output)
Unpack TSF output.
static TRGCDC * getTRGCDC(void)
returns TRGCDC object.
void push_back(const TRGCDCTrackSegmentFinder *)
Appends a TSF board.
TRGState subset(unsigned i, unsigned n) const
returns subset from i with n bits.
virtual ~TRGCDCTracker2D()
Destructor.
const TRGClock & clockData(void) const
returns data clock.
const std::string & name(void) const
returns name.
static std::vector< unsigned > _n
# of TSFs in super layer i.
static void enterStage(const std::string &stageName)
Declare that you enter new stage.
static unsigned nTSF(void)
returns # of TSF.
const TRGState & set(unsigned position, bool state=true)
sets state at bit i.
static unsigned _nTSF
# of TSFs.
static int level(void)
returns the debug level.
bool active(void) const
returns true if there are active bits.
static void leaveStage(const std::string &stageName)
Declare that you leave a stage.
static std::string version(void)
returns version.
void simulate(void)
simulates firmware.
static void hitInformation(const TRGState ®isters)
Gets TSF hit information for one certin clock from the registers.
void clear(void)
clears state.
unsigned nOutput(void) const
returns output channels.
static TRGState _ts
Keeps TS hit info.
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
void setConstants(void)
Sets constants.
Abstract base class for different kinds of events.