10 int old_chamber_id,old_strip,new_chamber_id,new_strip;
11 float old_slope_right,old_slope_left,old_intercept_right;
12 float old_intercept_left, old_chi2_right,old_chi2_left;
13 std::vector<int> old_cham_id;
14 std::vector<int> old_strips;
15 std::vector<float> old_slope_r;
16 std::vector<float> old_intercept_r;
17 std::vector<float> old_chi2_r;
18 std::vector<float> old_slope_l;
19 std::vector<float> old_intercept_l;
20 std::vector<float> old_chi2_l;
21 float new_slope_right,new_slope_left,new_intercept_right;
22 float new_intercept_left, new_chi2_right,new_chi2_left;
23 std::vector<int> new_cham_id;
24 std::vector<int> new_strips;
25 std::vector<float> new_slope_r;
26 std::vector<float> new_intercept_r;
27 std::vector<float> new_chi2_r;
28 std::vector<float> new_slope_l;
29 std::vector<float> new_intercept_l;
30 std::vector<float> new_chi2_l;
37 int max_istrip,id_layer,max_ring,max_cham;
38 unsigned int old_nrlines=0;
39 unsigned int new_nrlines=0;
42 mean=-0.0009, min=0.035, minchi=1.5;
45 std::ifstream olddata;
48 std::cerr <<
"Error: old_xtalk.dat -> no such file!"<< std::endl;
52 while (!olddata.eof() ) {
53 olddata >> old_chamber_id >> old_strip >> old_slope_right >> old_intercept_right >> old_chi2_right >> old_slope_left >> old_intercept_left >> old_chi2_left ;
54 old_cham_id.push_back(old_chamber_id);
55 old_strips.push_back(old_strip);
56 old_slope_r.push_back(old_slope_right);
57 old_slope_l.push_back(old_slope_left);
58 old_intercept_r.push_back(old_intercept_right);
59 old_intercept_l.push_back(old_intercept_left);
60 old_chi2_r.push_back(old_chi2_right);
61 old_chi2_l.push_back(old_chi2_left);
66 std::ifstream newdata;
69 std::cerr <<
"Error: new_xtalk.dat -> no such file!"<< std::endl;
73 while (!newdata.eof() ) {
74 newdata >> new_chamber_id >> new_strip >> new_slope_right >> new_intercept_right >> new_chi2_right >> new_slope_left >> new_intercept_left >> new_chi2_left ;
75 new_cham_id.push_back(new_chamber_id);
76 new_strips.push_back(new_strip);
77 new_slope_r.push_back(new_slope_right);
78 new_slope_l.push_back(new_slope_left);
79 new_intercept_r.push_back(new_intercept_right);
80 new_intercept_l.push_back(new_intercept_left);
81 new_chi2_r.push_back(new_chi2_right);
82 new_chi2_l.push_back(new_chi2_left);
92 if(istation==1) max_ring=3;
93 if(istation==2) max_ring=2;
94 if(istation==3) max_ring=2;
95 if(istation==4) max_ring=1;
97 for(
int iring=detId.
minRingId(); iring<=max_ring; iring++){
100 if(istation==1 && iring==1) max_cham=36;
101 if(istation==1 && iring==2) max_cham=36;
102 if(istation==1 && iring==3) max_cham=36;
103 if(istation==2 && iring==1) max_cham=18;
104 if(istation==2 && iring==2) max_cham=36;
105 if(istation==3 && iring==1) max_cham=18;
106 if(istation==3 && iring==2) max_cham=36;
107 if(istation==4 && iring==1) max_cham=18;
110 for(
int ichamber=detId.
minChamberId(); ichamber<=max_cham; ichamber++){
114 if(istation==1 && iring==3) max_istrip=64;
116 std::vector<CSCcrosstalk::Item> itemvector;
117 itemvector.resize(max_istrip);
118 id_layer = 100000*iendcap + 10000*istation + 1000*iring + 10*ichamber + ilayer;
120 for(
int istrip=0;istrip<max_istrip;istrip++){
122 itemvector[istrip].xtalk_slope_right=-((double)
rand()/((double)(RAND_MAX)+(double)(1)))/10000+
mean;
123 itemvector[istrip].xtalk_intercept_right=((double)
rand()/((double)(RAND_MAX)+(double)(1)))/100+
min;
124 itemvector[istrip].xtalk_chi2_right=((double)
rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
125 itemvector[istrip].xtalk_slope_left=-((double)
rand()/((double)(RAND_MAX)+(double)(1)))/10000+
mean;
126 itemvector[istrip].xtalk_intercept_left=((double)
rand()/((double)(RAND_MAX)+(double)(1)))/100+
min;
127 itemvector[istrip].xtalk_chi2_left=((double)
rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
128 cncrosstalk->
crosstalk[id_layer]=itemvector;
131 itemvector[istrip].xtalk_slope_right=-((double)
rand()/((double)(RAND_MAX)+(double)(1)))/10000+
mean;
132 itemvector[istrip].xtalk_intercept_right=((double)
rand()/((double)(RAND_MAX)+(double)(1)))/100+
min;
133 itemvector[istrip].xtalk_chi2_right=((double)
rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
134 itemvector[istrip].xtalk_slope_left=0.0;
135 itemvector[istrip].xtalk_intercept_left=0.0;
136 itemvector[istrip].xtalk_chi2_left=0.0;
137 cncrosstalk->
crosstalk[id_layer]=itemvector;
141 itemvector[istrip].xtalk_slope_right=0.0;
142 itemvector[istrip].xtalk_intercept_right=0.0;
143 itemvector[istrip].xtalk_chi2_right=0.0;
144 itemvector[istrip].xtalk_slope_left=-((double)
rand()/((double)(RAND_MAX)+(double)(1)))/10000+
mean;
145 itemvector[istrip].xtalk_intercept_left=((double)
rand()/((double)(RAND_MAX)+(double)(1)))/100+
min;
146 itemvector[istrip].xtalk_chi2_left=((double)
rand()/((double)(RAND_MAX)+(double)(1)))+minchi;
147 cncrosstalk->
crosstalk[id_layer]=itemvector;
157 std::vector<CSCcrosstalk::Item> itemvector;
158 itemvector.resize(80);
160 for(
unsigned int mystrip=0; mystrip<old_nrlines-1; mystrip++){
161 if(old_strips[mystrip]==0) istrip = 0;
162 itemvector[istrip].xtalk_slope_right=old_slope_r[mystrip];
163 itemvector[istrip].xtalk_intercept_right=old_intercept_r[mystrip];
164 itemvector[istrip].xtalk_chi2_right=old_chi2_r[mystrip];
165 itemvector[istrip].xtalk_slope_left=old_slope_l[mystrip];
166 itemvector[istrip].xtalk_intercept_left=old_intercept_l[mystrip];
167 itemvector[istrip].xtalk_chi2_left=old_chi2_l[mystrip];
168 cncrosstalk->
crosstalk[old_cham_id[mystrip]]=itemvector;
173 itemvector.resize(64);
174 for(
unsigned int mystrip=0; mystrip<old_nrlines-1; mystrip++){
175 if(old_strips[mystrip]==0) istrip = 0;
176 if(old_cham_id[mystrip] >= 113000 && old_cham_id[mystrip] <= 113999){
177 itemvector[istrip].xtalk_slope_right=old_slope_r[mystrip];
178 itemvector[istrip].xtalk_intercept_right=old_intercept_r[mystrip];
179 itemvector[istrip].xtalk_chi2_right=old_chi2_r[mystrip];
180 itemvector[istrip].xtalk_slope_left=old_slope_l[mystrip];
181 itemvector[istrip].xtalk_intercept_left=old_intercept_l[mystrip];
182 itemvector[istrip].xtalk_chi2_left=old_chi2_l[mystrip];
183 cncrosstalk->
crosstalk[old_cham_id[mystrip]]=itemvector;
188 itemvector.resize(64);
189 for(
unsigned int mystrip=0; mystrip<old_nrlines-1; mystrip++){
190 if(old_strips[mystrip]==0) istrip = 0;
191 if(old_cham_id[mystrip] >= 213000 && old_cham_id[mystrip] <= 213999){
192 itemvector[istrip].xtalk_slope_right=old_slope_r[mystrip];
193 itemvector[istrip].xtalk_intercept_right=old_intercept_r[mystrip];
194 itemvector[istrip].xtalk_chi2_right=old_chi2_r[mystrip];
195 itemvector[istrip].xtalk_slope_left=old_slope_l[mystrip];
196 itemvector[istrip].xtalk_intercept_left=old_intercept_l[mystrip];
197 itemvector[istrip].xtalk_chi2_left=old_chi2_l[mystrip];
198 cncrosstalk->
crosstalk[old_cham_id[mystrip]]=itemvector;
204 itemvector.resize(80);
205 for(
unsigned int mystrip=0; mystrip<new_nrlines-1; mystrip++){
206 if(new_strips[mystrip]==0) istrip = 0;
207 itemvector[istrip].xtalk_slope_right=new_slope_r[mystrip];
208 itemvector[istrip].xtalk_intercept_right=new_intercept_r[mystrip];
209 itemvector[istrip].xtalk_chi2_right=new_chi2_r[mystrip];
210 itemvector[istrip].xtalk_slope_left=new_slope_l[mystrip];
211 itemvector[istrip].xtalk_intercept_left=new_intercept_l[mystrip];
212 itemvector[istrip].xtalk_chi2_left=new_chi2_l[mystrip];
213 cncrosstalk->
crosstalk[new_cham_id[mystrip]]=itemvector;
217 itemvector.resize(64);
218 for(
unsigned int mystrip=0; mystrip<new_nrlines-1; mystrip++){
219 if(new_strips[mystrip]==0) istrip = 0;
220 if(new_cham_id[mystrip] >= 113000 && new_cham_id[mystrip] <= 113999){
221 itemvector[istrip].xtalk_slope_right=new_slope_r[mystrip];
222 itemvector[istrip].xtalk_intercept_right=new_intercept_r[mystrip];
223 itemvector[istrip].xtalk_chi2_right=new_chi2_r[mystrip];
224 itemvector[istrip].xtalk_slope_left=new_slope_l[mystrip];
225 itemvector[istrip].xtalk_intercept_left=new_intercept_l[mystrip];
226 itemvector[istrip].xtalk_chi2_left=new_chi2_l[mystrip];
227 cncrosstalk->
crosstalk[new_cham_id[mystrip]]=itemvector;
232 itemvector.resize(64);
233 for(
unsigned int mystrip=0; mystrip<new_nrlines-1; mystrip++){
234 if(new_strips[mystrip]==0) istrip = 0;
235 if(new_cham_id[mystrip] >= 213000 && new_cham_id[mystrip] <= 213999){
236 itemvector[istrip].xtalk_slope_right=new_slope_r[mystrip];
237 itemvector[istrip].xtalk_intercept_right=new_intercept_r[mystrip];
238 itemvector[istrip].xtalk_chi2_right=new_chi2_r[mystrip];
239 itemvector[istrip].xtalk_slope_left=new_slope_l[mystrip];
240 itemvector[istrip].xtalk_intercept_left=new_intercept_l[mystrip];
241 itemvector[istrip].xtalk_chi2_left=new_chi2_l[mystrip];
242 cncrosstalk->
crosstalk[new_cham_id[mystrip]]=itemvector;
259 findingRecord<CSCcrosstalkRcd>();
ReturnType produceCrosstalk(const CSCcrosstalkRcd &)
std::unique_ptr< CSCcrosstalk > ReturnType
static const IOVSyncValue & endOfTime()
std::pair< Time_t, Time_t > ValidityInterval
static int maxStationId()
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
static int minChamberId()
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
static const IOVSyncValue & beginOfTime()
static int minStationId()
~CSCCrosstalkConditions() override
static int maxChamberId()
CSCCrosstalkConditions(const edm::ParameterSet &)
static CSCcrosstalk * prefillCrosstalk()