13#define TRG_SHORT_NAMES
19#include "trg/trg/Utilities.h"
25#define NAME "TRGCDCHoughMapConverter"
26#define VERSION "version 0.00[2015/07/23]"
29main(
int argc,
const char* argv[])
32 cout << NAME <<
" ... " << VERSION << endl;
33 const string tab =
" ";
37 cout << NAME <<
" !!! two arguments necessary" << endl
38 << tab <<
" 1 : input mapping file name" << endl
39 << tab <<
" 2 : output mapping file name" << endl;
44 string ts0 = TRGUtil::dateStringF();
48 const string iname = argv[1];
51 const string oname = argv[2];
53 cout <<
" input mapping file : " << iname << endl;
54 cout <<
" output mapping file : " << oname << endl;
57 ifstream ifile(iname.c_str(), ios::in);
59 cout << NAME <<
" !!! can not open file" << endl
60 <<
" " << iname << endl;
65 ofstream ofile(oname.c_str(), ios::out);
67 cout << NAME <<
" !!! can not open file" << endl
68 <<
" " << oname << endl;
74 vector<unsigned> tsf2h[9][400];
75 while (! ifile.eof()) {
76 ifile.getline(b, 800);
79 if (b[0] ==
'#')
continue;
81 const unsigned hx = stoi(TRGUtil::carstring(l));
82 l = TRGUtil::cdrstring(l);
83 const unsigned hy = stoi(TRGUtil::carstring(l));
84 l = TRGUtil::cdrstring(l);
86 const unsigned hcid = hy * 1000 + hx;
89 const unsigned tsl = stoi(TRGUtil::carstring(l));
90 l = TRGUtil::cdrstring(l);
91 const unsigned tsi = stoi(TRGUtil::carstring(l));
92 l = TRGUtil::cdrstring(l);
93 tsf2h[tsl][tsi].push_back(hcid);
95 if (l.size() == 0)
break;
101 for (
unsigned tsl = 0; tsl < 9; tsl += 2) {
102 for (
unsigned tsi = 0; tsi < 400; tsi++) {
104 if (tsf2h[tsl][tsi].size() == 0)
continue;
108 for (
unsigned k = 0; k < tsf2h[tsl][tsi].size(); k++) {
109 const unsigned hcid = tsf2h[tsl][tsi][k];
110 const unsigned y = hcid / 1000;
111 if (y < miny) miny = y;
116 cout <<
"tsf " << tsl <<
" " << tsi <<
" x=";
118 for (
unsigned k = 0; k < tsf2h[tsl][tsi].size(); k++) {
119 const unsigned hcid = tsf2h[tsl][tsi][k];
120 const unsigned y = hcid / 1000;
121 if (y != miny)
continue;
122 const unsigned x = hcid % 1000;
131 ofile <<
"# This file is generated by " << NAME <<
"[" << VERSION <<
"]"
133 ofile <<
"# Source file is " << iname << endl;
134 ofile <<
"# " << ts0 << endl;
135 ofile <<
"#" << endl;
136 for (
unsigned j = 1; j < 17; j++) {
137 for (
unsigned i = 0; i < 160; i++) {
138 const unsigned hcid = j * 1000 + i;
139 ofile << i <<
" " << j;
141 for (
unsigned tsl = 0; tsl < 9; tsl += 2) {
142 for (
unsigned tsi = 0; tsi < 400; tsi++) {
143 for (
unsigned k = 0; k < tsf2h[tsl][tsi].size(); k++) {
144 if (tsf2h[tsl][tsi][k] == hcid)
145 ofile <<
" " << tsl <<
" " << tsi;
Abstract base class for different kinds of events.