9 int old_chamber_id,old_strip,new_chamber_id,new_strip;
10 float old_slope_right,old_slope_left,old_intercept_right;
11 float old_intercept_left, old_chi2_right,old_chi2_left;
12 std::vector<int> old_cham_id;
13 std::vector<int> old_strips;
14 std::vector<float> old_slope_r;
15 std::vector<float> old_intercept_r;
16 std::vector<float> old_chi2_r;
17 std::vector<float> old_slope_l;
18 std::vector<float> old_intercept_l;
19 std::vector<float> old_chi2_l;
20 float new_slope_right,new_slope_left,new_intercept_right;
21 float new_intercept_left, new_chi2_right,new_chi2_left;
22 std::vector<int> new_cham_id;
23 std::vector<int> new_strips;
24 std::vector<float> new_slope_r;
25 std::vector<float> new_intercept_r;
26 std::vector<float> new_chi2_r;
27 std::vector<float> new_slope_l;
28 std::vector<float> new_intercept_l;
29 std::vector<float> new_chi2_l;
36 int max_istrip,id_layer,max_ring,max_cham;
37 unsigned int old_nrlines=0;
38 unsigned int new_nrlines=0;
41 mean=-0.0009, min=0.035, minchi=1.5;
44 std::ifstream olddata;
47 std::cerr <<
"Error: old_xtalk.dat -> no such file!"<< std::endl;
51 while (!olddata.eof() ) {
52 olddata >> old_chamber_id >> old_strip >> old_slope_right >> old_intercept_right >> old_chi2_right >> old_slope_left >> old_intercept_left >> old_chi2_left ;
53 old_cham_id.push_back(old_chamber_id);
54 old_strips.push_back(old_strip);
55 old_slope_r.push_back(old_slope_right);
56 old_slope_l.push_back(old_slope_left);
57 old_intercept_r.push_back(old_intercept_right);
58 old_intercept_l.push_back(old_intercept_left);
59 old_chi2_r.push_back(old_chi2_right);
60 old_chi2_l.push_back(old_chi2_left);
65 std::ifstream newdata;
68 std::cerr <<
"Error: new_xtalk.dat -> no such file!"<< std::endl;
72 while (!newdata.eof() ) {
73 newdata >> new_chamber_id >> new_strip >> new_slope_right >> new_intercept_right >> new_chi2_right >> new_slope_left >> new_intercept_left >> new_chi2_left ;
74 new_cham_id.push_back(new_chamber_id);
75 new_strips.push_back(new_strip);
76 new_slope_r.push_back(new_slope_right);
77 new_slope_l.push_back(new_slope_left);
78 new_intercept_r.push_back(new_intercept_right);
79 new_intercept_l.push_back(new_intercept_left);
80 new_chi2_r.push_back(new_chi2_right);
81 new_chi2_l.push_back(new_chi2_left);
91 if(istation==1) max_ring=3;
92 if(istation==2) max_ring=2;
93 if(istation==3) max_ring=2;
94 if(istation==4) max_ring=1;
96 for(
int iring=detId.
minRingId(); iring<=max_ring; iring++){
99 if(istation==1 && iring==1) max_cham=36;
100 if(istation==1 && iring==2) max_cham=36;
101 if(istation==1 && iring==3) max_cham=36;
102 if(istation==2 && iring==1) max_cham=18;
103 if(istation==2 && iring==2) max_cham=36;
104 if(istation==3 && iring==1) max_cham=18;
105 if(istation==3 && iring==2) max_cham=36;
106 if(istation==4 && iring==1) max_cham=18;
109 for(
int ichamber=detId.
minChamberId(); ichamber<=max_cham; ichamber++){
113 if(istation==1 && iring==3) max_istrip=64;
115 std::vector<CSCcrosstalk::Item> itemvector;
116 itemvector.resize(max_istrip);
117 id_layer = 100000*iendcap + 10000*istation + 1000*iring + 10*ichamber + ilayer;
119 for(
int istrip=0;istrip<max_istrip;istrip++){
121 itemvector[istrip].xtalk_slope_right=-((double)
rand()/((double)(RAND_MAX)+(double)(1)))/10000+
mean;
122 itemvector[istrip].xtalk_intercept_right=((double)
rand()/((double)(RAND_MAX)+(double)(1)))/100+
min;
123 itemvector[istrip].xtalk_chi2_right=((double)
rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
124 itemvector[istrip].xtalk_slope_left=-((double)
rand()/((double)(RAND_MAX)+(double)(1)))/10000+
mean;
125 itemvector[istrip].xtalk_intercept_left=((double)
rand()/((double)(RAND_MAX)+(double)(1)))/100+
min;
126 itemvector[istrip].xtalk_chi2_left=((double)
rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
127 cncrosstalk->
crosstalk[id_layer]=itemvector;
130 itemvector[istrip].xtalk_slope_right=-((double)
rand()/((double)(RAND_MAX)+(double)(1)))/10000+
mean;
131 itemvector[istrip].xtalk_intercept_right=((double)
rand()/((double)(RAND_MAX)+(double)(1)))/100+
min;
132 itemvector[istrip].xtalk_chi2_right=((double)
rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
133 itemvector[istrip].xtalk_slope_left=0.0;
134 itemvector[istrip].xtalk_intercept_left=0.0;
135 itemvector[istrip].xtalk_chi2_left=0.0;
136 cncrosstalk->
crosstalk[id_layer]=itemvector;
140 itemvector[istrip].xtalk_slope_right=0.0;
141 itemvector[istrip].xtalk_intercept_right=0.0;
142 itemvector[istrip].xtalk_chi2_right=0.0;
143 itemvector[istrip].xtalk_slope_left=-((double)
rand()/((double)(RAND_MAX)+(double)(1)))/10000+
mean;
144 itemvector[istrip].xtalk_intercept_left=((double)
rand()/((double)(RAND_MAX)+(double)(1)))/100+
min;
145 itemvector[istrip].xtalk_chi2_left=((double)
rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
146 cncrosstalk->
crosstalk[id_layer]=itemvector;
156 std::vector<CSCcrosstalk::Item> itemvector;
157 itemvector.resize(80);
159 for(
unsigned int mystrip=0; mystrip<old_nrlines-1; mystrip++){
160 if(old_strips[mystrip]==0) istrip = 0;
161 itemvector[istrip].xtalk_slope_right=old_slope_r[mystrip];
162 itemvector[istrip].xtalk_intercept_right=old_intercept_r[mystrip];
163 itemvector[istrip].xtalk_chi2_right=old_chi2_r[mystrip];
164 itemvector[istrip].xtalk_slope_left=old_slope_l[mystrip];
165 itemvector[istrip].xtalk_intercept_left=old_intercept_l[mystrip];
166 itemvector[istrip].xtalk_chi2_left=old_chi2_l[mystrip];
167 cncrosstalk->
crosstalk[old_cham_id[mystrip]]=itemvector;
172 itemvector.resize(64);
173 for(
unsigned int mystrip=0; mystrip<old_nrlines-1; mystrip++){
174 if(old_strips[mystrip]==0) istrip = 0;
175 if(old_cham_id[mystrip] >= 113000 && old_cham_id[mystrip] <= 113999){
176 itemvector[istrip].xtalk_slope_right=old_slope_r[mystrip];
177 itemvector[istrip].xtalk_intercept_right=old_intercept_r[mystrip];
178 itemvector[istrip].xtalk_chi2_right=old_chi2_r[mystrip];
179 itemvector[istrip].xtalk_slope_left=old_slope_l[mystrip];
180 itemvector[istrip].xtalk_intercept_left=old_intercept_l[mystrip];
181 itemvector[istrip].xtalk_chi2_left=old_chi2_l[mystrip];
182 cncrosstalk->
crosstalk[old_cham_id[mystrip]]=itemvector;
187 itemvector.resize(64);
188 for(
unsigned int mystrip=0; mystrip<old_nrlines-1; mystrip++){
189 if(old_strips[mystrip]==0) istrip = 0;
190 if(old_cham_id[mystrip] >= 213000 && old_cham_id[mystrip] <= 213999){
191 itemvector[istrip].xtalk_slope_right=old_slope_r[mystrip];
192 itemvector[istrip].xtalk_intercept_right=old_intercept_r[mystrip];
193 itemvector[istrip].xtalk_chi2_right=old_chi2_r[mystrip];
194 itemvector[istrip].xtalk_slope_left=old_slope_l[mystrip];
195 itemvector[istrip].xtalk_intercept_left=old_intercept_l[mystrip];
196 itemvector[istrip].xtalk_chi2_left=old_chi2_l[mystrip];
197 cncrosstalk->
crosstalk[old_cham_id[mystrip]]=itemvector;
203 itemvector.resize(80);
204 for(
unsigned int mystrip=0; mystrip<new_nrlines-1; mystrip++){
205 if(new_strips[mystrip]==0) istrip = 0;
206 itemvector[istrip].xtalk_slope_right=new_slope_r[mystrip];
207 itemvector[istrip].xtalk_intercept_right=new_intercept_r[mystrip];
208 itemvector[istrip].xtalk_chi2_right=new_chi2_r[mystrip];
209 itemvector[istrip].xtalk_slope_left=new_slope_l[mystrip];
210 itemvector[istrip].xtalk_intercept_left=new_intercept_l[mystrip];
211 itemvector[istrip].xtalk_chi2_left=new_chi2_l[mystrip];
212 cncrosstalk->
crosstalk[new_cham_id[mystrip]]=itemvector;
216 itemvector.resize(64);
217 for(
unsigned int mystrip=0; mystrip<new_nrlines-1; mystrip++){
218 if(new_strips[mystrip]==0) istrip = 0;
219 if(new_cham_id[mystrip] >= 113000 && new_cham_id[mystrip] <= 113999){
220 itemvector[istrip].xtalk_slope_right=new_slope_r[mystrip];
221 itemvector[istrip].xtalk_intercept_right=new_intercept_r[mystrip];
222 itemvector[istrip].xtalk_chi2_right=new_chi2_r[mystrip];
223 itemvector[istrip].xtalk_slope_left=new_slope_l[mystrip];
224 itemvector[istrip].xtalk_intercept_left=new_intercept_l[mystrip];
225 itemvector[istrip].xtalk_chi2_left=new_chi2_l[mystrip];
226 cncrosstalk->
crosstalk[new_cham_id[mystrip]]=itemvector;
231 itemvector.resize(64);
232 for(
unsigned int mystrip=0; mystrip<new_nrlines-1; mystrip++){
233 if(new_strips[mystrip]==0) istrip = 0;
234 if(new_cham_id[mystrip] >= 213000 && new_cham_id[mystrip] <= 213999){
235 itemvector[istrip].xtalk_slope_right=new_slope_r[mystrip];
236 itemvector[istrip].xtalk_intercept_right=new_intercept_r[mystrip];
237 itemvector[istrip].xtalk_chi2_right=new_chi2_r[mystrip];
238 itemvector[istrip].xtalk_slope_left=new_slope_l[mystrip];
239 itemvector[istrip].xtalk_intercept_left=new_intercept_l[mystrip];
240 itemvector[istrip].xtalk_chi2_left=new_chi2_l[mystrip];
241 cncrosstalk->
crosstalk[new_cham_id[mystrip]]=itemvector;
static int maxStationId()
static int minChamberId()
static int minStationId()
static int maxChamberId()