13#define TRG_SHORT_NAMES
14#define TRGCDC_SHORT_NAMES
17#define PROGRAM_NAME "TRGCDCTrackSegmentSimulator"
18#define PROGRAM_VERSION "version 0.00"
19#define ENV_PATH "BELLE2_LOCAL_DIR"
21#define CONFIG "TRGCDCConfig_0_20101111_1051_2013beamtest.dat"
26#include "trg/trg/Debug.h"
27#include "trg/trg/Utilities.h"
28#include "trg/trg/State.h"
29#include "trg/trg/Channel.h"
30#include "trg/cdc/TRGCDC.h"
31#include "trg/cdc/Wire.h"
32#include "trg/cdc/Segment.h"
33#include "trg/cdc/TrackSegmentFinder.h"
34#include "framework/gearbox/Gearbox.h"
37#include "trg/cdc/DisplayRphi.h"
38#include "trg/cdc/DisplayHough.h"
39namespace Belle2_TRGCDC {
40 Belle2::TRGCDCDisplayRphi* D = 0;
47using namespace Belle2_TRGCDC;
50void readFile(
const string& filename,
56main(
int argc,
char* argv[])
59 cout << PROGRAM_NAME <<
" ... " << PROGRAM_VERSION << endl;
64 cout << PROGRAM_NAME <<
" needs 3 arguments" << endl;
67 const unsigned dl = stoi(
string(argv[1]));
68 const unsigned sl = stoi(
string(argv[2]));
69 const string fn = string(argv[3]);
74 const string path = getenv(ENV_PATH);
75 const string patht = path +
"/data/trg/cdc/";
76 vector<std::string> backends;
77 backends.push_back(
"file:");
78 string filename =
"geometry/Belle2.xml";
80 gearbox.setBackends(backends);
81 gearbox.open(filename);
84 const string configFile = patht + CONFIG;
85 const unsigned simulationMode = 3;
86 const unsigned fastSimulationMode = 0;
87 const unsigned firmwareSimulationMode = 0;
88 const int firmwareSimulationStart = 0;
89 const int firmwareSimulationStop = 32 * 32 - 1;
90 const unsigned makeRootFile = 0;
91 const bool perfect2DFinder =
false;
92 const bool perfect3DFinder =
false;
93 const string innerTSLUTFile = patht +
"innerLUT_v2.2.coe";
94 const string outerTSLUTFile = patht +
"outerLUT_v2.2.coe";
95 const string rootTRGCDCFile =
"TRGCDC.root";
96 const string rootFitter3DFile =
"Fitter3D.root";
97 const unsigned houghFinderPeakMin = 5;
98 const string houghMappingFilePlus = patht +
"HoughMappingPlus20140807.dat";
99 const string houghMappingFileMinus = patht +
100 "HoughMappingMinus20140808.dat";
101 const unsigned houghDoit = 2;
102 const unsigned fLogicLUTTSF = 0;
103 const unsigned fLRLUT = 1;
104 const unsigned fevtTime = 1;
105 const unsigned fmclr = 0;
106 const double inefficiency = 0;
107 const unsigned fileTSF = 0;
108 const unsigned fileETF = 0;
109 const unsigned fverETF = 0;
110 const unsigned fprintFirmETF = 0;
111 const unsigned fileHough3D = 0;
112 const unsigned finder3DMode = 2;
113 const unsigned fileFitter3D = 0;
114 const unsigned trgCDCDataInputMode = 0;
120 firmwareSimulationMode,
121 firmwareSimulationStart,
122 firmwareSimulationStop,
131 houghMappingFilePlus,
132 houghMappingFileMinus,
146 trgCDCDataInputMode);
156 readFile(fn, isb, osbe, osbt);
162 isbd.push_back(& dummy);
163 for (
unsigned i = 1; i < tsfb.
nInput(); i++)
181 cout << PROGRAM_NAME <<
" ... terminated" << endl;
185readFile(
const string& fn,
192 ifstream ifile(fn.c_str(), ios::in);
194 cout << PROGRAM_NAME <<
" !!! can not open file" << endl
195 <<
" " << fn << endl;
201 const unsigned eSize = 625;
202 const unsigned tSize = 1054 - 625;
203 const unsigned mSize = 1309 - 1053 - 9;
210 while (! ifile.eof()) {
211 ifile.getline(b, 10000);
214 if (l.size() == 0)
continue;
215 if (b[0] ==
'#')
continue;
216 if (b[0] ==
'S')
continue;
219 l = TRGUtil::cdrstring(l);
221 l = TRGUtil::cdrstring(l);
222 const string dat = TRGUtil::carstring(l);
223 l = TRGUtil::cdrstring(l);
228 TRGState t = a.subset(eSize, tSize);
230 TRGState c = a.subset(1054 + mSize, 9);
231 unsigned cMgr = unsigned(c);
243 osbe.push_back(eOut);
244 osbt.push_back(tOut);
Singleton class responsible for loading detector parameters from an XML file.
a class of TrackSegmentFinder in TRGCDC
The instance of TRGCDC is a singleton.
A class to represent a serial link between trigger hardware modules.
A class to represent a digitized signal. Unit is nano second.
A class to represent a bundle of SignalVectors.
A class to represent a bundle of digitized signals.
A class to represent a state of multi bits.
static Gearbox & getInstance()
Return reference to the Gearbox instance.
const TRGSignalVector & set(const TRGState &, int clockPosition)
sets state at given clock.
static TRGCDC * getTRGCDC(void)
returns TRGCDC object.
const TRGChannel * input(unsigned i) const
returns input channel i.
unsigned nInput(void) const
returns input channels.
const TRGClock & dataClock(void) const
returns the data clock.
TRGSignalBundle * signal(void) const
returns signal.
void simulate2(void)
Firmware simulation. Unified version of inner and outer : yi.
static int level(void)
returns the debug level.
TRGChannel * output(unsigned i) const
returns output channel i.
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Abstract base class for different kinds of events.