1 #ifndef _CSCNOISEMATRIXDBCONDITIONS_H
2 #define _CSCNOISEMATRIXDBCONDITIONS_H
47 const int FACTOR = 1000;
48 const int MAX_SHORT = 32767;
50 int new_index, db_index;
51 float db_elm33, db_elm34, db_elm44, db_elm35, db_elm45, db_elm55;
52 float db_elm46, db_elm56, db_elm66, db_elm57, db_elm67, db_elm77;
53 std::vector<int> db_index_id;
54 std::vector<float> db_elem33;
55 std::vector<float> db_elem34;
56 std::vector<float> db_elem44;
57 std::vector<float> db_elem45;
58 std::vector<float> db_elem35;
59 std::vector<float> db_elem55;
60 std::vector<float> db_elem46;
61 std::vector<float> db_elem56;
62 std::vector<float> db_elem66;
63 std::vector<float> db_elem57;
64 std::vector<float> db_elem67;
65 std::vector<float> db_elem77;
67 float new_elm33, new_elm34, new_elm44, new_elm35, new_elm45, new_elm55;
68 float new_elm46, new_elm56, new_elm66, new_elm57, new_elm67, new_elm77;
69 std::vector<int> new_cham_id;
70 std::vector<int> new_index_id;
71 std::vector<float> new_elem33;
72 std::vector<float> new_elem34;
73 std::vector<float> new_elem44;
74 std::vector<float> new_elem45;
75 std::vector<float> new_elem35;
76 std::vector<float> new_elem55;
77 std::vector<float> new_elem46;
78 std::vector<float> new_elem56;
79 std::vector<float> new_elem66;
80 std::vector<float> new_elem57;
81 std::vector<float> new_elem67;
82 std::vector<float> new_elem77;
93 std::cerr <<
"Error: old_dbmatrix.dat -> no such file!" << std::endl;
97 while (!dbdata.eof()) {
98 dbdata >> db_index >> db_elm33 >> db_elm34 >> db_elm44 >> db_elm35 >> db_elm45 >> db_elm55 >> db_elm46 >>
99 db_elm56 >> db_elm66 >> db_elm57 >> db_elm67 >> db_elm77;
100 db_index_id.push_back(db_index);
101 db_elem33.push_back(db_elm33);
102 db_elem34.push_back(db_elm34);
103 db_elem35.push_back(db_elm35);
104 db_elem44.push_back(db_elm44);
105 db_elem45.push_back(db_elm45);
106 db_elem46.push_back(db_elm46);
107 db_elem55.push_back(db_elm55);
108 db_elem56.push_back(db_elm56);
109 db_elem57.push_back(db_elm57);
110 db_elem66.push_back(db_elm66);
111 db_elem67.push_back(db_elm67);
112 db_elem77.push_back(db_elm77);
117 std::ifstream newdata;
120 std::cerr <<
"Error: matrix.dat -> no such file!" << std::endl;
124 while (!newdata.eof()) {
125 newdata >> new_index >> new_elm33 >> new_elm34 >> new_elm44 >> new_elm35 >> new_elm45 >> new_elm55 >> new_elm46 >>
126 new_elm56 >> new_elm66 >> new_elm57 >> new_elm67 >> new_elm77;
128 new_index_id.push_back(new_index);
129 new_elem33.push_back(new_elm33);
130 new_elem34.push_back(new_elm34);
131 new_elem35.push_back(new_elm35);
132 new_elem44.push_back(new_elm44);
133 new_elem45.push_back(new_elm45);
134 new_elem46.push_back(new_elm46);
135 new_elem55.push_back(new_elm55);
136 new_elem56.push_back(new_elm56);
137 new_elem57.push_back(new_elm57);
138 new_elem66.push_back(new_elm66);
139 new_elem67.push_back(new_elm67);
140 new_elem77.push_back(new_elm77);
150 itemvector[
i].elem33 = (
short int)(db_elem33[
i] * FACTOR + 0.5);
151 itemvector[
i].elem34 = (
short int)(db_elem34[
i] * FACTOR + 0.5);
152 itemvector[
i].elem35 = (
short int)(db_elem35[
i] * FACTOR + 0.5);
153 itemvector[
i].elem44 = (
short int)(db_elem44[
i] * FACTOR + 0.5);
154 itemvector[
i].elem45 = (
short int)(db_elem45[
i] * FACTOR + 0.5);
155 itemvector[
i].elem46 = (
short int)(db_elem46[
i] * FACTOR + 0.5);
156 itemvector[
i].elem55 = (
short int)(db_elem55[
i] * FACTOR + 0.5);
157 itemvector[
i].elem56 = (
short int)(db_elem56[
i] * FACTOR + 0.5);
158 itemvector[
i].elem57 = (
short int)(db_elem57[
i] * FACTOR + 0.5);
159 itemvector[
i].elem66 = (
short int)(db_elem66[
i] * FACTOR + 0.5);
160 itemvector[
i].elem67 = (
short int)(db_elem67[
i] * FACTOR + 0.5);
161 itemvector[
i].elem77 = (
short int)(db_elem77[
i] * FACTOR + 0.5);
166 itemvector[
i] = itemvector[
counter];
167 itemvector[
i].elem33 =
int(db_elem33[
i]);
168 itemvector[
i].elem34 =
int(db_elem34[
i]);
169 itemvector[
i].elem35 =
int(db_elem35[
i]);
170 itemvector[
i].elem44 =
int(db_elem44[
i]);
171 itemvector[
i].elem45 =
int(db_elem45[
i]);
172 itemvector[
i].elem46 =
int(db_elem46[
i]);
173 itemvector[
i].elem55 =
int(db_elem55[
i]);
174 itemvector[
i].elem56 =
int(db_elem56[
i]);
175 itemvector[
i].elem57 =
int(db_elem57[
i]);
176 itemvector[
i].elem66 =
int(db_elem66[
i]);
177 itemvector[
i].elem67 =
int(db_elem67[
i]);
178 itemvector[
i].elem77 =
int(db_elem77[
i]);
180 for (
unsigned int k = 0;
k < new_index_id.size() - 1;
k++) {
182 if ((
short int)(fabs(new_elem33[
k] * FACTOR + 0.5)) < MAX_SHORT)
183 itemvector[
counter].elem33 =
int(new_elem33[
k] * FACTOR + 0.5);
184 if ((
short int)(fabs(new_elem34[
k] * FACTOR + 0.5)) < MAX_SHORT)
185 itemvector[
counter].elem34 =
int(new_elem34[
k] * FACTOR + 0.5);
186 if ((
short int)(fabs(new_elem35[
k] * FACTOR + 0.5)) < MAX_SHORT)
187 itemvector[
counter].elem35 =
int(new_elem35[
k] * FACTOR + 0.5);
188 if ((
short int)(fabs(new_elem44[
k] * FACTOR + 0.5)) < MAX_SHORT)
189 itemvector[
counter].elem44 =
int(new_elem44[
k] * FACTOR + 0.5);
190 if ((
short int)(fabs(new_elem45[
k] * FACTOR + 0.5)) < MAX_SHORT)
191 itemvector[
counter].elem45 =
int(new_elem45[
k] * FACTOR + 0.5);
192 if ((
short int)(fabs(new_elem46[
k] * FACTOR + 0.5)) < MAX_SHORT)
193 itemvector[
counter].elem46 =
int(new_elem46[
k] * FACTOR + 0.5);
194 if ((
short int)(fabs(new_elem55[
k] * FACTOR + 0.5)) < MAX_SHORT)
195 itemvector[
counter].elem55 =
int(new_elem55[
k] * FACTOR + 0.5);
196 if ((
short int)(fabs(new_elem56[
k] * FACTOR + 0.5)) < MAX_SHORT)
197 itemvector[
counter].elem56 =
int(new_elem56[
k] * FACTOR + 0.5);
198 if ((
short int)(fabs(new_elem57[
k] * FACTOR + 0.5)) < MAX_SHORT)
199 itemvector[
counter].elem57 =
int(new_elem57[
k] * FACTOR + 0.5);
200 if ((
short int)(fabs(new_elem66[
k] * FACTOR + 0.5)) < MAX_SHORT)
201 itemvector[
counter].elem66 =
int(new_elem66[
k] * FACTOR + 0.5);
202 if ((
short int)(fabs(new_elem67[
k] * FACTOR + 0.5)) < MAX_SHORT)
203 itemvector[
counter].elem67 =
int(new_elem67[
k] * FACTOR + 0.5);
204 if ((
short int)(fabs(new_elem77[
k] * FACTOR + 0.5)) < MAX_SHORT)
205 itemvector[
counter].elem77 =
int(new_elem77[
k] * FACTOR + 0.5);
206 itemvector[
i] = itemvector[
counter];
223 itemvector[
i] = itemvector[
counter];