12 #include <klm/calibration/KLMStripEfficiencyAlgorithm.h>
15 #include <klm/dataobjects/KLMChannelIndex.h>
29 m_AchievedPrecision = results.m_AchievedPrecision;
30 m_MatchedDigits = results.m_MatchedDigits;
31 m_ExtHits = results.m_ExtHits;
33 m_Efficiency =
new float[nPlanes];
34 m_ExtHitsPlane =
new int[nPlanes];
35 std::memcpy(m_Efficiency, results.m_Efficiency, nPlanes *
sizeof(
float));
36 std::memcpy(m_ExtHitsPlane, results.m_ExtHitsPlane, nPlanes *
sizeof(
int));
41 if (m_Efficiency !=
nullptr)
43 if (m_ExtHitsPlane !=
nullptr)
44 delete m_ExtHitsPlane;
68 TH1F* efficiencyHistogram =
69 new TH1F(
"plane_efficiency",
"KLM plane efficiency",
70 nPlanes, -0.5,
double(nPlanes) - 0.5);
71 std::shared_ptr<TH1F> matchedDigitsInPlane;
72 matchedDigitsInPlane = getObjectPtr<TH1F>(
"matchedDigitsInPlane");
74 std::shared_ptr<TH1F> allExtHitsInPlane;
75 allExtHitsInPlane = getObjectPtr<TH1F>(
"allExtHitsInPlane");
77 matchedDigitsInPlane.get()->Sumw2();
78 allExtHitsInPlane.get()->Sumw2();
79 efficiencyHistogram->Divide(matchedDigitsInPlane.get(),
80 allExtHitsInPlane.get(), 1, 1,
"B");
81 for (
int i = 0; i < nPlanes; ++i) {
86 bool notEnoughData =
false;
90 uint16_t plane = klmPlane.getKLMPlaneNumber();
92 int extHits = allExtHitsInPlane->GetBinContent(planeIndex + 1);
93 float efficiencyError = efficiencyHistogram->GetBinError(planeIndex + 1);
103 notEnoughData =
true;
107 notEnoughData =
true;
122 int section = klmChannel.getSection();
123 int sector = klmChannel.getSector();
124 int layer = klmChannel.getLayer();
125 int plane = klmChannel.getPlane();
126 int strip = klmChannel.getStrip();
127 uint16_t planeKLM = 0;
130 section, sector, layer, plane);
133 section, sector, layer, plane);
136 float efficiency = efficiencyHistogram->GetBinContent(planeIndex + 1);
137 float efficiencyError = efficiencyHistogram->GetBinError(planeIndex + 1);
141 section, sector, layer, plane, strip, efficiency, efficiencyError);
144 section, sector, layer, plane, strip, efficiency, efficiencyError);
152 matchedDigitsInPlane.get()->Write();
153 allExtHitsInPlane.get()->Write();
154 efficiencyHistogram->Write();
155 delete efficiencyHistogram;
164 float* efficiency)
const
168 for (
int i = 0; i < nPlanes; ++i) {
176 int* extHitsPlane)
const
180 for (
int i = 0; i < nPlanes; ++i) {
181 if (m_ExtHitsPlane[i] > 0 && extHitsPlane[i] == 0)