1 #include <svd/modules/svdPerformance/SVDClusterEvaluationModule.h>
2 #include <tracking/dataobjects/RecoTrack.h>
9 SVDClusterEvaluationModule::SVDClusterEvaluationModule():
Module()
18 setDescription(
"This module check performances of SVD reconstruction of VXD TB data");
20 addParam(
"outputFileName",
m_rootFileName,
"Name of output root file.", std::string(
"SVDClusterEvaluation_output.root"));
22 addParam(
"LayerUnderStudy", m_theLayer,
"Number of the layer under study. If 0, then all layers are plotted",
int(0));
23 addParam(
"InterceptSigmaMax", m_interSigmaMax,
24 "Max of the histogram that contains the intercept statistical error. Default is OK for Phase2.",
double(0.35));
25 addParam(
"uFiducialLength", m_uFiducial,
26 "length to be subtracted from the U-edge to consider intercepts inside the sensor. Positive values reduce the area; negative values increase the area",
28 addParam(
"vFiducialLength", m_vFiducial,
29 "length to be subtracted from the V-edge to consider intercepts inside the sensor. Positive values reduce the area; negative values increase the area",
31 addParam(
"efficiency_nSigma", m_nSigma,
" number of residual sigmas for the determination of the efficiency",
float(5));
32 addParam(
"efficiency_halfWidth", m_halfWidth,
" window half width for the determination of the efficiency",
float(0.05));
34 addParam(
"InterceptsName", m_InterceptName,
"Name of Intercept Store Array.", std::string(
""));
36 addParam(
"UbinWidth", m_UbinWidth,
"Histograms U-bin width (in um)",
double(10));
37 addParam(
"VbinWidth", m_VbinWidth,
"Histograms V-bin width (in um)",
double(10));
38 addParam(
"groupNstrips", m_groupNstrips,
"How many strips group together in the 2D residual VS position plot",
int(128));
41 SVDClusterEvaluationModule::~SVDClusterEvaluationModule()
73 m_tree =
new TTree(
"tree",
"RECREATE");
137 B2DEBUG(10,
"Empty histograms have beein created");
161 m_run = meta->getRun();
174 B2DEBUG(10,
"this intercept is related to a good track");
198 B2DEBUG(10,
"intercept is inside fiducial area");
204 double minresidU = 999;
205 bool minfoundU =
false;
206 double minresidV = 999;
207 bool minfoundV =
false;
227 if (clVxdID != theVxdID)
230 double interCoor = coorV;
238 double resid = interCoor - clPos;
244 if (fabs(resid) < fabs(minresidU)) {
250 if (fabs(resid) < fabs(minresidV)) {
313 const int Nsensors = 172;
316 float residU[Nsensors];
317 float residV[Nsensors];
318 float misU[Nsensors];
319 float misV[Nsensors];
322 float effU[Nsensors];
323 float effV[Nsensors];
324 float effUErr[Nsensors];
325 float effVErr[Nsensors];
326 TString sensorU[Nsensors];
327 TString sensorV[Nsensors];
329 for (
int i = 0; i < Nsensors; i++) {
346 TH1F* h_residU =
new TH1F(
"hResidU",
"U Residuals", 1, 0, 1);
347 h_residU->SetCanExtend(TH1::kAllAxes);
348 h_residU->SetStats(0);
349 h_residU->GetXaxis()->SetTitle(
"sensor");
350 h_residU->GetYaxis()->SetTitle(
"U residuals (#mum)");
351 TH1F* h_residV =
new TH1F(
"hResidV",
"V Residuals", 1, 0, 1);
352 h_residV->SetCanExtend(TH1::kAllAxes);
353 h_residV->SetStats(0);
354 h_residV->GetXaxis()->SetTitle(
"sensor");
355 h_residV->GetYaxis()->SetTitle(
"V residuals (#mum)");
357 TH1F* h_statU =
new TH1F(
"hStatU",
"U Intercept Statistical Error", 1, 0, 1);
358 h_statU->SetCanExtend(TH1::kAllAxes);
359 h_statU->SetStats(0);
360 h_statU->GetXaxis()->SetTitle(
"sensor");
361 h_statU->GetYaxis()->SetTitle(
"U extrap. error (#mum)");
362 TH1F* h_statV =
new TH1F(
"hStatV",
"V Intercept Statistical Error", 1, 0, 1);
363 h_statV->SetCanExtend(TH1::kAllAxes);
364 h_statV->SetStats(0);
365 h_statV->GetXaxis()->SetTitle(
"sensor");
366 h_statV->GetYaxis()->SetTitle(
"V extrap. error (#mum)");
368 TH1F* h_misU =
new TH1F(
"hMisU",
"U Residual Misalignment", 1, 0, 1);
369 h_misU->SetCanExtend(TH1::kAllAxes);
371 h_misU->GetXaxis()->SetTitle(
"sensor");
372 h_misU->GetYaxis()->SetTitle(
"U misalignment (#mum)");
373 TH1F* h_misV =
new TH1F(
"hMisV",
"V Residual Misalignment", 1, 0, 1);
374 h_misV->SetCanExtend(TH1::kAllAxes);
376 h_misV->GetXaxis()->SetTitle(
"sensor");
377 h_misV->GetYaxis()->SetTitle(
"V misalignment (#mum)");
380 TH1F* h_effU =
new TH1F(
"hEffU", Form(
"U-Side Summary, %.1f#sigma or #pm%.1f mm",
m_nSigma,
m_halfWidth * 10), 1, 0, 1);
381 h_effU->SetCanExtend(TH1::kAllAxes);
383 h_effU->GetXaxis()->SetTitle(
"sensor");
384 h_effU->GetYaxis()->SetTitle(
"U efficiency");
385 TH1F* h_effV =
new TH1F(
"hEffV", Form(
"V-Side Summary, %.1f#sigma or #pm%.1f mm",
m_nSigma,
m_halfWidth * 10), 1, 0, 1);
386 h_effV->SetCanExtend(TH1::kAllAxes);
388 h_effV->GetXaxis()->SetTitle(
"sensor");
389 h_effV->GetYaxis()->SetTitle(
"V efficiency");
391 TDirectory* oldDir = gDirectory;
396 int currentLayer = layer.getLayerNumber();
402 TString interName = Form(
"interceptsL%d", layer.getLayerNumber());
403 TString clsName = Form(
"clustersL%d", layer.getLayerNumber());
404 TString residName = Form(
"residualsL%d", layer.getLayerNumber());
405 TDirectory* dir_inter = oldDir->mkdir(interName.Data());
406 TDirectory* dir_cls = oldDir->mkdir(clsName.Data());
407 TDirectory* dir_resid = oldDir->mkdir(residName.Data());
430 sensorU[s] = Form(
"%d.%d.%dU", currentLayer, ladder.getLadderNumber(), sensor.getSensorNumber());
431 B2DEBUG(10,
"U-side efficiency for " << currentLayer <<
"." << ladder.getLadderNumber() <<
"." << sensor.getSensorNumber());
433 if (res->GetEntries() > 0) {
435 res->GetQuantiles(1, &median, &q);
440 float halfWindow =
m_nSigma * residU[s];
444 int binMin = res->FindBin(misU[s] - halfWindow);
445 int binMax = res->FindBin(misU[s] + halfWindow);
446 B2DEBUG(10,
"from " << misU[s] - halfWindow <<
" -> binMin = " << binMin);
447 B2DEBUG(10,
"to " << misU[s] + halfWindow <<
" -> binMax = " << binMax);
450 for (
int bin = binMin; bin < binMax + 1; bin++)
451 num = num + res->GetBinContent(bin);
454 for (
int bin = 1; bin < binMin; bin++)
455 bkg = bkg + res->GetBinContent(bin);
456 for (
int bin = binMax; bin < res->GetNbinsX() + 1; bin++)
457 bkg = bkg + res->GetBinContent(bin);
459 num = num - bkg * (binMax - binMin + 1.) / (binMin + res->GetNbinsX() - binMax - 1);
464 h_effU->Fill(sensorU[s], effU[s]);
466 B2WARNING(
"something is wrong! efficiency greater than 1: " << num <<
"/" <<
ms_nIntercepts);
469 B2DEBUG(10,
"num = " << num);
471 B2RESULT(
"U-side efficiency for " << currentLayer <<
"." << ladder.getLadderNumber() <<
"." << sensor.getSensorNumber() <<
" = " <<
472 effU[s] <<
" ± " << effUErr[s]);
496 sensorV[s] = Form(
"%d.%d.%dV", currentLayer, ladder.getLadderNumber(), sensor.getSensorNumber());
497 B2DEBUG(10,
"V-side efficiency for " << currentLayer <<
"." << ladder.getLadderNumber() <<
"." << sensor.getSensorNumber());
499 if (res->GetEntries() > 0) {
501 res->GetQuantiles(1, &median, &q);
507 float halfWindow =
m_nSigma * residV[s];
511 int binMin = res->FindBin(misV[s] - halfWindow);
512 int binMax = res->FindBin(misV[s] + halfWindow);
513 B2DEBUG(10,
"from " << misV[s] - halfWindow <<
" -> binMin = " << binMin);
514 B2DEBUG(10,
"to " << misV[s] + halfWindow <<
" -> binMax = " << binMax);
518 for (
int bin = binMin; bin < binMax + 1; bin++)
519 num = num + res->GetBinContent(bin);
522 for (
int bin = 1; bin < binMin; bin++)
523 bkg = bkg + res->GetBinContent(bin);
524 for (
int bin = binMax; bin < res->GetNbinsX() + 1; bin++)
525 bkg = bkg + res->GetBinContent(bin);
527 num = num - bkg * (binMax - binMin + 1.) / (binMin + res->GetNbinsX() - binMax - 1);
532 h_effV->Fill(sensorV[s], effV[s]);
534 B2WARNING(
"something is wrong! efficiency greater than 1: " << num <<
"/" <<
ms_nIntercepts);
537 B2DEBUG(10,
"num = " << num);
539 B2RESULT(
"V-side efficiency for " << currentLayer <<
"." << ladder.getLadderNumber() <<
"." << sensor.getSensorNumber() <<
" = " <<
540 effV[s] <<
" ± " << effVErr[s]);
565 B2DEBUG(50,
"writing out resid histograms for " << sensor.getLayerNumber() <<
"." << sensor.getLadderNumber() <<
"." <<
566 sensor.getSensorNumber() <<
"." << view);
583 for (
int bin = 0; bin < h_residU->GetNbinsX(); bin++)
584 h_residU->SetBinError(bin, 0.);
586 for (
int bin = 0; bin < h_residV->GetNbinsX(); bin++)
587 h_residV->SetBinError(bin, 0.);
589 for (
int bin = 0; bin < h_statU->GetNbinsX(); bin++)
590 h_statU->SetBinError(bin, 0.);
592 for (
int bin = 0; bin < h_statV->GetNbinsX(); bin++)
593 h_statV->SetBinError(bin, 0.);
595 for (
int bin = 0; bin < h_misU->GetNbinsX(); bin++)
596 h_misU->SetBinError(bin, 0.);
598 for (
int bin = 0; bin < h_misV->GetNbinsX(); bin++)
599 h_misV->SetBinError(bin, 0.);
601 for (
int bin = 0; bin < h_effU->GetNbinsX(); bin++)
602 h_effU->SetBinError(bin, 0.);
604 for (
int bin = 0; bin < h_effV->GetNbinsX(); bin++)
605 h_effV->SetBinError(bin, 0.);
618 if (theRC.
size() == 0)
623 if (theTrack.
size() == 0)
634 TH2F h_coorUV_LargeSensor(
"interCoor_Large_L@layerL@ladderS@sensor",
635 "Intercept 2D Coordinate (layer @layer, ladder @ladder, sensor @sensor)",
638 h_coorUV_LargeSensor.GetXaxis()->SetTitle(
"Intercept U coordinate (cm)");
639 h_coorUV_LargeSensor.GetYaxis()->SetTitle(
"Intercept V coordinate (cm)");
641 TH2F h_coorUV_SmallSensor(
"interCoor_Small_L@layerL@ladderS@sensor",
642 "Intercept 2D Coordinate (layer @layer, ladder @ladder, sensor @sensor)",
645 h_coorUV_SmallSensor.GetXaxis()->SetTitle(
"Intercept U coordinate (cm)");
646 h_coorUV_SmallSensor.GetYaxis()->SetTitle(
"Intercept V coordinate (cm)");
656 TH1F h_sigmaU(
"interSigmaU_L@layerL@ladderS@sensor@view",
657 "U Intercept Sigma (layer @layer, ladder @ladder, sensor @sensor)",
659 h_sigmaU.GetXaxis()->SetTitle(
"Intercept U Error (cm)");
661 TH1F h_sigmaV(
"interSigmaV_L@layerL@ladderS@sensor@view",
662 "V Intercept Sigma (layer @layer, ladder @ladder, sensor @sensor)",
664 h_sigmaV.GetXaxis()->SetTitle(
"Intercept V Error (cm)");
675 TH1F h_clcoorU_LargeSensor(
"clsCoorU_LS_L@layerL@ladderS@sensor@view",
676 "Cluster U Coordinate (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
678 h_clcoorU_LargeSensor.GetXaxis()->SetTitle(
"Cluster U coordinate (cm)");
680 TH1F h_clcoorV_LargeSensor(
"clsCoorV_LS_L@layerL@ladderS@sensor@view",
681 "Cluster V Coordinate (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
683 h_clcoorV_LargeSensor.GetXaxis()->SetTitle(
"Cluster V coordinate (cm)");
685 TH1F h_clcoorU_SmallSensor(
"clsCoorU_SS_L@layerL@ladderS@sensor@view",
686 "Cluster U Coordinate (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
688 h_clcoorU_SmallSensor.GetXaxis()->SetTitle(
"Cluster U coordinate (cm)");
690 TH1F h_clcoorV_SmallSensor(
"clsCoorV_SS_L@layerL@ladderS@sensor@view",
691 "Cluster V Coordinate (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
693 h_clcoorV_SmallSensor.GetXaxis()->SetTitle(
"Cluster V coordinate (cm)");
708 TH1F h_clresidU_LargeSensor(
"clsResidU_LS_L@layerL@ladderS@sensor@view",
709 "U Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
711 NbinsU, -range, range);
712 h_clresidU_LargeSensor.GetXaxis()->SetTitle(
"residual (cm)");
714 TH1F h_clresidV_LargeSensor(
"clsResidV_LS_L@layerL@ladderS@sensor@view",
715 "V Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
717 NbinsV, -range, range);
718 h_clresidV_LargeSensor.GetXaxis()->SetTitle(
"residual (cm)");
720 TH1F h_clresidU_SmallSensor(
"clsResidU_SS_L@layerL@ladderS@sensor@view",
721 "U Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
723 NbinsU, -range, range);
724 h_clresidU_SmallSensor.GetXaxis()->SetTitle(
"residual (cm)");
726 TH1F h_clresidV_SmallSensor(
"clsResidV_SS_L@layerL@ladderS@sensor@view",
727 "V Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
729 NbinsU, -range, range);
730 h_clresidV_SmallSensor.GetXaxis()->SetTitle(
"residual (cm)");
735 h_clresidV_LargeSensor);
741 TH2F h2_clresidU_LargeSensor(
"clsResid2DU_LS_L@layerL@ladderS@sensor@view",
742 "U Cluster Residuals VS U Cluster Position(layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
744 h2_clresidU_LargeSensor.GetYaxis()->SetTitle(
"residual (cm)");
745 h2_clresidU_LargeSensor.GetXaxis()->SetTitle(
"cluster position (cm)");
747 TH2F h2_clresidV_LargeSensor(
"clsResid2DV_LS_L@layerL@ladderS@sensor@view",
748 "V Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
750 h2_clresidV_LargeSensor.GetYaxis()->SetTitle(
"residual (cm)");
751 h2_clresidV_LargeSensor.GetXaxis()->SetTitle(
"cluster position (cm)");
753 TH2F h2_clresidU_SmallSensor(
"clsResid2DU_SS_L@layerL@ladderS@sensor@view",
754 "U Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
756 h2_clresidU_SmallSensor.GetYaxis()->SetTitle(
"residual (cm)");
757 h2_clresidU_SmallSensor.GetXaxis()->SetTitle(
"cluster position (cm)");
759 TH2F h2_clresidV_SmallSensor(
"clsResid2DV_SS_L@layerL@ladderS@sensor@view",
760 "V Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
762 h2_clresidV_SmallSensor.GetYaxis()->SetTitle(
"residual (cm)");
763 h2_clresidV_SmallSensor.GetXaxis()->SetTitle(
"cluster position (cm)");
766 h2_clresidV_LargeSensor);
770 TH1F h_clminresidU_LargeSensor(
"clsMinResidU_LS_L@layerL@ladderS@sensor@view",
771 "U Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
773 NbinsU, -range, range);
774 h_clminresidU_LargeSensor.GetXaxis()->SetTitle(
"residual (cm)");
776 TH1F h_clminresidV_LargeSensor(
"clsMinResidV_LS_L@layerL@ladderS@sensor@view",
777 "V Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
779 NbinsV, -range, range);
780 h_clminresidV_LargeSensor.GetXaxis()->SetTitle(
"residual (cm)");
782 TH1F h_clminresidU_SmallSensor(
"clsMinResidU_SS_L@layerL@ladderS@sensor@view",
783 "U Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
785 NbinsU, -range, range);
786 h_clminresidU_SmallSensor.GetXaxis()->SetTitle(
"residual (cm)");
788 TH1F h_clminresidV_SmallSensor(
"clsMinResidV_SS_L@layerL@ladderS@sensor@view",
789 "V Cluster Residuals (layer @layer, ladder @ladder, sensor @sensor, side@view/@side)",
791 NbinsU, -range, range);
792 h_clminresidV_SmallSensor.GetXaxis()->SetTitle(
"residual (cm)");
797 h_clminresidV_LargeSensor);
806 TH1F* h1_res = (TH1F*)h1->Clone(
"h1_res");
807 double probs[2] = {0.16, 1 - 0.16};
808 double quant[2] = {0, 0};
809 int nbinsHisto = h1_res->GetNbinsX();
810 h1_res->SetBinContent(1, h1_res->GetBinContent(0) + h1_res->GetBinContent(1));
811 h1_res->SetBinContent(nbinsHisto, h1_res->GetBinContent(nbinsHisto) + h1_res->GetBinContent(nbinsHisto + 1));
812 h1_res->SetBinContent(0, 0);
813 h1_res->SetBinContent(nbinsHisto + 1, 0);
814 h1_res->GetQuantiles(2, quant, probs);
816 return (-quant[0] + quant[1]) / 2;