1 #ifndef _CSCGAINSDBCONDITIONS_H
2 #define _CSCGAINSDBCONDITIONS_H
46 const int MAX_SIZE = 252288;
47 const int FACTOR = 1000;
48 const int MAX_SHORT = 32767;
53 std::vector<int> db_index_id;
54 std::vector<float> db_slope;
55 std::vector<float> db_intercept;
56 std::vector<float> db_chi2;
58 float new_gainslope, new_intercpt, new_chisq;
59 std::vector<int> new_cham_id;
60 std::vector<int> new_index_id;
61 std::vector<int> new_strips;
62 std::vector<float> new_slope;
63 std::vector<float> new_intercept;
64 std::vector<float> new_chi2;
73 std::cerr <<
"Error: old_dbgains.dat -> no such file!" << std::endl;
77 while (!dbdata.eof()) {
78 dbdata >> db_index >> db_gainslope;
79 db_index_id.push_back(db_index);
80 db_slope.push_back(db_gainslope);
87 std::ifstream newdata;
90 std::cerr <<
"Error: gains.dat -> no such file!" << std::endl;
94 while (!newdata.eof()) {
95 newdata >> new_index >> new_gainslope >> new_intercpt >> new_chisq;
96 new_index_id.push_back(new_index);
97 new_slope.push_back(new_gainslope);
98 new_intercept.push_back(new_intercpt);
99 new_chi2.push_back(new_chisq);
105 itemvector.resize(MAX_SIZE);
109 for (
int i = 0;
i < MAX_SIZE; ++
i) {
110 itemvector[
i].gain_slope =
int(db_slope[
i] * FACTOR + 0.5);
113 for (
int i = 0;
i < MAX_SIZE; ++
i) {
115 itemvector[
i] = itemvector[
counter];
116 itemvector[
i].gain_slope =
int(db_slope[
i]);
118 for (
unsigned int k = 0;
k < new_index_id.size() - 1;
k++) {
120 if ((
short int)(fabs(new_slope[
k] * FACTOR + 0.5)) < MAX_SHORT)
121 itemvector[
counter].gain_slope =
int(new_slope[
k] * FACTOR + 0.5);
122 itemvector[
i] = itemvector[
counter];
127 itemvector[
i] = itemvector[
counter];