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;
34 int max_istrip, id_layer, max_ring, max_cham;
35 unsigned int old_nrlines = 0;
36 unsigned int new_nrlines = 0;
39 mean = -0.0009,
min = 0.035, minchi = 1.5;
42 std::ifstream olddata;
45 std::cerr <<
"Error: old_xtalk.dat -> no such file!" << std::endl;
49 while (!olddata.eof()) {
50 olddata >> old_chamber_id >> old_strip >> old_slope_right >> old_intercept_right >> old_chi2_right >>
51 old_slope_left >> old_intercept_left >> old_chi2_left;
52 old_cham_id.push_back(old_chamber_id);
53 old_strips.push_back(old_strip);
54 old_slope_r.push_back(old_slope_right);
55 old_slope_l.push_back(old_slope_left);
56 old_intercept_r.push_back(old_intercept_right);
57 old_intercept_l.push_back(old_intercept_left);
58 old_chi2_r.push_back(old_chi2_right);
59 old_chi2_l.push_back(old_chi2_left);
64 std::ifstream newdata;
67 std::cerr <<
"Error: new_xtalk.dat -> no such file!" << std::endl;
71 while (!newdata.eof()) {
72 newdata >> new_chamber_id >> new_strip >> new_slope_right >> new_intercept_right >> new_chi2_right >>
73 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);
86 for (
int iendcap =
detId.minEndcapId(); iendcap <=
detId.maxEndcapId(); iendcap++) {
87 for (
int istation =
detId.minStationId(); istation <=
detId.maxStationId(); istation++) {
88 max_ring =
detId.maxRingId();
100 for (
int iring =
detId.minRingId(); iring <= max_ring; iring++) {
102 max_cham =
detId.maxChamberId();
103 if (istation == 1 && iring == 1)
105 if (istation == 1 && iring == 2)
107 if (istation == 1 && iring == 3)
109 if (istation == 2 && iring == 1)
111 if (istation == 2 && iring == 2)
113 if (istation == 3 && iring == 1)
115 if (istation == 3 && iring == 2)
117 if (istation == 4 && iring == 1)
122 for (
int ichamber =
detId.minChamberId(); ichamber <= max_cham; ichamber++) {
123 for (
int ilayer =
detId.minLayerId(); ilayer <=
detId.maxLayerId(); ilayer++) {
125 if (istation == 1 && iring == 3)
128 std::vector<CSCcrosstalk::Item> itemvector;
129 itemvector.resize(max_istrip);
130 id_layer = 100000 * iendcap + 10000 * istation + 1000 * iring + 10 * ichamber + ilayer;
132 for (
int istrip = 0; istrip < max_istrip; istrip++) {
134 itemvector[istrip].xtalk_slope_right =
135 -((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 10000 +
mean;
136 itemvector[istrip].xtalk_intercept_right =
137 ((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 100 +
min;
138 itemvector[istrip].xtalk_chi2_right = ((double)rand() / ((double)(RAND_MAX) + (double)(1))) + minchi;
139 itemvector[istrip].xtalk_slope_left =
140 -((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 10000 +
mean;
141 itemvector[istrip].xtalk_intercept_left =
142 ((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 100 +
min;
143 itemvector[istrip].xtalk_chi2_left = ((double)rand() / ((double)(RAND_MAX) + (double)(1))) + minchi;
144 cncrosstalk->
crosstalk[id_layer] = itemvector;
147 itemvector[istrip].xtalk_slope_right =
148 -((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 10000 +
mean;
149 itemvector[istrip].xtalk_intercept_right =
150 ((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 100 +
min;
151 itemvector[istrip].xtalk_chi2_right = ((double)rand() / ((double)(RAND_MAX) + (double)(1))) + minchi;
152 itemvector[istrip].xtalk_slope_left = 0.0;
153 itemvector[istrip].xtalk_intercept_left = 0.0;
154 itemvector[istrip].xtalk_chi2_left = 0.0;
155 cncrosstalk->
crosstalk[id_layer] = itemvector;
159 itemvector[istrip].xtalk_slope_right = 0.0;
160 itemvector[istrip].xtalk_intercept_right = 0.0;
161 itemvector[istrip].xtalk_chi2_right = 0.0;
162 itemvector[istrip].xtalk_slope_left =
163 -((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 10000 +
mean;
164 itemvector[istrip].xtalk_intercept_left =
165 ((double)rand() / ((double)(RAND_MAX) + (double)(1))) / 100 +
min;
166 itemvector[istrip].xtalk_chi2_left = ((double)rand() / ((double)(RAND_MAX) + (double)(1))) + minchi;
167 cncrosstalk->
crosstalk[id_layer] = itemvector;
177 std::vector<CSCcrosstalk::Item> itemvector;
178 itemvector.resize(80);
180 for (
unsigned int mystrip = 0; mystrip < old_nrlines - 1; mystrip++) {
181 if (old_strips[mystrip] == 0)
183 itemvector[istrip].xtalk_slope_right = old_slope_r[mystrip];
184 itemvector[istrip].xtalk_intercept_right = old_intercept_r[mystrip];
185 itemvector[istrip].xtalk_chi2_right = old_chi2_r[mystrip];
186 itemvector[istrip].xtalk_slope_left = old_slope_l[mystrip];
187 itemvector[istrip].xtalk_intercept_left = old_intercept_l[mystrip];
188 itemvector[istrip].xtalk_chi2_left = old_chi2_l[mystrip];
189 cncrosstalk->
crosstalk[old_cham_id[mystrip]] = itemvector;
193 itemvector.resize(64);
194 for (
unsigned int mystrip = 0; mystrip < old_nrlines - 1; mystrip++) {
195 if (old_strips[mystrip] == 0)
197 if (old_cham_id[mystrip] >= 113000 && old_cham_id[mystrip] <= 113999) {
198 itemvector[istrip].xtalk_slope_right = old_slope_r[mystrip];
199 itemvector[istrip].xtalk_intercept_right = old_intercept_r[mystrip];
200 itemvector[istrip].xtalk_chi2_right = old_chi2_r[mystrip];
201 itemvector[istrip].xtalk_slope_left = old_slope_l[mystrip];
202 itemvector[istrip].xtalk_intercept_left = old_intercept_l[mystrip];
203 itemvector[istrip].xtalk_chi2_left = old_chi2_l[mystrip];
204 cncrosstalk->
crosstalk[old_cham_id[mystrip]] = itemvector;
209 itemvector.resize(64);
210 for (
unsigned int mystrip = 0; mystrip < old_nrlines - 1; mystrip++) {
211 if (old_strips[mystrip] == 0)
213 if (old_cham_id[mystrip] >= 213000 && old_cham_id[mystrip] <= 213999) {
214 itemvector[istrip].xtalk_slope_right = old_slope_r[mystrip];
215 itemvector[istrip].xtalk_intercept_right = old_intercept_r[mystrip];
216 itemvector[istrip].xtalk_chi2_right = old_chi2_r[mystrip];
217 itemvector[istrip].xtalk_slope_left = old_slope_l[mystrip];
218 itemvector[istrip].xtalk_intercept_left = old_intercept_l[mystrip];
219 itemvector[istrip].xtalk_chi2_left = old_chi2_l[mystrip];
220 cncrosstalk->
crosstalk[old_cham_id[mystrip]] = itemvector;
226 itemvector.resize(80);
227 for (
unsigned int mystrip = 0; mystrip < new_nrlines - 1; mystrip++) {
228 if (new_strips[mystrip] == 0)
230 itemvector[istrip].xtalk_slope_right = new_slope_r[mystrip];
231 itemvector[istrip].xtalk_intercept_right = new_intercept_r[mystrip];
232 itemvector[istrip].xtalk_chi2_right = new_chi2_r[mystrip];
233 itemvector[istrip].xtalk_slope_left = new_slope_l[mystrip];
234 itemvector[istrip].xtalk_intercept_left = new_intercept_l[mystrip];
235 itemvector[istrip].xtalk_chi2_left = new_chi2_l[mystrip];
236 cncrosstalk->
crosstalk[new_cham_id[mystrip]] = itemvector;
240 itemvector.resize(64);
241 for (
unsigned int mystrip = 0; mystrip < new_nrlines - 1; mystrip++) {
242 if (new_strips[mystrip] == 0)
244 if (new_cham_id[mystrip] >= 113000 && new_cham_id[mystrip] <= 113999) {
245 itemvector[istrip].xtalk_slope_right = new_slope_r[mystrip];
246 itemvector[istrip].xtalk_intercept_right = new_intercept_r[mystrip];
247 itemvector[istrip].xtalk_chi2_right = new_chi2_r[mystrip];
248 itemvector[istrip].xtalk_slope_left = new_slope_l[mystrip];
249 itemvector[istrip].xtalk_intercept_left = new_intercept_l[mystrip];
250 itemvector[istrip].xtalk_chi2_left = new_chi2_l[mystrip];
251 cncrosstalk->
crosstalk[new_cham_id[mystrip]] = itemvector;
256 itemvector.resize(64);
257 for (
unsigned int mystrip = 0; mystrip < new_nrlines - 1; mystrip++) {
258 if (new_strips[mystrip] == 0)
260 if (new_cham_id[mystrip] >= 213000 && new_cham_id[mystrip] <= 213999) {
261 itemvector[istrip].xtalk_slope_right = new_slope_r[mystrip];
262 itemvector[istrip].xtalk_intercept_right = new_intercept_r[mystrip];
263 itemvector[istrip].xtalk_chi2_right = new_chi2_r[mystrip];
264 itemvector[istrip].xtalk_slope_left = new_slope_l[mystrip];
265 itemvector[istrip].xtalk_intercept_left = new_intercept_l[mystrip];
266 itemvector[istrip].xtalk_chi2_left = new_chi2_l[mystrip];
267 cncrosstalk->
crosstalk[new_cham_id[mystrip]] = itemvector;
281 findingRecord<CSCcrosstalkRcd>();
ReturnType produceCrosstalk(const CSCcrosstalkRcd &)
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
std::unique_ptr< CSCcrosstalk > ReturnType
static const IOVSyncValue & endOfTime()
std::pair< Time_t, Time_t > ValidityInterval
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
static const IOVSyncValue & beginOfTime()
~CSCCrosstalkConditions() override
CSCCrosstalkConditions(const edm::ParameterSet &)
static CSCcrosstalk * prefillCrosstalk()