Belle II Software  release-05-02-19
FrontEnd.cc
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : FrontEnd.cc
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a CDC front-end board
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #define TRG_SHORT_NAMES
15 #define TRGCDC_SHORT_NAMES
16 
17 #include "trg/trg/Utilities.h"
18 #include "trg/trg/Debug.h"
19 #include "trg/trg/State.h"
20 #include "trg/cdc/TRGCDC.h"
21 #include "trg/cdc/FrontEnd.h"
22 #include "trg/cdc/Wire.h"
23 
24 using namespace std;
25 
26 namespace Belle2 {
32  TRGCDCFrontEnd::TRGCDCFrontEnd(const std::string& name,
33  boardType type,
34  const TRGClock& systemClock,
35  const TRGClock& dataClock,
36  const TRGClock& userClockOutput)
37  : TRGBoard(name,
38  systemClock,
39  dataClock,
40  userClockOutput,
41  userClockOutput),
42  _type(type),
43  _isb(0),
44  _osb(0)
45  {
46 
47  }
48 
50  {
51  }
52 
53  string
55  {
56  return ("TRGCDCFrontEnd version 0.01");
57  }
58 
61  {
62  return _type;
63  }
64 
65  int
67  ofstream& outfile)
68  {
69 
70  //string cname = "UNKNOWN";
71  // if (_type == innerInside) {
72  outfile << "-- inner type" << endl;
73  string cname = "TRGCDCFrontEndInnerInside";
74  // }
75  // else {
76  // outfile << "-- outer type" << endl;
77  // cname = "TRGCDCFrontEndOuter";
78  // }
79 
80  outfile << "--" << endl;
81  outfile << endl;
82  outfile << " component " << cname << endl;
83  // int err = implementationPort(type, outfile);
84  outfile << " end component;" << endl;
85 
86  outfile << "--------------------------------------------------------------"
87  << endl;
88 
89  outfile << "entity " << cname << "is" << endl;
90  int err = implementationPort(type, outfile);
91  outfile << "end " << cname << ";" << endl;
92  outfile << endl;
93  outfile << "architecture Behavioral of " << cname << " is" << endl;
94  outfile << " -- local" << endl;
95  outfile << endl;
96  outfile << "begin" << endl;
97  outfile << "end Behavioral;" << endl;
98 
99  return err;
100  }
101 
102  int
104  ofstream& outfile)
105  {
106  outfile << " port (" << endl;
107 
108  //...125MHz clock (TRG system clock)...
109  outfile << " -- 125MHz clock (TRG system clock)" << endl;
110  outfile << " clk : in std_logic;" << endl;
111 
112  //...Coarse timing...
113  outfile << " -- Coarse timing (counter with 125MHz clock)" << endl;
114  outfile << " tmc : in std_logic_vector(0 to 12);" << endl;
115 
116  //...Hit pattern...
117  outfile << " -- Hit pattern(48 bits for 48 wires)" << endl;
118  outfile << " ptn : in std_logic_vector(0 to 47);" << endl;
119 
120  //...Fine timing for each wire...
121  outfile << " -- Fine timing within 125MHz clock" << endl;
122  for (unsigned i = 0; i < 48; i++) {
123  outfile << " w" << TRGUtil::itostring(i)
124  << " : in std_logic_vector(0 to 3);" << endl;
125  }
126 
127  //...Hit pattern output...
128  outfile << " -- Hit pattern output" << endl;
129  outfile << " hit : out std_logic_vector(0 to 47);" << endl;
130  outfile << " -- 4 bit fine timing for 16 priority wires" << endl;
131  outfile << " pri : out std_logic_vector(0 to 63);" << endl;
132  outfile << " -- 2 bit fine timing for the fastest hit in 16 TS"
133  << endl;
134  outfile << " fst : out std_logic_vector(0 to 31)" << endl;
135  outfile << " );" << endl;
136 
137  return 0;
138  }
139 
140  void
142  {
143  std::vector<const TRGCDCWire*>::push_back(a);
144  }
145 
146  void
147  TRGCDCFrontEnd::dump(const string& message, const string& pre) const
148  {
149  TRGBoard::dump(message, pre);
150  }
151 
152  void
154  {
155 
156 
157  //...Clear input signal bundle...
158  if (_isb) {
159  for (unsigned i = 0; i < _isb->size(); i++)
160  delete(* _isb)[i];
161  delete _isb;
162  }
163  if (_osb) {
164  for (unsigned i = 0; i < _osb->size(); i++)
165  delete(* _osb)[i];
166  delete _osb;
167  }
168 
169  //...Clock...
170  const TRGClock& dClock = clockData();
171 
172  //...Input from wires...
173  const unsigned nWires = size();
174  TRGSignalVector input(name() + "inputSignals", dClock);
175  for (unsigned i = 0; i < nWires; i++) {
176 
177  //...This may be too expensive. There must be a class to hold pointers.
178  input += (* this)[i]->signal();
179  }
180 
181  //...Make input signal bundle...
182  const string ni = name() + "InputSignalBundle";
183  _isb = new TRGSignalBundle(ni, dClock);
184 
185  //...Create hit pattern bits...
186  TRGSignalVector* pattern = new TRGSignalVector(input);
187  pattern->clock(dClock);
188  pattern->name(name() + "@dataClock");
189  _isb->push_back(pattern);
190 
191  // if (TRGDebug::level() > 1) {
192  // if (input.active()) {
193  // input.dump("", TRGDebug::tab());
194  // pattern->dump("", TRGDebug::tab());
195  // }
196  // }
197 
198  // output wire hit info into a .log file
199  // ofstream wireinfo((name()+"_wireinfo.log").c_str());
200 
201 
202  //...Create Wire timing bits...
203  for (unsigned i = 0; i < nWires; i++) {
204 
205  const TRGSignal& s = input[i];
206  const string n = s.name() + ":5bits";
207  TRGSignalVector* bit5 = new TRGSignalVector(n, dClock);
208 
209  //...No hit case : only dummy data...
210  if (!(* pattern)[i].active()) {
211  TRGSignal sig0(n + "-0", dClock);
212  TRGSignal sig1(n + "-1", dClock);
213  TRGSignal sig2(n + "-2", dClock);
214  TRGSignal sig3(n + "-3", dClock);
215  TRGSignal sig4(n + "-4", dClock);
216  bit5->push_back(sig0);
217  bit5->push_back(sig1);
218  bit5->push_back(sig2);
219  bit5->push_back(sig3);
220  bit5->push_back(sig4);
221  }
222 
223  //...Hit case...
224  else {
225 
226  // wire hit info -> .log
227  /*
228  if (type() == innerInside) { wireinfo << endl << " #" << (i > 15 ? i - 16 : 99999 ) << " wire is hit" << endl; }
229  else { wireinfo << endl << " #" << i << " wire is hit" << endl; }
230  output << endl;
231  */
232 
233  // s is wire signal which is hit.
234  const std::vector<int> timing = s.stateChanges();
235  const unsigned nStates = timing.size();
236  // Loop over all the changing timing.
237  for (unsigned j = 0; j < nStates; j++) {
238  const int pos = timing[j];
239 
240  //...Look at leading edges only...
241  if (s.state(pos)) {
242  const double at = s.clock().absoluteTime(pos);
243  const int pos1 = dClock.position(at);
244  const double phase = dClock.phase(at);
245  const unsigned bits = unsigned(phase / (360. / 32.));
246 
247  // cout << "at,phase,bits,pos1=" << at << "," << phase << ","
248  // << bits <<","<<pos1<< endl;
249 
250  // Change priority timing from unsigned into SignalVector.
251  if (bit5->active()) {
252  for (unsigned k = 0; k < 5; k++) {
253  if ((bits >> k) & 1)
254  (*bit5)[k].set(pos1, pos1 + 1);
255  }
256  } else {
257  for (unsigned k = 0; k < 5; k++) {
258  const string n1 = n + "-" + TRGUtilities::itostring(k);
259  TRGSignal sig(n1, dClock);
260  if ((bits >> k) & 1)
261  sig.set(pos1, pos1 + 1);
262  (* bit5) += sig;
263  }
264  }
265 
266 
267  //wire info -> .log
268  /*
269  //timing = 00000 case:
270  if ( !(bit5->stateChanges()).size() ) {
271  output << "# of clk: " << pos1 << " (" << pos1*32 << " ns), signal vector: 0 0 0 0 0" << endl;
272  }
273 
274  const std::vector<int> bit5_changetime = bit5->stateChanges();
275  std::vector<vector<int>> bit5_boolvector(bit5_changetime.size());
276  for (unsigned ch_t = 0; ch_t < bit5_changetime.size(); ch_t++) {
277 
278  for (unsigned b = 0; b < bit5->size(); b++){
279  bit5_boolvector[ch_t].push_back( (bit5->state( bit5_changetime[ch_t])[b]) ? 1 : 0 );
280  }
281 
282  wireinfo << "# of clk: " << bit5_changetime[ch_t] << " (" << dClock.absoluteTime(bit5_changetime[ch_t]) << " ns), signal vector: " ;
283 
284  for (unsigned b = 0; b < bit5->size(); b++){
285  wireinfo << bit5_boolvector[ch_t][ bit5->size() - b - 1] << " " ;
286  }
287 
288  wireinfo << endl;
289  }
290  */
291 
292 
293 #ifdef TRG_DEBUG
294 // bit5->dump("detail", TRGDebug::tab());
295 #endif
296  }
297  }
298  }
299 
300  _isb->push_back(bit5);
301  }
302 
303  //...Data clock...
304  // Data clock position data is omitted. Is this problem?
305 
306  //...Make output signal bundle...
307  const string no = name() + "OutputSignalBundle";
308  if (type() == innerInside)
309  _osb = new TRGSignalBundle(no,
310  dClock,
311  * _isb,
312  256,
313  TCFrontEnd::packerInnerInside);
314  else if (type() == innerOutside)
315  _osb = new TRGSignalBundle(no,
316  dClock,
317  * _isb,
318  256,
319  TCFrontEnd::packerInnerOutside);
320  else if (type() == outerInside)
321  _osb = new TRGSignalBundle(no,
322  dClock,
323  * _isb,
324  256,
325  TCFrontEnd::packerOuterInside);
326  else if (type() == outerOutside)
327  _osb = new TRGSignalBundle(no,
328  dClock,
329  * _isb,
330  256,
331  TCFrontEnd::packerOuterOutside);
332 
333  if (TRGDebug::level() > 1) {
334  cout << TRGDebug::tab() << name() << " input bundle" << endl;
335  _isb->dump("", TRGDebug::tab() + " ");
336  cout << TRGDebug::tab() << name() << " output bundle" << endl;
337  _osb->dump("", TRGDebug::tab() + " ");
338  }
339  }
340 
341  TRGState
342  TCFrontEnd::packerInnerInside(const TRGState& input)
343  {
344 
345  //...Input should be 48 hit pattern and 48x5 timing, total 288 bits...
346  //
347  // Wire numbers and TS ID
348  //
349  // outside
350  //
351  // +--+--+--+--+- -+--+--+--+--+--+--+
352  // | 31 | 30 | .... | 18 | 17 | 16 |
353  // +--+--+--+--+--+- -+--+--+--+--+--+--+
354  // | 15 | 14 | .....| 2 | 1 | 0 |
355  // +--+--+--+--+--+- -+--+--+--+--+--+--+
356  // | x | x | .... | x | x | x |
357  // +--+--+--+--+- -+--+--+--+--+--+--+
358  //
359  // 15 14 .... 2 1 0 <- partial TS ID
360  //
361  // inside
362  //
363 
364  //...Prepare a state for output...
365  TRGState s(32 + 16 * 5 + 16 + 16 * 5 + 1 * 5 + 43); // 1*5 for missing wire + 43 bits to fill to 256 bits
366 
367  //...Set up bool array...
368  bool* b = new bool[input.size()];
369  input.copy2bool(b);
370 
371  //...Naming...
372  const bool* const hitptn = & b[16]; // 16x2 = 32 bits
373  const bool* const timing[32] = {
374  & b[128], & b[133], & b[138], & b[143],
375  & b[148], & b[153], & b[158], & b[163],
376  & b[168], & b[173], & b[178], & b[183],
377  & b[188], & b[193], & b[198], & b[203],
378  & b[208], & b[213], & b[218], & b[223],
379  & b[228], & b[233], & b[238], & b[243],
380  & b[248], & b[253], & b[258], & b[263],
381  & b[268], & b[273], & b[278], & b[283]
382  };
383 
384  //...Store hit pattern...
385  s.set(0, 32, hitptn);
386  unsigned p = 32;
387 
388  //bool true_5[5] = {true, true, true, true, true};
389 
390  //...Priority timing...
391  TRGState secondPriority(16);
392  for (unsigned i = 0; i < 16; i++) {
393 
394  //...Priority cell...
395  if (hitptn[i]) {
396  s.set(p, 5, timing[i]);
397  }
398 
399  //...Second priority cells...
400  else {
401 
402  //...Right side edge...
403  if (i == 0) {
404  if (hitptn[16]) {
405  s.set(p, 5, timing[16]);
406  secondPriority.set(i, true);
407  } else {
408  // s.set(p, 5, true_5);
409  secondPriority.set(i, false);
410  }
411  }
412 
413  //...Others...
414  else {
415 
416  //...Both secondarys have hit...
417  if (hitptn[i + 15] && hitptn[i + 16]) {
418  const unsigned t0 = TRGState::toUnsigned(5, timing[15]);
419  const unsigned t1 = TRGState::toUnsigned(5, timing[16]);
420  if (t0 < t1) {
421  s.set(p, 5, timing[i + 15]);
422  secondPriority.set(i, false);
423  } else {
424  s.set(p, 5, timing[i + 16]);
425  secondPriority.set(i, true);
426  }
427  }
428 
429  //...Secondary at right side...
430  else if (hitptn[i + 15]) {
431  s.set(p, 5, timing[i + 15]);
432  secondPriority.set(i, false);
433  }
434 
435  //...Secondary at left side...
436  else if (hitptn[i + 16]) {
437  s.set(p, 5, timing[i + 16]);
438  secondPriority.set(i, true);
439  }
440 
441  // No secondary case. No action
442  else {
443  //s.set(p, 5, true_5);
444  //secondPriority.set(i, true);
445  }
446  }
447  }
448 
449  p += 5;
450  }
451 
452  s.set(p, secondPriority);
453  p += 16;
454 
455  //...Fastest timing...
456  for (unsigned i = 0; i < 16; i++) {
457 
458  //...Right side edge...
459  if (i == 0) {
460  const bool h[2] = {hitptn[0], hitptn[16]};
461  const unsigned hh = TRGState::toUnsigned(2, h);
462  const unsigned t0 = TRGState::toUnsigned(5, timing[0]);
463  const unsigned t1 = TRGState::toUnsigned(5, timing[16]);
464 
465  //...No hit case : no action
466  if (hh == 0) {
467  //s.set(p, 5, true_5);
468  }
469 
470  //...One hit case...
471  else if (hh == 1) {
472  s.set(p, 5, timing[0]);
473  } else if (hh == 2) {
474  s.set(p, 5, timing[16]);
475  }
476 
477  //...Two hit case...
478  else {
479  if (t0 <= t1)
480  s.set(p, 5, timing[0]);
481  else
482  s.set(p, 5, timing[16]);
483  }
484  }
485 
486  //...Others...
487  else {
488  const unsigned i0 = i;
489  const unsigned i1 = i + 15;
490  const unsigned i2 = i + 16;
491  const bool h[3] = {hitptn[i0], hitptn[i1], hitptn[i2]};
492  const unsigned hh = TRGState::toUnsigned(3, h);
493  const unsigned t0 = TRGState::toUnsigned(5, timing[i0]);
494  const unsigned t1 = TRGState::toUnsigned(5, timing[i1]);
495  const unsigned t2 = TRGState::toUnsigned(5, timing[i2]);
496 
497  //...No hit case : no action
498  if (hh == 0) {
499  //s.set(p, 5, true_5);
500  }
501 
502  //...One hit case...
503  else if (hh == 1) {
504  // cout << "p=" << p << endl;
505  // cout << "one hit pri" << endl;
506  // s.dump("detail", "one hit pri ");
507  // s.subset(p, 5).dump("detail", "one hit pri ");
508  s.set(p, 5, timing[i0]);
509  // s.dump("detail", "one hit pri ");
510  // s.subset(p, 5).dump("detail", "one hit pri ");
511  } else if (hh == 2) {
512  // cout << "one hit sec0" << endl;
513  s.set(p, 5, timing[i1]);
514  } else if (hh == 4) {
515  // cout << "one hit sec1" << endl;
516  s.set(p, 5, timing[i2]);
517  }
518 
519  //...Two hit case...
520  else if (hh == 3) {
521  if (t0 <= t1)
522  s.set(p, 5, timing[i0]);
523  else
524  s.set(p, 5, timing[i1]);
525  } else if (hh == 5) {
526  if (t0 <= t2)
527  s.set(p, 5, timing[i0]);
528  else
529  s.set(p, 5, timing[i2]);
530  } else if (hh == 6) {
531  if (t1 <= t2)
532  s.set(p, 5, timing[i1]);
533  else
534  s.set(p, 5, timing[i2]);
535  }
536 
537  //...Three hit case...
538  else {
539  if ((t0 <= t1) && (t0 <= t2))
540  s.set(p, 5, timing[i0]);
541  else if (t1 <= t2)
542  s.set(p, 5, timing[i1]);
543  else
544  s.set(p, 5, timing[i2]);
545  }
546  }
547 
548  p += 5;
549  }
550 
551  //...Timing of missing wires on edge TS...
552  if (hitptn[31]) {
553  s.set(p, 5, timing[31]);
554  } else {
555  //s.set(p, 5, true_5);
556  }
557  // p+=5;
558 
559  //...Debug...
560 #ifdef TRG_DEBUG
561  // input.dump("detail", TRGDebug::tab() + "FrontEnd_II in ");
562  // s.dump("detail", TRGDebug::tab() + "FrontEnd_II out ");
563 // unpackerInnerInside(input, s);
564 #endif
565 
566  //...Termination...
567  delete[] b;
568  return s;
569  }
570 
571  TRGState
572  TCFrontEnd::packerInnerOutside(const TRGState& input)
573  {
574 
575  //...Input should be 48 hit pattern and 48x5 timing, total 288 bits...
576  //
577  // Wire numbers and TS ID
578  //
579  // outside
580  //
581  // +--+--+--+--+- -+--+--+--+--+--+--+
582  // | 47 | 46 | .... | 34 | 33 | 32 |
583  // +--+--+--+--+--+- -+--+--+--+--+--+--+
584  // | 31 | 30 | ..... | 18 | 17 | 16 |
585  // +--+--+--+--+--+- -+--+--+--+--+--+--+
586  // | 15 | 14 | .... | 2 | 1 | 0 |
587  // +--+--+--+--+- -+--+--+--+--+--+--+
588  //
589  // 15 14 .... 2 1 0 <- partial TS ID
590  //
591  // inside
592  //
593 
594  //...Prepare a state for output...
595  TRGState s(48 + 16 * 5 + 4 * 5 + 108); // 4*5 for missing area timings + 108 to fill to 256 bits
596 
597  //...Set up bool array...
598  bool* b = new bool[input.size()];
599  input.copy2bool(b);
600 
601  //...Naming...
602  const bool* const hitptn = & b[0]; // 16x3 = 48 bits
603  const bool* const timing[48] = {
604  & b[48], & b[53], & b[58], & b[63],
605  & b[68], & b[73], & b[78], & b[83],
606  & b[88], & b[93], & b[98], & b[103],
607  & b[108], & b[113], & b[118], & b[123],
608  & b[128], & b[133], & b[138], & b[143],
609  & b[148], & b[153], & b[158], & b[163],
610  & b[168], & b[173], & b[178], & b[183],
611  & b[188], & b[193], & b[198], & b[203],
612  & b[208], & b[213], & b[218], & b[223],
613  & b[228], & b[233], & b[238], & b[243],
614  & b[248], & b[253], & b[258], & b[263],
615  & b[268], & b[273], & b[278], & b[283]
616  };
617 
618  //...Store hit pattern...
619  s.set(0, 48, hitptn);
620  unsigned p = 48;
621 
622  //...Fastest timing...
623  const bool dummy[6] = {false, false, false, false, false, true},
624  dummymax[5] = {true, true, true, true, true};
625  const TRGState wtDummy(6, dummy), wtDummymax(5, dummymax);
626  for (unsigned i = 0; i < 20; i++) { // 0 ... 15 for 16 standard ones, 16...19 for four edge areas.
627  TRGState wt[12];
628 
629  if (i == 0) { // TS ID 0 has missing wires
630  wt[0] = wtDummy;
631  wt[1] = TRGState(5, timing[0]);
632  wt[2] = TRGState(5, timing[1]);
633  wt[3] = wtDummy;
634  wt[4] = wtDummy;
635  wt[5] = TRGState(5, timing[16]);
636  wt[6] = TRGState(5, timing[17]);
637  wt[7] = wtDummy;
638  wt[8] = wtDummy;
639  wt[9] = TRGState(5, timing[32]);
640  wt[10] = TRGState(5, timing[33]);
641  wt[11] = TRGState(5, timing[34]);
642 
643  //...Append 6th bit to indicate hit or not (no hit = 1)...
644  if (! hitptn[0]) wt[1].set(5, true);
645  if (! hitptn[1]) wt[2].set(5, true);
646  if (! hitptn[16]) wt[5].set(5, true);
647  if (! hitptn[17]) wt[6].set(5, true);
648  if (! hitptn[32]) wt[9].set(5, true);
649  if (! hitptn[33]) wt[10].set(5, true);
650  if (! hitptn[34]) wt[11].set(5, true);
651  } else if (i == 1) { // TS ID 1 has missing wires
652  wt[0] = TRGState(5, timing[0]);
653  wt[1] = TRGState(5, timing[1]);
654  wt[2] = TRGState(5, timing[2]);
655  wt[3] = wtDummy;
656  wt[4] = TRGState(5, timing[16]);
657  wt[5] = TRGState(5, timing[17]);
658  wt[6] = TRGState(5, timing[18]);
659  wt[7] = wtDummy;
660  wt[8] = TRGState(5, timing[32]);
661  wt[9] = TRGState(5, timing[33]);
662  wt[10] = TRGState(5, timing[34]);
663  wt[11] = TRGState(5, timing[35]);
664 
665  //...Append 6th bit to indicate hit or not (no hit = 1)...
666  if (! hitptn[0]) wt[0].set(5, true);
667  if (! hitptn[1]) wt[1].set(5, true);
668  if (! hitptn[2]) wt[2].set(5, true);
669  if (! hitptn[16]) wt[4].set(5, true);
670  if (! hitptn[17]) wt[5].set(5, true);
671  if (! hitptn[18]) wt[6].set(5, true);
672  if (! hitptn[32]) wt[8].set(5, true);
673  if (! hitptn[33]) wt[9].set(5, true);
674  if (! hitptn[34]) wt[10].set(5, true);
675  if (! hitptn[35]) wt[11].set(5, true);
676  } else if (i == 14) { // TS ID 14 has missing wires
677  wt[0] = TRGState(5, timing[13]);
678  wt[1] = TRGState(5, timing[14]);
679  wt[2] = TRGState(5, timing[15]);
680  wt[3] = TRGState(5, timing[28]);
681  wt[4] = TRGState(5, timing[29]);
682  wt[5] = TRGState(5, timing[30]);
683  wt[6] = TRGState(5, timing[31]);
684  wt[7] = TRGState(5, timing[44]);
685  wt[8] = TRGState(5, timing[45]);
686  wt[9] = TRGState(5, timing[46]);
687  wt[10] = TRGState(5, timing[47]);
688  wt[11] = wtDummy;
689 
690  //...Append 6th bit to indicate hit or not (no hit = 1)...
691  if (! hitptn[13]) wt[0].set(5, true);
692  if (! hitptn[14]) wt[1].set(5, true);
693  if (! hitptn[15]) wt[2].set(5, true);
694  if (! hitptn[28]) wt[3].set(5, true);
695  if (! hitptn[29]) wt[4].set(5, true);
696  if (! hitptn[30]) wt[5].set(5, true);
697  if (! hitptn[31]) wt[6].set(5, true);
698  if (! hitptn[44]) wt[7].set(5, true);
699  if (! hitptn[45]) wt[8].set(5, true);
700  if (! hitptn[46]) wt[9].set(5, true);
701  if (! hitptn[47]) wt[10].set(5, true);
702  } else if (i == 15) { // TS ID 15 has missing wires
703  wt[0] = TRGState(5, timing[14]);
704  wt[1] = TRGState(5, timing[15]);
705  wt[2] = wtDummy;
706  wt[3] = TRGState(5, timing[29]);
707  wt[4] = TRGState(5, timing[30]);
708  wt[5] = TRGState(5, timing[31]);
709  wt[6] = wtDummy;
710  wt[7] = TRGState(5, timing[45]);
711  wt[8] = TRGState(5, timing[46]);
712  wt[9] = TRGState(5, timing[47]);
713  wt[10] = wtDummy;
714  wt[11] = wtDummy;
715 
716  //...Append 6th bit to indicate hit or not (no hit = 1)...
717  if (! hitptn[14]) wt[0].set(5, true);
718  if (! hitptn[15]) wt[1].set(5, true);
719  if (! hitptn[29]) wt[3].set(5, true);
720  if (! hitptn[30]) wt[4].set(5, true);
721  if (! hitptn[31]) wt[5].set(5, true);
722  if (! hitptn[45]) wt[7].set(5, true);
723  if (! hitptn[46]) wt[8].set(5, true);
724  if (! hitptn[47]) wt[9].set(5, true);
725  } else if (i == 16) { // edge area 1, only cell 32 at position 11
726  wt[0] = wtDummy;
727  wt[1] = wtDummy;
728  wt[2] = wtDummy;
729  wt[3] = wtDummy;
730  wt[4] = wtDummy;
731  wt[5] = wtDummy;
732  wt[6] = wtDummy;
733  wt[7] = wtDummy;
734  wt[8] = wtDummy;
735  wt[9] = wtDummy;
736  wt[10] = wtDummy;
737  wt[11] = TRGState(5, timing[32]);
738 
739  //...Append 6th bit to indicate hit or not (no hit = 1)...
740  if (! hitptn[32]) wt[11].set(5, true);
741  } else if (i == 17) { // edge area 1, cell 0, 16, 32, 33 at position 2, 6, 10, 11
742  wt[0] = wtDummy;
743  wt[1] = wtDummy;
744  wt[2] = TRGState(5, timing[0]);
745  wt[3] = wtDummy;
746  wt[4] = wtDummy;
747  wt[5] = wtDummy;
748  wt[6] = TRGState(5, timing[16]);
749  wt[7] = wtDummy;
750  wt[8] = wtDummy;
751  wt[9] = wtDummy;
752  wt[10] = TRGState(5, timing[32]);
753  wt[11] = TRGState(5, timing[33]);
754 
755  //...Append 6th bit to indicate hit or not (no hit = 1)...
756  if (! hitptn[0]) wt[2].set(5, true);
757  if (! hitptn[16]) wt[6].set(5, true);
758  if (! hitptn[32]) wt[10].set(5, true);
759  if (! hitptn[33]) wt[11].set(5, true);
760  } else if (i == 18) { // edge area 3, cell 15, 30, 31, 46, 47 at position 0, 3, 4, 7, 8
761  wt[0] = TRGState(5, timing[15]);
762  wt[1] = wtDummy;
763  wt[2] = wtDummy;
764  wt[3] = TRGState(5, timing[30]);
765  wt[4] = TRGState(5, timing[31]);
766  wt[5] = wtDummy;
767  wt[6] = wtDummy;
768  wt[7] = TRGState(5, timing[46]);
769  wt[8] = TRGState(5, timing[47]);
770  wt[9] = wtDummy;
771  wt[10] = wtDummy;
772  wt[11] = wtDummy;
773 
774  //...Append 6th bit to indicate hit or not (no hit = 1)...
775  if (! hitptn[15]) wt[0].set(5, true);
776  if (! hitptn[30]) wt[3].set(5, true);
777  if (! hitptn[31]) wt[4].set(5, true);
778  if (! hitptn[46]) wt[7].set(5, true);
779  if (! hitptn[47]) wt[8].set(5, true);
780  } else if (i == 19) { // edge area 4, only cell 31 and 47 at position 3 and 7
781  wt[0] = wtDummy;
782  wt[1] = wtDummy;
783  wt[2] = wtDummy;
784  wt[3] = TRGState(5, timing[31]);
785  wt[4] = wtDummy;
786  wt[5] = wtDummy;
787  wt[6] = wtDummy;
788  wt[7] = TRGState(5, timing[47]);
789  wt[8] = wtDummy;
790  wt[9] = wtDummy;
791  wt[10] = wtDummy;
792  wt[11] = wtDummy;
793 
794  //...Append 6th bit to indicate hit or not (no hit = 1)...
795  if (! hitptn[31]) wt[3].set(5, true);
796  if (! hitptn[47]) wt[7].set(5, true);
797  } else {
798  wt[0] = TRGState(5, timing[i - 1]);
799  wt[1] = TRGState(5, timing[i]);
800  wt[2] = TRGState(5, timing[i + 1]);
801  wt[3] = TRGState(5, timing[i + 14]);
802  wt[4] = TRGState(5, timing[i + 15]);
803  wt[5] = TRGState(5, timing[i + 16]);
804  wt[6] = TRGState(5, timing[i + 17]);
805  wt[7] = TRGState(5, timing[i + 30]);
806  wt[8] = TRGState(5, timing[i + 31]);
807  wt[9] = TRGState(5, timing[i + 32]);
808  wt[10] = TRGState(5, timing[i + 33]);
809  wt[11] = TRGState(5, timing[i + 34]);
810 
811  //...Append 6th bit to indicate hit or not (no hit = 1)...
812  if (! hitptn[i - 1]) wt[0].set(5, true);
813  if (! hitptn[i]) wt[1].set(5, true);
814  if (! hitptn[i + 1]) wt[2].set(5, true);
815  if (! hitptn[i + 14]) wt[3].set(5, true);
816  if (! hitptn[i + 15]) wt[4].set(5, true);
817  if (! hitptn[i + 16]) wt[5].set(5, true);
818  if (! hitptn[i + 17]) wt[6].set(5, true);
819  if (! hitptn[i + 30]) wt[7].set(5, true);
820  if (! hitptn[i + 31]) wt[8].set(5, true);
821  if (! hitptn[i + 32]) wt[9].set(5, true);
822  if (! hitptn[i + 33]) wt[10].set(5, true);
823  if (! hitptn[i + 34]) wt[11].set(5, true);
824  }
825 
826  //...Look for the fastest hit...
827  unsigned fastest0 = 0;
828  unsigned fastest1 = 0;
829  unsigned fastest2 = 0;
830  unsigned fastest3 = 0;
831  unsigned fastest4 = 0;
832  unsigned fastest5 = 0;
833  if (wt[0] < wt[1])
834  fastest0 = 0;
835  else
836  fastest0 = 1;
837  if (wt[2] < wt[3])
838  fastest1 = 2;
839  else
840  fastest1 = 3;
841  if (wt[4] < wt[5])
842  fastest2 = 4;
843  else
844  fastest2 = 5;
845  if (wt[6] < wt[7])
846  fastest3 = 6;
847  else
848  fastest3 = 7;
849  if (wt[8] < wt[9])
850  fastest4 = 8;
851  else
852  fastest4 = 9;
853  if (wt[10] < wt[11])
854  fastest5 = 10;
855  else
856  fastest5 = 11;
857 
858  unsigned fastest10 = 0;
859  if (wt[fastest0] < wt[fastest1])
860  fastest10 = fastest0;
861  else
862  fastest10 = fastest1;
863 
864  unsigned fastest11 = 0;
865  if (wt[fastest2] < wt[fastest3])
866  fastest11 = fastest2;
867  else
868  fastest11 = fastest3;
869 
870  unsigned fastest12 = 0;
871  if (wt[fastest4] < wt[fastest5])
872  fastest12 = fastest4;
873  else
874  fastest12 = fastest5;
875 
876  unsigned fastest101 = 0;
877  if (wt[fastest10] < wt[fastest11])
878  fastest101 = fastest10;
879  else
880  fastest101 = fastest11;
881 
882  unsigned fastest102 = 0;
883  if (wt[fastest101] < wt[fastest12])
884  fastest102 = fastest101;
885  else
886  fastest102 = fastest12;
887 
888  TRGState fastest(5);
889  if (! wt[fastest102].active(5))
890  fastest = wt[fastest102].subset(0, 5);
891 
892  s.set(p, fastest);
893  p += 5;
894  }
895 
897  //s.set(p, 5, timing[0]);
898  //p += 5;
899  //s.set(p, 5, timing[16]);
900  //p += 5;
901  //s.set(p, 5, timing[32]);
902  //p += 5;
903  //s.set(p, 5, timing[33]);
904  //p += 5;
905  //s.set(p, 5, timing[15]);
906  //p += 5;
907  //s.set(p, 5, timing[30]);
908  //p += 5;
909  //s.set(p, 5, timing[31]);
910  //p += 5;
911  //s.set(p, 5, timing[46]);
912  //p += 5;
913  //s.set(p, 5, timing[47]);
914 
915 #ifdef TRG_DEBUG
916 // unpackerInnerOutside(input, s);
917 #endif
918 
919  delete[] b;
920  return s;
921  }
922 
923  TRGState
924  TCFrontEnd::packerOuterInside(const TRGState& input)
925  {
926 
927  //...Input should be 48 hit pattern and 48x5 timing, total 288 bits...
928  //
929  // Wire numbers and TS ID
930  //
931  // outside
932  //
933  // +--+--+--+--+- -+--+--+--+--+--+--+
934  // | 47 | 46 | .... | 34 | 33 | 32 | <- priority wire layer
935  // +--+--+--+--+--+- -+--+--+--+--+--+--+
936  // | 31 | 30 | ..... | 18 | 17 | 16 |
937  // +--+--+--+--+--+- -+--+--+--+--+--+--+
938  // | 15 | 14 | .... | 2 | 1 | 0 |
939  // +--+--+--+--+- -+--+--+--+--+--+--+
940  //
941  // 15 14 .... 2 1 0 <- partial TS ID
942  //
943  // inside
944  //
945  //
946 
947  //...Prepare a state for output...
948  //TRGState s(48 + 16 * 5 + 16 * 5 + 3 * 5); // 3*5 for missing wires
949  TRGState s(48 + 16 * 5 + 16 * 5 + 2 * 5 + 38); // 2*5 for edge fastest time, 38 dummy bits to fill to 256 bits
950 
951  //...Set up bool array...
952  bool* b = new bool[input.size()];
953  input.copy2bool(b);
954 
955  //...Naming...
956  const bool* const hitptn = & b[0]; // 16x3 = 48 bits
957  const bool* const timing[48] = {
958  & b[48], & b[53], & b[58], & b[63],
959  & b[68], & b[73], & b[78], & b[83],
960  & b[88], & b[93], & b[98], & b[103],
961  & b[108], & b[113], & b[118], & b[123],
962  & b[128], & b[133], & b[138], & b[143],
963  & b[148], & b[153], & b[158], & b[163],
964  & b[168], & b[173], & b[178], & b[183],
965  & b[188], & b[193], & b[198], & b[203],
966  & b[208], & b[213], & b[218], & b[223],
967  & b[228], & b[233], & b[238], & b[243],
968  & b[248], & b[253], & b[258], & b[263],
969  & b[268], & b[273], & b[278], & b[283]
970  };
971 
972  //...Store hit pattern...
973  s.set(0, 48, hitptn);
974  unsigned p = 48;
975 
976  //...Priority cell timing...
977  for (unsigned i = 0; i < 16; i++) {
978  s.set(p, 5, timing[32 + i]);
979  p += 5;
980  }
981 
982  //...Fastest timing...
983  const bool dummy[6] = {false, false, false, false, false, true};
984  const TRGState wtDummy(6, dummy);
985  for (unsigned i = 0; i < 18; i++) { // 0 ... 15 for 16 standard ones, 16,17 for two edge areas.
986  TRGState wt[6];
987 
988  if (i == 0) { // TS ID 0 has missing wires
989  wt[0] = wtDummy;
990  wt[1] = TRGState(5, timing[0]);
991  wt[2] = TRGState(5, timing[1]);
992  wt[3] = wtDummy;
993  wt[4] = TRGState(5, timing[16]);
994  wt[5] = TRGState(5, timing[32]);
995 
996  //...Append 6th bit to indicate hit or not (no hit = 1)...
997  if (! hitptn[0]) wt[1].set(5, true);
998  if (! hitptn[1]) wt[2].set(5, true);
999  if (! hitptn[16]) wt[4].set(5, true);
1000  if (! hitptn[32]) wt[5].set(5, true);
1001  } else if (i == 15) { // TS ID 15 has missing wires
1002  wt[0] = TRGState(5, timing[14]);
1003  wt[1] = TRGState(5, timing[15]);
1004  wt[2] = wtDummy;
1005  wt[3] = TRGState(5, timing[30]);
1006  wt[4] = TRGState(5, timing[31]);
1007  wt[5] = TRGState(5, timing[47]);
1008 
1009  //...Append 6th bit to indicate hit or not (no hit = 1)...
1010  if (! hitptn[14]) wt[0].set(5, true);
1011  if (! hitptn[15]) wt[1].set(5, true);
1012  if (! hitptn[30]) wt[3].set(5, true);
1013  if (! hitptn[31]) wt[4].set(5, true);
1014  if (! hitptn[47]) wt[5].set(5, true);
1015  } else if (i == 16) { // edge area 1 only for cell 0
1016  wt[0] = wtDummy;
1017  wt[1] = wtDummy;
1018  //wt[2] = TRGState(5, timing[16]);
1019  wt[2] = TRGState(5, timing[0]);
1020  wt[3] = wtDummy;
1021  wt[4] = wtDummy;
1022  wt[5] = wtDummy;
1023  //...Append 6th bit to indicate hit or not (no hit = 1)...
1024  if (! hitptn[0]) wt[2].set(5, true);
1025  } else if (i == 17) { // edge area 2 for cell 15 and 31 only
1026  wt[0] = TRGState(5, timing[15]);
1027  wt[1] = wtDummy;
1028  wt[2] = wtDummy;
1029  wt[3] = TRGState(5, timing[31]);
1030  wt[4] = wtDummy;
1031  wt[5] = wtDummy;
1032 
1033  //...Append 6th bit to indicate hit or not (no hit = 1)...
1034  if (! hitptn[15]) wt[0].set(5, true);
1035  if (! hitptn[31]) wt[3].set(5, true);
1036  } else {
1037  wt[0] = TRGState(5, timing[i - 1]);
1038  wt[1] = TRGState(5, timing[i]);
1039  wt[2] = TRGState(5, timing[i + 1]);
1040  wt[3] = TRGState(5, timing[i + 15]);
1041  wt[4] = TRGState(5, timing[i + 16]);
1042  wt[5] = TRGState(5, timing[i + 32]);
1043 
1044  //...Append 6th bit to indicate hit or not (no hit = 1)...
1045  if (! hitptn[i - 1]) wt[0].set(5, true);
1046  if (! hitptn[i]) wt[1].set(5, true);
1047  if (! hitptn[i + 1]) wt[2].set(5, true);
1048  if (! hitptn[i + 15]) wt[3].set(5, true);
1049  if (! hitptn[i + 16]) wt[4].set(5, true);
1050  if (! hitptn[i + 32]) wt[5].set(5, true);
1051  }
1052 
1053  //...Look for the fastest hit...
1054  unsigned fastest0 = 0;
1055  unsigned fastest1 = 0;
1056  unsigned fastest2 = 0;
1057  if (wt[0] < wt[1])
1058  fastest0 = 0;
1059  else
1060  fastest0 = 1;
1061  if (wt[2] < wt[3])
1062  fastest1 = 2;
1063  else
1064  fastest1 = 3;
1065  if (wt[4] < wt[5])
1066  fastest2 = 4;
1067  else
1068  fastest2 = 5;
1069 
1070  unsigned fastest3 = 0;
1071  if (wt[fastest0] < wt[fastest1])
1072  fastest3 = fastest0;
1073  else
1074  fastest3 = fastest1;
1075 
1076  unsigned fastest4 = 0;
1077  if (wt[fastest2] < wt[fastest3])
1078  fastest4 = fastest2;
1079  else
1080  fastest4 = fastest3;
1081 
1082  TRGState fastest(5);
1083  if (! wt[fastest4].active(5))
1084  fastest = wt[fastest4].subset(0, 5);
1085 
1086  s.set(p, fastest);
1087  p += 5;
1088  }
1089 
1090  //s.set(p, 5, timing[0]);
1091  //p += 5;
1092  //s.set(p, 5, timing[15]);
1093  //p += 5;
1094  //s.set(p, 5, timing[31]);
1095 
1096 #ifdef TRG_DEBUG
1097 // unpackerOuterInside(input, s);
1098 #endif
1099 
1100  delete[] b;
1101  return s;
1102  }
1103 
1104  TRGState
1105  TCFrontEnd::packerOuterOutside(const TRGState& input)
1106  {
1107 
1108  //...Input should be 48 hit pattern and 48x5 timing, total 288 bits...
1109  //
1110  // Wire numbers and TS ID
1111  //
1112  // outside
1113  //
1114  // +--+--+--+--+- -+--+--+--+--+--+--+
1115  // | 47 | 46 | .... | 34 | 33 | 32 |
1116  // +--+--+--+--+--+- -+--+--+--+--+--+--+
1117  // | 31 | 30 | ..... | 18 | 17 | 16 |
1118  // +--+--+--+--+--+- -+--+--+--+--+--+--+
1119  // | 15 | 14 | .... | 2 | 1 | 0 | <- second priority wire layer
1120  // +--+--+--+--+- -+--+--+--+--+--+--+
1121  //
1122  // 15 14 .... 2 1 0 <- partial TS ID
1123  //
1124  // inside
1125  //
1126  //
1127 
1128  //...Prepare a state for output...
1129  //TRGState s(48 + 16 * 5 + 16 * 5 + 3 * 5); // 3*5 for missing wires
1130  TRGState s(48 + 16 * 5 + 16 * 5 + 2 * 5 + 38); // 2*5 for edge fastest time, 38 dummy bits to fill to 256 bits
1131 
1132 
1133  //...Set up bool array...
1134  bool* b = new bool[input.size()];
1135  input.copy2bool(b);
1136 
1137  //...Naming...
1138  const bool* const hitptn = & b[0]; // 16x3 = 48 bits
1139  const bool* const timing[48] = {
1140  & b[48], & b[53], & b[58], & b[63],
1141  & b[68], & b[73], & b[78], & b[83],
1142  & b[88], & b[93], & b[98], & b[103],
1143  & b[108], & b[113], & b[118], & b[123],
1144  & b[128], & b[133], & b[138], & b[143],
1145  & b[148], & b[153], & b[158], & b[163],
1146  & b[168], & b[173], & b[178], & b[183],
1147  & b[188], & b[193], & b[198], & b[203],
1148  & b[208], & b[213], & b[218], & b[223],
1149  & b[228], & b[233], & b[238], & b[243],
1150  & b[248], & b[253], & b[258], & b[263],
1151  & b[268], & b[273], & b[278], & b[283]
1152  };
1153 
1154  //...Store hit pattern...
1155  s.set(0, 48, hitptn);
1156  unsigned p = 48;
1157 
1158 
1159  //...Second priority cell timing...
1160  for (unsigned i = 0; i < 16; i++) {
1161  s.set(p, 5, timing[i]);
1162  p += 5;
1163  }
1164 
1165  //...Fastest timing...
1166  const bool dummy[6] = {false, false, false, false, false, true};
1167  const TRGState wtDummy(6, dummy);
1168  for (unsigned i = 0; i < 18; i++) { // 0 ... 15 for 16 standard ones, 16,17 for two edge areas.
1169  TRGState wt[5];
1170 
1171  if (i == 0) { // TS ID 0 has missing wires
1172  wt[0] = wtDummy;
1173  wt[1] = TRGState(5, timing[0]);
1174  wt[2] = wtDummy;
1175  wt[3] = TRGState(5, timing[16]);
1176  wt[4] = TRGState(5, timing[17]);
1177 
1178  //...Append 6th bit to indicate hit or not (no hit = 1)...
1179  if (! hitptn[0]) wt[1].set(5, true);
1180  if (! hitptn[16]) wt[3].set(5, true);
1181  if (! hitptn[17]) wt[4].set(5, true);
1182  } else if (i == 15) { // TS ID 15 has missing wires
1183  wt[0] = TRGState(5, timing[14]);
1184  wt[1] = TRGState(5, timing[15]);
1185  wt[2] = TRGState(5, timing[30]);
1186  wt[3] = TRGState(5, timing[31]);
1187  wt[4] = wtDummy;
1188 
1189  //...Append 6th bit to indicate hit or not (no hit = 1)...
1190  if (! hitptn[14]) wt[0].set(5, true);
1191  if (! hitptn[15]) wt[1].set(5, true);
1192  if (! hitptn[30]) wt[2].set(5, true);
1193  if (! hitptn[31]) wt[3].set(5, true);
1194  } else if (i == 16) { // edge area 1 only for cell 16
1195  wt[0] = wtDummy;
1196  wt[1] = wtDummy;
1197  wt[2] = wtDummy;
1198  wt[3] = wtDummy;
1199  wt[4] = TRGState(5, timing[16]);
1200  //...Append 6th bit to indicate hit or not (no hit = 1)...
1201  if (! hitptn[16]) wt[4].set(5, true);
1202  } else if (i == 17) { // edge area 2 for cell 15 and 31 only
1203  wt[0] = TRGState(5, timing[15]);
1204  wt[1] = wtDummy;
1205  wt[2] = TRGState(5, timing[31]);
1206  wt[3] = wtDummy;
1207  wt[4] = wtDummy;
1208 
1209  //...Append 6th bit to indicate hit or not (no hit = 1)...
1210  if (! hitptn[15]) wt[0].set(5, true);
1211  if (! hitptn[31]) wt[2].set(5, true);
1212  } else {
1213  wt[0] = TRGState(5, timing[i - 1]);
1214  wt[1] = TRGState(5, timing[i]);
1215  wt[2] = TRGState(5, timing[i + 15]);
1216  wt[3] = TRGState(5, timing[i + 16]);
1217  wt[4] = TRGState(5, timing[i + 17]);
1218 
1219  //...Append 6th bit to indicate hit or not (no hit = 1)...
1220  if (! hitptn[i - 1]) wt[0].set(5, true);
1221  if (! hitptn[i]) wt[1].set(5, true);
1222  if (! hitptn[i + 15]) wt[2].set(5, true);
1223  if (! hitptn[i + 16]) wt[3].set(5, true);
1224  if (! hitptn[i + 17]) wt[4].set(5, true);
1225  }
1226 
1227  //...Look for the fastest hit...
1228  unsigned fastest0 = 0;
1229  unsigned fastest1 = 0;
1230  if (wt[0] < wt[1])
1231  fastest0 = 0;
1232  else
1233  fastest0 = 1;
1234  if (wt[2] < wt[3])
1235  fastest1 = 2;
1236  else
1237  fastest1 = 3;
1238 
1239  unsigned fastest2 = 0;
1240  if (wt[fastest0] < wt[fastest1])
1241  fastest2 = fastest0;
1242  else
1243  fastest2 = fastest1;
1244 
1245  unsigned fastest3 = 0;
1246  if (wt[fastest2] < wt[4])
1247  fastest3 = fastest2;
1248  else
1249  fastest3 = 4;
1250 
1251  TRGState fastest(5);
1252  if (! wt[fastest3].active(5))
1253  fastest = wt[fastest3].subset(0, 5);
1254 
1255  s.set(p, fastest);
1256  p += 5;
1257  }
1258 
1259  //s.set(p, 5, timing[16]);
1260  //p += 5;
1261  //s.set(p, 5, timing[15]);
1262  //p += 5;
1263  //s.set(p, 5, timing[31]);
1264 
1265 #ifdef TRG_DEBUG
1266 // unpackerOuterOutside(input, s);
1267 #endif
1268 
1269  delete[] b;
1270  return s;
1271  }
1272 
1273  void
1274  TCFrontEnd::unpackerInnerInside(const TRGState& input,
1275  const TRGState& output)
1276  {
1277 
1278  cout << "Input bit size=" << input.size() << endl;
1279 
1280  cout << "Input : wire hit pattern" << endl;
1281  cout << " ";
1282  for (unsigned i = 0; i < 48; i++) {
1283  const unsigned j = 48 - i - 1;
1284  if (i && ((i % 8) == 0))
1285  cout << "_";
1286  if (input[j])
1287  cout << "1";
1288  else
1289  cout << "0";
1290  }
1291  cout << endl;
1292  cout << "Input : wire hit timing" << endl;
1293  unsigned o = 48;
1294  for (unsigned i = 0; i < 48; i++) {
1295  TRGState s = input.subset(o + i * 5, 5);
1296  if ((i % 4) == 0)
1297  cout << " ";
1298  cout << i << ": " << s << " ";
1299  if ((i % 4) == 3)
1300  cout << endl;
1301  }
1302 
1303  cout << "Output bit size=" << output.size() << endl;
1304 
1305  cout << "Output : wire hit pattern" << endl;
1306  cout << " ";
1307  for (unsigned i = 0; i < 32; i++) {
1308  const unsigned j = 32 - i - 1;
1309  if (i && ((i % 8) == 0))
1310  cout << "_";
1311  if (output[j])
1312  cout << "1";
1313  else
1314  cout << "0";
1315  }
1316  cout << endl;
1317 
1318  cout << "Output : priority cell timing" << endl;
1319  o = 32;
1320  for (unsigned i = 0; i < 16; i++) {
1321  TRGState s = output.subset(o + i * 5, 5);
1322  if ((i % 4) == 0)
1323  cout << " ";
1324  cout << i << ": " << s << " ";
1325  if ((i % 4) == 3)
1326  cout << endl;
1327  }
1328 
1329  cout << "Output : second priority cell position" << endl;
1330  cout << " ";
1331  o = 112;
1332  for (unsigned i = 0; i < 16; i++) {
1333  TRGState s = output.subset(o + i, 1);
1334  if (i && ((i % 8) == 0))
1335  cout << "_";
1336  if (s.active())
1337  cout << "1";
1338  else
1339  cout << "0";
1340  }
1341  cout << endl;
1342 
1343  cout << "Output : fastest timing" << endl;
1344  o = 128;
1345  for (unsigned i = 0; i < 16; i++) {
1346  TRGState s = output.subset(o + i * 5, 5);
1347  if ((i % 4) == 0)
1348  cout << " ";
1349  cout << i << ": " << s << " ";
1350  if ((i % 4) == 3)
1351  cout << endl;
1352  }
1353 
1354  cout << "Output : timing of missing wires" << endl;
1355  o = 208;
1356  for (unsigned i = 0; i < 1; i++) {
1357  TRGState s = output.subset(o + i * 5, 5);
1358  if ((i % 4) == 0)
1359  cout << " ";
1360  cout << i << ": " << s << " ";
1361  if ((i % 4) == 3)
1362  cout << endl;
1363  }
1364 
1365  cout << endl;
1366  }
1367 
1368  void
1369  TCFrontEnd::unpackerInnerOutside(const TRGState& input,
1370  const TRGState& output)
1371  {
1372 
1373  cout << "Input bit size=" << input.size() << endl;
1374 
1375  cout << "Input : wire hit pattern" << endl;
1376  cout << " ";
1377  for (unsigned i = 0; i < 48; i++) {
1378  const unsigned j = 48 - i - 1;
1379  if (i && ((i % 8) == 0))
1380  cout << "_";
1381  if (input[j])
1382  cout << "1";
1383  else
1384  cout << "0";
1385  }
1386  cout << endl;
1387  cout << "Input : wire hit timing" << endl;
1388  unsigned o = 48;
1389  for (unsigned i = 0; i < 48; i++) {
1390  TRGState s = input.subset(o + i * 5, 5);
1391  if ((i % 4) == 0)
1392  cout << " ";
1393  cout << i << ": " << s << " ";
1394  if ((i % 4) == 3)
1395  cout << endl;
1396  }
1397 
1398  cout << "Output bit size=" << output.size() << endl;
1399 
1400  cout << "Output : wire hit pattern" << endl;
1401  cout << " ";
1402  for (unsigned i = 0; i < 48; i++) {
1403  const unsigned j = 48 - i - 1;
1404  if (i && ((i % 8) == 0))
1405  cout << "_";
1406  if (output[j])
1407  cout << "1";
1408  else
1409  cout << "0";
1410  }
1411  cout << endl;
1412 
1413  cout << "Output : fastest timing" << endl;
1414  o = 48;
1415  for (unsigned i = 0; i < 16; i++) {
1416  TRGState s = output.subset(o + i * 5, 5);
1417  if ((i % 4) == 0)
1418  cout << " ";
1419  cout << i << ": " << s << " ";
1420  if ((i % 4) == 3)
1421  cout << endl;
1422  }
1423 
1424  cout << "Output : timing of missing wires" << endl;
1425  o = 128;
1426  for (unsigned i = 0; i < 4; i++) {
1427  TRGState s = output.subset(o + i * 5, 5);
1428  if ((i % 4) == 0)
1429  cout << " ";
1430  cout << i << ": " << s << " ";
1431  if ((i % 4) == 3)
1432  cout << endl;
1433  }
1434 
1435  cout << endl;
1436  }
1437 
1438  void
1439  TCFrontEnd::unpackerOuterInside(const TRGState& input,
1440  const TRGState& output)
1441  {
1442 
1443  cout << "Input bit size=" << input.size() << endl;
1444 
1445  cout << "Input : wire hit pattern" << endl;
1446  cout << " ";
1447  for (unsigned i = 0; i < 48; i++) {
1448  const unsigned j = 48 - i - 1;
1449  if (i && ((i % 8) == 0))
1450  cout << "_";
1451  if (input[j])
1452  cout << "1";
1453  else
1454  cout << "0";
1455  }
1456  cout << endl;
1457  cout << "Input : wire hit timing" << endl;
1458  unsigned o = 48;
1459  for (unsigned i = 0; i < 48; i++) {
1460  TRGState s = input.subset(o + i * 5, 5);
1461  if ((i % 4) == 0)
1462  cout << " ";
1463  cout << i << ": " << s << " ";
1464  if ((i % 4) == 3)
1465  cout << endl;
1466  }
1467 
1468  cout << "Output bit size=" << output.size() << endl;
1469 
1470  cout << "Output : wire hit pattern" << endl;
1471  cout << " ";
1472  for (unsigned i = 0; i < 48; i++) {
1473  const unsigned j = 48 - i - 1;
1474  if (i && ((i % 8) == 0))
1475  cout << "_";
1476  if (output[j])
1477  cout << "1";
1478  else
1479  cout << "0";
1480  }
1481  cout << endl;
1482 
1483  cout << "Output : priority cell timing" << endl;
1484  o = 48;
1485  for (unsigned i = 0; i < 16; i++) {
1486  TRGState s = output.subset(o + i * 5, 5);
1487  if ((i % 4) == 0)
1488  cout << " ";
1489  cout << i << ": " << s << " ";
1490  if ((i % 4) == 3)
1491  cout << endl;
1492  }
1493 
1494  cout << "Output : fastest timing" << endl;
1495  o = 128;
1496  for (unsigned i = 0; i < 16; i++) {
1497  TRGState s = output.subset(o + i * 5, 5);
1498  if ((i % 4) == 0)
1499  cout << " ";
1500  cout << i << ": " << s << " ";
1501  if ((i % 4) == 3)
1502  cout << endl;
1503  }
1504 
1505  cout << "Output : timing of missing wires" << endl;
1506  o = 208;
1507  for (unsigned i = 0; i < 2; i++) {
1508  TRGState s = output.subset(o + i * 5, 5);
1509  if ((i % 4) == 0)
1510  cout << " ";
1511  cout << i << ": " << s << " ";
1512  if ((i % 4) == 3)
1513  cout << endl;
1514  }
1515 
1516  cout << endl;
1517  }
1518 
1519  void
1520  TCFrontEnd::unpackerOuterOutside(const TRGState& input,
1521  const TRGState& output)
1522  {
1523 
1524  cout << "Input bit size=" << input.size() << endl;
1525 
1526  cout << "Input : wire hit pattern" << endl;
1527  cout << " ";
1528  for (unsigned i = 0; i < 48; i++) {
1529  const unsigned j = 48 - i - 1;
1530  if (i && ((i % 8) == 0))
1531  cout << "_";
1532  if (input[j])
1533  cout << "1";
1534  else
1535  cout << "0";
1536  }
1537  cout << endl;
1538  cout << "Input : wire hit timing" << endl;
1539  unsigned o = 48;
1540  for (unsigned i = 0; i < 48; i++) {
1541  TRGState s = input.subset(o + i * 5, 5);
1542  if ((i % 4) == 0)
1543  cout << " ";
1544  cout << i << ": " << s << " ";
1545  if ((i % 4) == 3)
1546  cout << endl;
1547  }
1548 
1549  cout << "Output bit size=" << output.size() << endl;
1550 
1551  cout << "Output : wire hit pattern" << endl;
1552  cout << " ";
1553  for (unsigned i = 0; i < 48; i++) {
1554  const unsigned j = 48 - i - 1;
1555  if (i && ((i % 8) == 0))
1556  cout << "_";
1557  if (output[j])
1558  cout << "1";
1559  else
1560  cout << "0";
1561  }
1562  cout << endl;
1563 
1564  cout << "Output : Second priority cell timing" << endl;
1565  o = 48;
1566  for (unsigned i = 0; i < 16; i++) {
1567  TRGState s = output.subset(o + i * 5, 5);
1568  if ((i % 4) == 0)
1569  cout << " ";
1570  cout << i << ": " << s << " ";
1571  if ((i % 4) == 3)
1572  cout << endl;
1573  }
1574 
1575  cout << "Output : fastest timing" << endl;
1576  o = 128;
1577  for (unsigned i = 0; i < 16; i++) {
1578  TRGState s = output.subset(o + i * 5, 5);
1579  if ((i % 4) == 0)
1580  cout << " ";
1581  cout << i << ": " << s << " ";
1582  if ((i % 4) == 3)
1583  cout << endl;
1584  }
1585 
1586  cout << "Output : timing of missing wires" << endl;
1587  o = 208;
1588  for (unsigned i = 0; i < 2; i++) {
1589  TRGState s = output.subset(o + i * 5, 5);
1590  if ((i % 4) == 0)
1591  cout << " ";
1592  cout << i << ": " << s << " ";
1593  if ((i % 4) == 3)
1594  cout << endl;
1595  }
1596  cout << endl;
1597  }
1598 
1599 
1600  void //Dump all the details of _mosb into a .log file, do it in the end of simulate()
1602  {
1603 
1604  if (type() == innerInside) dump_log_innerInside();
1605  else if (type() == innerOutside) dump_log_innerOutside();
1606  else if (type() == outerInside) dump_log_outerInside();
1607  else if (type() == outerOutside) dump_log_outerOutside();
1608 
1609  }
1610 
1611  void
1613  {
1614 
1615  const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1616  ofstream output((name() + ".log").c_str());
1617 
1618  output << "InnerInside FrontEnd output dump" << endl << endl;
1619 
1620  const std::vector<int> changetime = _osb->stateChanges();
1621  std::vector<vector<int>> boolvector(changetime.size());
1622  for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1623 
1624  for (unsigned b = 0; b < (* _osb)[0]->size(); b++) {
1625  boolvector[ch_t].push_back(((* _osb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1626  }
1627 
1628  output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1629 
1630  output << "Hitmap: " << endl ;
1631  for (unsigned b = 0; b < 32; b++) {
1632  output << boolvector[ch_t][31 - b] << " " ;
1633  if (b == 15) output << endl << " ";
1634  }
1635  output << endl;
1636 
1637  for (unsigned b = 0; b < 16; b++) {
1638  output << "PT#" << b << ": " << boolvector[ch_t][ 32 + 5 * b + 4 ] << boolvector[ch_t][ 32 + 5 * b + 3 ] << boolvector[ch_t][ 32 + 5
1639  * b + 2 ]
1640  << boolvector[ch_t][ 32 + 5 * b + 1 ] << boolvector[ch_t][ 32 + 5 * b] << endl;
1641  }
1642  output << endl;
1643 
1644  output << "Secondary: ";
1645  for (int b = 0; b < 16; b++) {
1646  output << boolvector[ch_t][ 127 - b ] ;
1647  }
1648  output << endl;
1649 
1650  for (unsigned b = 0; b < 16; b++) {
1651  output << "FT#" << b << ": " << boolvector[ch_t][ 128 + 5 * b + 4 ] << boolvector[ch_t][ 128 + 5 * b + 3 ] << boolvector[ch_t][ 128
1652  + 5 * b + 2 ]
1653  << boolvector[ch_t][ 128 + 5 * b + 1 ] << boolvector[ch_t][ 128 + 5 * b] << endl;
1654  }
1655 
1656  output << endl;
1657  output << "ET#0(cell 31): " << endl << boolvector[ch_t][212] << boolvector[ch_t][211] << boolvector[ch_t][210]
1658  << boolvector[ch_t][209] << boolvector[ch_t][208] << endl;
1659 
1660  output << endl;
1661  }
1662 
1663  output.close();
1664 
1665  }
1666 
1667 
1668  void
1670  {
1671 
1672  const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1673  ofstream output((name() + ".log").c_str());
1674 
1675  output << "InnerOutside FrontEnd output dump" << endl << endl;
1676 
1677  const std::vector<int> changetime = _osb->stateChanges();
1678  std::vector<vector<int>> boolvector(changetime.size());
1679  for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1680 
1681  for (unsigned b = 0; b < (* _osb)[0]->size(); b++) {
1682  boolvector[ch_t].push_back(((* _osb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1683  }
1684 
1685  output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1686 
1687  output << "Hitmap: " << endl << " ";
1688  for (unsigned b = 0; b < 48; b++) {
1689  output << boolvector[ch_t][47 - b] << " ";
1690  if (b == 15) output << endl ;
1691  else if (b == 31) output << endl << " ";
1692  }
1693  output << endl;
1694 
1695  for (unsigned b = 0; b < 16; b++) {
1696  output << "FT#" << b << ": " << boolvector[ch_t][ 48 + 5 * b + 4 ] << boolvector[ch_t][ 48 + 5 * b + 3 ] << boolvector[ch_t][ 48 + 5
1697  * b + 2 ]
1698  << boolvector[ch_t][ 48 + 5 * b + 1 ] << boolvector[ch_t][ 48 + 5 * b] << endl;
1699  }
1700 
1701  output << endl;
1702  output << "ET#0(cell 32): " << endl << boolvector[ch_t][132] << boolvector[ch_t][131] << boolvector[ch_t][130]
1703  << boolvector[ch_t][129] << boolvector[ch_t][128] << endl;
1704  output << "ET#1(cell 0, 16, 32, 33): " << endl << boolvector[ch_t][137] << boolvector[ch_t][136] << boolvector[ch_t][135]
1705  << boolvector[ch_t][134] << boolvector[ch_t][133] << endl;
1706  output << "ET#0(cell 15, 30, 31, 46, 47): " << endl << boolvector[ch_t][142] << boolvector[ch_t][141] << boolvector[ch_t][140]
1707  << boolvector[ch_t][139] << boolvector[ch_t][138] << endl;
1708  output << "ET#3(cell 31, 47): " << endl << boolvector[ch_t][147] << boolvector[ch_t][146] << boolvector[ch_t][145]
1709  << boolvector[ch_t][144] << boolvector[ch_t][143] << endl;
1710 
1711  output << endl;
1712  }
1713 
1714  output.close();
1715  }
1716 
1717 
1718  void
1720  {
1721 
1722  const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1723  ofstream output((name() + ".log").c_str());
1724 
1725  output << "OuterInside FrontEnd output dump" << endl << endl;
1726 
1727  const std::vector<int> changetime = _osb->stateChanges();
1728  std::vector<vector<int>> boolvector(changetime.size());
1729  for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1730 
1731  for (unsigned b = 0; b < (* _osb)[0]->size(); b++) {
1732  boolvector[ch_t].push_back(((* _osb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1733  }
1734 
1735  output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1736 
1737  output << "Hitmap: " << endl << " ";
1738  for (unsigned b = 0; b < 48; b++) {
1739  output << boolvector[ch_t][47 - b] << " " ;
1740  if (b == 15) output << endl;
1741  else if (b == 31) output << endl << " ";
1742  }
1743  output << endl;
1744 
1745  for (unsigned b = 0; b < 16; b++) {
1746  output << "PT#" << b << ": " << boolvector[ch_t][ 48 + 5 * b + 4 ] << boolvector[ch_t][ 48 + 5 * b + 3 ] << boolvector[ch_t][ 48 + 5
1747  * b + 2 ]
1748  << boolvector[ch_t][ 48 + 5 * b + 1 ] << boolvector[ch_t][ 48 + 5 * b] << endl;
1749  }
1750  output << endl;
1751 
1752  for (unsigned b = 0; b < 16; b++) {
1753  output << "FT#" << b << ": " << boolvector[ch_t][ 128 + 5 * b + 4 ] << boolvector[ch_t][ 128 + 5 * b + 3 ] << boolvector[ch_t][ 128
1754  + 5 * b + 2 ]
1755  << boolvector[ch_t][ 128 + 5 * b + 1 ] << boolvector[ch_t][ 128 + 5 * b] << endl;
1756  }
1757 
1758  output << endl;
1759  output << "ET#0(cell 0): " << endl << boolvector[ch_t][212] << boolvector[ch_t][211] << boolvector[ch_t][210]
1760  << boolvector[ch_t][209] << boolvector[ch_t][208] << endl;
1761  output << "ET#1(cell 15, 31): " << endl << boolvector[ch_t][217] << boolvector[ch_t][216] << boolvector[ch_t][215]
1762  << boolvector[ch_t][214] << boolvector[ch_t][213] << endl;
1763 
1764  output << endl;
1765  }
1766 
1767  output.close();
1768 
1769  }
1770 
1771  void
1773  {
1774 
1775  const TRGClock& dClock = TRGCDC::getTRGCDC()->dataClock();
1776  ofstream output((name() + ".log").c_str());
1777 
1778  output << "OuterOutside FrontEnd output dump" << endl << endl;
1779  const std::vector<int> changetime = _osb->stateChanges();
1780  std::vector<vector<int>> boolvector(changetime.size());
1781  for (unsigned ch_t = 0; ch_t < changetime.size(); ch_t++) {
1782 
1783  for (unsigned b = 0; b < (* _osb)[0]->size(); b++) {
1784  boolvector[ch_t].push_back(((* _osb)[0]->state(changetime[ch_t])[b]) ? 1 : 0);
1785  }
1786 
1787  output << "# of clk: " << changetime[ch_t] << " (" << dClock.absoluteTime(changetime[ch_t]) << " ns), signal vector: " << endl;
1788 
1789  output << "Hitmap: " << endl;
1790  for (unsigned b = 0; b < 48; b++) {
1791  output << boolvector[ch_t][47 - b] << " ";
1792  if (b == 15) output << endl << " ";
1793  else if (b == 31) output << endl ;
1794  }
1795  output << endl;
1796 
1797  for (unsigned b = 0; b < 16; b++) {
1798  output << "PT#" << b << ": " << boolvector[ch_t][ 48 + 5 * b + 4 ] << boolvector[ch_t][ 48 + 5 * b + 3 ] << boolvector[ch_t][ 48 + 5
1799  * b + 2 ]
1800  << boolvector[ch_t][ 48 + 5 * b + 1 ] << boolvector[ch_t][ 48 + 5 * b] << endl;
1801  }
1802  output << endl;
1803 
1804  for (unsigned b = 0; b < 16; b++) {
1805  output << "FT#" << b << ": " << boolvector[ch_t][ 128 + 5 * b + 4 ] << boolvector[ch_t][ 128 + 5 * b + 3 ] << boolvector[ch_t][ 128
1806  + 5 * b + 2 ]
1807  << boolvector[ch_t][ 128 + 5 * b + 1 ] << boolvector[ch_t][ 128 + 5 * b] << endl;
1808  }
1809 
1810  output << endl;
1811  output << "ET#0(cell 16): " << endl << boolvector[ch_t][212] << boolvector[ch_t][211] << boolvector[ch_t][210]
1812  << boolvector[ch_t][209] << boolvector[ch_t][208] << endl;
1813  output << "ET#1(cell 15, 31): " << endl << boolvector[ch_t][217] << boolvector[ch_t][216] << boolvector[ch_t][215]
1814  << boolvector[ch_t][214] << boolvector[ch_t][213] << endl;
1815 
1816 
1817  output << endl;
1818  }
1819 
1820 
1821  output.close();
1822  }
1823 
1824 
1825 
1827 } // namespace Belle2
Belle2::TRGSignal
A class to represent a digitized signal. Unit is nano second.
Definition: Signal.h:28
Belle2::TRGSignalBundle::stateChanges
std::vector< int > stateChanges(void) const
returns a list of clock position of state change.
Definition: SignalBundle.cc:216
Belle2::TRGBoard
A class to represent a trigger board.
Definition: Board.h:30
Belle2::TRGDebug::level
static int level(void)
returns the debug level.
Definition: Debug.cc:72
Belle2::TRGBoard::clockData
const TRGClock & clockData(void) const
returns data clock.
Definition: Board.h:128
Belle2::TRGCDCFrontEnd::dump_log_innerOutside
void dump_log_innerOutside(void) const
Dump all the details of _mosb into a .log file, for innerOutside FE.
Definition: FrontEnd.cc:1669
Belle2::TRGCDCFrontEnd::implementationPort
static int implementationPort(const boardType &type, std::ofstream &)
writes a port map.
Definition: FrontEnd.cc:103
Belle2::TRGCDCFrontEnd::_isb
TRGSignalBundle * _isb
Input signal bundle.
Definition: FrontEnd.h:149
Belle2::TRGCDCFrontEnd::dump_log_outerOutside
void dump_log_outerOutside(void) const
Dump all the details of _mosb into a .log file, for outerOutside FE.
Definition: FrontEnd.cc:1772
Belle2::TRGCDCFrontEnd::simulate
void simulate(void)
simulates firmware.
Definition: FrontEnd.cc:153
Belle2::TRGState
A class to represent a state of multi bits.
Definition: State.h:29
Belle2::TRGCDCWire
A class to represent a wire in CDC.
Definition: Wire.h:57
Belle2::TRGCDCFrontEnd::_osb
TRGSignalBundle * _osb
Output signal bundle.
Definition: FrontEnd.h:152
Belle2::TRGCDC::dataClock
const TRGClock & dataClock(void) const
returns the data clock.
Definition: TRGCDC.h:983
Belle2::TRGSignalBundle
A class to represent a bundle of SignalVectors.
Definition: SignalBundle.h:31
Belle2::TRGBoard::name
const std::string & name(void) const
returns name.
Definition: Board.h:114
Belle2::TRGCDCFrontEnd::dump_log
void dump_log(void) const
Dump all the details of _mosb into a .log file, do it in the end of simulate()
Definition: FrontEnd.cc:1601
Belle2::TRGCDCFrontEnd::_type
boardType _type
Board type.
Definition: FrontEnd.h:146
Belle2::TRGSignalVector::active
bool active(void) const
returns true if there is a signal.
Definition: SignalVector.cc:116
Belle2::TRGCDCFrontEnd::dump
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Definition: FrontEnd.cc:147
Belle2::TRGBoard::output
TRGChannel * output(unsigned i) const
returns output channel i.
Definition: Board.h:170
Belle2::TRGSignalVector::clock
const TRGClock & clock(void) const
returns clock.
Definition: SignalVector.h:130
Belle2::TRGCDCFrontEnd::version
static std::string version(void)
returns version.
Definition: FrontEnd.cc:54
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDC::getTRGCDC
static TRGCDC * getTRGCDC(void)
returns TRGCDC object.
Definition: TRGCDC.cc:190
Belle2::TRGState::toUnsigned
static unsigned toUnsigned(unsigned n, const bool *array)
Coverts from bool array to unsigned.
Definition: State.h:338
Belle2::TRGCDCFrontEnd::boardType
boardType
enum boardType
Definition: FrontEnd.h:42
Belle2::TRGClock::position
int position(double timing) const
returns clock position.
Definition: Clock.cc:119
Belle2::TRGCDCFrontEnd::type
boardType type(void) const
returns type.
Definition: FrontEnd.cc:60
Belle2::TRGSignal::set
const TRGSignal & set(double t0, double t1)
makes a pulse with leading edge at t0 and with trailing edge at t1.
Belle2::TRGUtilities::itostring
static std::string itostring(int i)
converts int to string. (Use boost::lexical_cast)
Belle2::TRGDebug::tab
static std::string tab(void)
returns tab spaces.
Definition: Debug.cc:52
Belle2::TRGCDCFrontEnd::dump_log_innerInside
void dump_log_innerInside(void) const
Dump all the details of _mosb into a .log file, for innerInside FE.
Definition: FrontEnd.cc:1612
Belle2::TRGCDCFrontEnd::push_back
void push_back(const TRGCDCWire *)
push back TRGCDCWire for this Front-end
Definition: FrontEnd.cc:141
Belle2::TRGClock::absoluteTime
double absoluteTime(int clockPosition) const
returns absolute time of clock position
Definition: Clock.cc:133
Belle2::TRGCDCFrontEnd::dump_log_outerInside
void dump_log_outerInside(void) const
Dump all the details of _mosb into a .log file, for outerInside FE.
Definition: FrontEnd.cc:1719
Belle2::TRGClock::phase
double phase(double timing) const
returns phase of given timing in degree (0 to 360).
Definition: Clock.cc:159
Belle2::TRGClock
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:43
Belle2::TRGSignalVector
A class to represent a bundle of digitized signals.
Definition: SignalVector.h:31
Belle2::TRGBoard::input
const TRGChannel * input(unsigned i) const
returns input channel i.
Definition: Board.h:163
Belle2::TRGCDCFrontEnd::implementation
static int implementation(const boardType &type, std::ofstream &)
make a VHDL component file.
Definition: FrontEnd.cc:66
Belle2::TRGCDCFrontEnd::~TRGCDCFrontEnd
virtual ~TRGCDCFrontEnd()
Destructor.
Definition: FrontEnd.cc:49