81 TH1F hOccupancy768(
"Occupancy768_L@layerL@ladderS@sensor@view",
"Strip Occupancy of @layer.@ladder.@sensor @view/@side side", 768,
84 hOccupancy768.GetXaxis()->SetTitle(
"cellID");
85 TH1F hOccupancy512(
"Occupancy512_L@layerL@ladderS@sensor@view",
"Strip Occupancy of @layer.@ladder.@sensor @view/@side side", 512,
88 hOccupancy512.GetXaxis()->SetTitle(
"cellID");
91 TH1F hHotStrips768(
"HotStrips768_L@layerL@ladderS@sensor@view",
"Hot Strips of @layer.@ladder.@sensor @view/@side side", 768, 0,
93 hHotStrips768.GetXaxis()->SetTitle(
"cellID");
94 TH1F hHotStrips512(
"HotStrips512_L@layerL@ladderS@sensor@view",
"Hot Strips of @layer.@ladder.@sensor @view/@side side", 512, 0,
96 hHotStrips512.GetXaxis()->SetTitle(
"cellID");
99 TH1F hOccupancy_after768(
"OccupancyAfter768_L@layerL@ladderS@sensor@view",
100 "Non-Hot Strip Occupancy after HSF of @layer.@ladder.@sensor @view/@side side", 768, 0, 768);
101 hOccupancy_after768.GetXaxis()->SetTitle(
"cellID");
102 TH1F hOccupancy_after512(
"OccupancyAfter512_L@layerL@ladderS@sensor@view",
103 "Non-Hot Strip Occupancy after HSF of @layer.@ladder.@sensor @view/@side side", 512, 0, 512);
104 hOccupancy_after512.GetXaxis()->SetTitle(
"cellID");
107 TH1F hOccAll(
"occAll_L@layerL@ladderS@sensor@view",
"Strip Occupancy Distribution of @layer.@ladder.@sensor @view/@side side", 1000,
109 hOccAll.GetXaxis()->SetTitle(
"occupancy");
112 TH1F hOccHot(
"occHot_L@layerL@ladderS@sensor@view",
"Hot Strip Occupancy Distribution of @layer.@ladder.@sensor @view/@side side",
114 hOccHot.GetXaxis()->SetTitle(
"occupancy");
117 TH1F hOccAfter(
"occAfter_L@layerL@ladderS@sensor@view",
118 "Non-Hot Strip Occupancy Distribution of @layer.@ladder.@sensor @view/@side side", 1000, 0, 0.05);
119 hOccAfter.GetXaxis()->SetTitle(
"occupancy");
123 TH1F hDist(
"dist_L@layerL@ladderS@sensor@view",
"DSSD occupancy distribution of @layer.@ladder.@sensor @view/@side side", 100, 0,
125 hDist.GetXaxis()->SetTitle(
"occupancy");
128 TH1F hDist1(
"dist1_L@layerL@ladderS@sensor@view",
"DSSD true occupancy distribution of @layer.@ladder.@sensor @view/@side side",
131 hDist.GetXaxis()->SetTitle(
"occupancy");
133 TH2F hDist12(
"dist2d_L@layerL@ladderS@sensor@view",
134 "DSSD true vs sensor occupancy distribution of @layer.@ladder.@sensor @view/@side side", 1000, 0, 0.05, 1000, 0, 0.05);
135 hDist12.GetXaxis()->SetTitle(
"sensor occupancy");
136 hDist12.GetYaxis()->SetTitle(
"occupancy");
188 TDirectory* oldDir =
nullptr;
189 TDirectory* dir_occuL[4] = {
nullptr,
nullptr,
nullptr,
nullptr};
195 dir_occuL[0] = oldDir->mkdir(
"layer3");
196 dir_occuL[1] = oldDir->mkdir(
"layer4");
197 dir_occuL[2] = oldDir->mkdir(
"layer5");
198 dir_occuL[3] = oldDir->mkdir(
"layer6");
209 occDBObjPtr.
construct(-99., Form(
"SVDOccupancy_exp%d_run%d_zs%1.1f", exp, run,
m_zs));
212 hotStripsDBObjPtr.
construct(0, Form(
"SVDHotStrips_exp%d_run%d_zs%1.1f_absThr%f_relOccPrec%f", exp, run,
m_zs,
m_absThr,
215 B2RESULT(
"number of events " << nevents);
219 std::set<Belle2::VxdID>::iterator itSvdLayers = svdLayers.begin();
220 while ((itSvdLayers != svdLayers.end())
221 && (itSvdLayers->getLayerNumber() != 7)) {
223 std::set<Belle2::VxdID> svdLadders = aGeometry.
getLadders(*itSvdLayers);
224 std::set<Belle2::VxdID>::iterator itSvdLadders = svdLadders.begin();
226 while (itSvdLadders != svdLadders.end()) {
228 std::set<Belle2::VxdID> svdSensors = aGeometry.
getSensors(*itSvdLadders);
229 std::set<Belle2::VxdID>::iterator itSvdSensors = svdSensors.begin();
231 while (itSvdSensors != svdSensors.end()) {
233 for (
int k = 0; k <
m_nSides; k ++) {
236 int layer = itSvdSensors->getLayerNumber();
237 int ladder = itSvdSensors->getLadderNumber();
238 int sensor = itSvdSensors->getSensorNumber();
242 if (!k && layer != 3) nstrips = 512;
244 double stripOcc[768];
245 for (
int i = 0; i < nstrips; i++) {stripOcc[i] = 0; hsflag[i] = 0;}
246 double stripOccAfterAbsCut[768];
247 (
hm_occupancy->getHistogram(*itSvdSensors, k))->Scale(1. / nevents);
248 for (
int l = 0; l < nstrips; l++) {
252 stripOcc[l] = (double)(
hm_occupancy->getHistogram(*itSvdSensors, k)->GetBinContent(l + 1));
255 occDBObjPtr->set(layer, ladder, sensor, k, l, stripOcc[l]);
256 hm_occAll->fill(*itSvdSensors, k, stripOcc[l]);
260 stripOccAfterAbsCut[l] = 0;
263 stripOccAfterAbsCut[l] = stripOcc[l];
266 B2DEBUG(1,
"Measured strip occupancy for strip " << l <<
":" << stripOccAfterAbsCut[l]);
272 while (moreHS &&
theHSFinder(stripOccAfterAbsCut, hsflag, nstrips)) {
273 moreHS =
theHSFinder(stripOccAfterAbsCut, hsflag, nstrips);
277 for (
int l = 0; l < nstrips; l++) {
278 hotStripsDBObjPtr->set(layer, ladder, sensor, k, l, (
int)hsflag[l]);
279 if (hsflag[l] == 0) {
280 hm_occupancy_after->getHistogram(*itSvdSensors, k)->SetBinContent(l + 1, stripOccAfterAbsCut[l]);
281 hm_occAfter->fill(*itSvdSensors, k, stripOccAfterAbsCut[l]);
283 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetBinContent(l + 1, 1);
284 hm_occHot->fill(*itSvdSensors, k, stripOcc[l]);
286 TString aux_side =
"V/N";
287 if (k) aux_side =
"U/P";
288 if (
m_verbose) B2RESULT(
"HS found, occupancy = " << stripOcc[l] <<
", Layer: " << layer <<
" Ladder: " << ladder <<
" Sensor: "
290 " Side: " << k <<
" channel: " << l);
296 for (
int s = 0; s <
hm_hot_strips->getHistogram(*itSvdSensors, k)->GetEntries(); s++)
300 dir_occuL[layer - 3]->cd();
302 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetLineColor(kBlack);
303 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetMarkerColor(kBlack);
304 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetFillStyle(3001);
305 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetFillColor(kBlack);
310 hm_occAll->getHistogram(*itSvdSensors, k)->Write();
311 hm_occHot->getHistogram(*itSvdSensors, k)->SetLineColor(kBlack);
312 hm_occHot->getHistogram(*itSvdSensors, k)->SetFillStyle(3001);
313 hm_occHot->getHistogram(*itSvdSensors, k)->SetFillColor(kBlack);
314 hm_occHot->getHistogram(*itSvdSensors, k)->SetMarkerColor(kBlack);
315 hm_occHot->getHistogram(*itSvdSensors, k)->Write();
316 hm_occAfter->getHistogram(*itSvdSensors, k)->SetLineColor(kRed);
317 hm_occAfter->getHistogram(*itSvdSensors, k)->SetMarkerColor(kRed);
318 hm_occAfter->getHistogram(*itSvdSensors, k)->Write();
321 B2DEBUG(1,
" L" << layer <<
"." << ladder <<
"." << sensor <<
".isU=" << k);
350 hotStripsDBObjPtr.
import(iov);
351 B2RESULT(
"Imported to database.");
358 TDirectory* oldDir =
nullptr;
360 TDirectory* dir_occuL[4] = {
nullptr,
nullptr,
nullptr,
nullptr};
366 dir_occuL[0] = oldDir->mkdir(
"layer3");
367 dir_occuL[1] = oldDir->mkdir(
"layer4");
368 dir_occuL[2] = oldDir->mkdir(
"layer5");
369 dir_occuL[3] = oldDir->mkdir(
"layer6");
385 B2DEBUG(1,
"number of events " << nevents);
389 std::set<Belle2::VxdID>::iterator itSvdLayers = svdLayers.begin();
391 while ((itSvdLayers != svdLayers.end())
392 && (itSvdLayers->getLayerNumber() != 7)) {
394 std::set<Belle2::VxdID> svdLadders = aGeometry.
getLadders(*itSvdLayers);
395 std::set<Belle2::VxdID>::iterator itSvdLadders = svdLadders.begin();
397 while (itSvdLadders != svdLadders.end()) {
399 std::set<Belle2::VxdID> svdSensors = aGeometry.
getSensors(*itSvdLadders);
400 std::set<Belle2::VxdID>::iterator itSvdSensors = svdSensors.begin();
402 while (itSvdSensors != svdSensors.end()) {
404 for (
int k = 0; k <
m_nSides; k ++) {
407 int i = itSvdSensors->getLayerNumber() - 3;
408 int m = itSvdSensors->getLadderNumber() - 1;
409 int j = itSvdSensors->getSensorNumber() - 1;
410 float position1[768];
415 for (
int l = 0; l < 24; l++) {
419 for (
int l = 0; l < 768; l++) {
421 position1[l] =
hm_occupancy->getHistogram(*itSvdSensors, k)->GetBinContent(l + 1);
424 if (position1[l] == 0) { flag[l] = 0;}
429 div_t test = div(l, ibase);
430 nCltrk[test.quot] = nCltrk[test.quot] + position1[l];
435 for (
int l = 0; l < 768; l++) {
436 div_t test = div(l, ibase);
441 float tmp_occ = position1[l] / (float)nCltrk[test.quot];
442 float tmp_occ1 = position1[l] / (float)nevents;
443 position1[l] = tmp_occ;
445 hm_dist->fill(*itSvdSensors, k, tmp_occ);
447 hm_dist1->fill(*itSvdSensors, k, tmp_occ1);
449 hm_dist12->fill(*itSvdSensors, k, tmp_occ, tmp_occ1);
454 for (
int l = 0; l < 24; l++) {
460 for (
int l = 0; l < 768; l++) {
461 div_t test = div(l, ibase);
462 float threshold_corrections = 1.0;
466 threshold_corrections = threshold_corrections *
sqrt(768.0 / (
float)it1st);
467 if (ibase == 32) threshold_corrections = 24.0;
468 if (ibase == 64) threshold_corrections = 12.0;
469 if (ibase == 128) threshold_corrections = 6.0;
471 if (position1[l] > 0.01 *
m_thr * threshold_corrections) {
475 B2RESULT(
"1st pass HS found! Layer: " << i + 3 <<
" Ladder: " << m <<
" Sensor: " << j <<
" Side: " << k <<
" channel: " << l);
479 occupancy[test.quot] = occupancy[test.quot] +
hm_occupancy->getHistogram(*itSvdSensors, k)->GetBinContent(l + 1);
488 for (
int l = 0; l < 768; l++) {
489 div_t test = div(l, ibase);
490 position1[l] = position1[l] * nCltrk[test.quot] / (float)occupancy[test.quot];
491 float threshold_corrections = 1.0;
492 threshold_corrections = threshold_corrections *
sqrt(768.0 / (
float)it);
493 if (ibase == 32) threshold_corrections = 24.0;
494 if (ibase == 64) threshold_corrections = 12.0;
495 if (ibase == 128) threshold_corrections = 6.0;
497 if ((flag[l]) && (position1[l] > 0.01 *
m_thr * threshold_corrections)) {
501 B2RESULT(
"2nd pass HS FOUND! Layer: " << i + 3 <<
" Ladder: " << m <<
" Sensor: " << j <<
" Side: " << k <<
" channel: " << l);
508 for (
int l = 0; l < 768; l++) {
510 B2DEBUG(1, hsflag[l]);
512 float tmpOcc =
hm_occupancy->getHistogram(*itSvdSensors, k)->GetBinContent(l + 1) / (double)nevents;
513 hm_occAll->fill(*itSvdSensors, k, tmpOcc);
515 if (hsflag[l] == 0) {
519 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetBinContent(l + 1, 1);
520 hm_occHot->fill(*itSvdSensors, k, tmpOcc);
525 hm_occupancy->getHistogram(*itSvdSensors, k)->Scale(1.0 / (
double)nevents);
529 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetLineColor(kBlack);
530 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetFillStyle(3001);
531 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetFillColor(kBlack);
532 hm_hot_strips->getHistogram(*itSvdSensors, k)->SetMarkerColor(kBlack);
537 hm_occAll->getHistogram(*itSvdSensors, k)->Write();
538 hm_occHot->getHistogram(*itSvdSensors, k)->SetLineColor(kBlack);
539 hm_occHot->getHistogram(*itSvdSensors, k)->SetFillStyle(3001);
540 hm_occHot->getHistogram(*itSvdSensors, k)->SetFillColor(kBlack);
541 hm_occHot->getHistogram(*itSvdSensors, k)->SetMarkerColor(kBlack);
542 hm_occHot->getHistogram(*itSvdSensors, k)->Write();
543 hm_occAfter->getHistogram(*itSvdSensors, k)->SetLineColor(kRed);
544 hm_occAfter->getHistogram(*itSvdSensors, k)->SetMarkerColor(kRed);
545 hm_occAfter->getHistogram(*itSvdSensors, k)->Write();
549 B2DEBUG(1,
" side " << i <<
" " << j <<
" " << m <<
" " << k);
556 for (
int iy = 0; iy < iths; iy++) {
561 for (
int s = 0; s <
hm_hot_strips->getHistogram(*itSvdSensors, k)->GetEntries(); s++)
582 while ((obj = nextH_occu()))