@@ -202,14 +202,14 @@ struct OnTheFlyTofPid {
202202 histos.add("iTOF/h2dTrackLengthInnerVsPt", "h2dTrackLengthInnerVsPt", kTH2F, {axisMomentumSmall, axisTrackLengthInner});
203203 histos.add("iTOF/h2dTrackLengthInnerRecoVsPt", "h2dTrackLengthInnerRecoVsPt", kTH2F, {axisMomentumSmall, axisTrackLengthInner});
204204 histos.add("iTOF/h2dDeltaTrackLengthInnerVsPt", "h2dDeltaTrackLengthInnerVsPt", kTH2F, {axisMomentumSmall, axisTrackDeltaLength});
205- histos.add("iTOF/h2HitMap", "h2HitMap", kTH2F, {{100 , -simConfig.innerTOFLength / 2, simConfig.innerTOFLength / 2}, {100 , 0, simConfig.innerTOFRadius * 2 * M_PI}});
205+ histos.add("iTOF/h2HitMap", "h2HitMap", kTH2F, {{1000 , -simConfig.innerTOFLength / 2, simConfig.innerTOFLength / 2}, {1000 , 0, simConfig.innerTOFRadius * 2 * M_PI}});
206206
207207 histos.add("oTOF/h2dVelocityVsMomentumOuter", "h2dVelocityVsMomentumOuter", kTH2F, {axisMomentum, axisVelocity});
208208 histos.add("oTOF/h2dVelocityVsRigidityOuter", "h2dVelocityVsRigidityOuter", kTH2F, {axisRigidity, axisVelocity});
209209 histos.add("oTOF/h2dTrackLengthOuterVsPt", "h2dTrackLengthOuterVsPt", kTH2F, {axisMomentumSmall, axisTrackLengthOuter});
210210 histos.add("oTOF/h2dTrackLengthOuterRecoVsPt", "h2dTrackLengthOuterRecoVsPt", kTH2F, {axisMomentumSmall, axisTrackLengthOuter});
211211 histos.add("oTOF/h2dDeltaTrackLengthOuterVsPt", "h2dDeltaTrackLengthOuterVsPt", kTH2F, {axisMomentumSmall, axisTrackDeltaLength});
212- histos.add("oTOF/h2HitMap", "h2HitMap", kTH2F, {{100 , -simConfig.outerTOFLength / 2, simConfig.outerTOFLength / 2}, {100 , 0, simConfig.outerTOFRadius * 2 * M_PI}});
212+ histos.add("oTOF/h2HitMap", "h2HitMap", kTH2F, {{1000 , -simConfig.outerTOFLength / 2, simConfig.outerTOFLength / 2}, {1000 , 0, simConfig.outerTOFRadius * 2 * M_PI}});
213213
214214 const AxisSpec axisPt{static_cast<int>(plotsConfig.nBinsP), 0.0f, +4.0f, "#it{p}_{T} (GeV/#it{c})"};
215215 const AxisSpec axisEta{static_cast<int>(plotsConfig.nBinsEta), -2.0f, +2.0f, "#eta"};
@@ -261,14 +261,31 @@ struct OnTheFlyTofPid {
261261 const float fractionInactive;
262262 const float magField;
263263
264- // TH2F* hHitMapInPixel = nullptr;
265- // TH2F* hHitMap = nullptr;
266264 TAxis* axisZ = nullptr;
267265 TAxis* axisRPhi = nullptr;
268266 TAxis* axisInPixelZ = nullptr;
269267 TAxis* axisInPixelRPhi = nullptr;
270268
269+ TH2F* hHitMapInPixel = nullptr;
270+ TH2F* hHitMapInPixelBefore = nullptr;
271+ TH2F* hHitMap = nullptr;
272+
271273 public:
274+ ~TOFLayerEfficiency()
275+ {
276+ hHitMap->SaveAs(Form("/tmp/%s.png", hHitMap->GetName()));
277+ hHitMapInPixel->SaveAs(Form("/tmp/%s.png", hHitMapInPixel->GetName()));
278+ hHitMapInPixelBefore->SaveAs(Form("/tmp/%s.png", hHitMapInPixelBefore->GetName()));
279+
280+ delete axisZ;
281+ delete axisRPhi;
282+ delete axisInPixelZ;
283+ delete axisInPixelRPhi;
284+ delete hHitMap;
285+ delete hHitMapInPixel;
286+ delete hHitMapInPixelBefore;
287+ }
288+
272289 TOFLayerEfficiency(float r, float l, std::array<float, 2> pDimensions, float fIA, float m)
273290 : layerRadius(r), layerLength(l), pixelDimensionZ(pDimensions[0]), pixelDimensionRPhi(pDimensions[1]), fractionInactive(fIA), magField(m)
274291 {
@@ -277,15 +294,22 @@ struct OnTheFlyTofPid {
277294 axisZ = new TAxis(static_cast<int>(layerLength / pixelDimensionZ), -layerLength / 2, layerLength);
278295 axisRPhi = new TAxis(static_cast<int>(circumference / pixelDimensionRPhi), 0.f, circumference);
279296
280- const float inactiveBorderRPhi = pixelDimensionRPhi * std::sqrt(fractionInactive);
281- const float inactiveBorderZ = pixelDimensionZ * std::sqrt(fractionInactive);
282- const double arrayRPhi[4] = {0.f, inactiveBorderRPhi, pixelDimensionRPhi - inactiveBorderRPhi, pixelDimensionRPhi};
297+ const float inactiveBorderRPhi = pixelDimensionRPhi * std::sqrt(fractionInactive) / 2;
298+ const float inactiveBorderZ = pixelDimensionZ * std::sqrt(fractionInactive) / 2;
299+ const double arrayRPhi[4] = {-pixelDimensionRPhi / 2, -pixelDimensionRPhi / 2 + inactiveBorderRPhi, pixelDimensionRPhi / 2 - inactiveBorderRPhi, pixelDimensionRPhi / 2};
300+ for (int i = 0; i < 4; i++) {
301+ LOG(info) << "arrayRPhi[" << i << "] = " << arrayRPhi[i];
302+ }
283303 axisInPixelRPhi = new TAxis(3, arrayRPhi);
284- const double arrayZ[4] = {0.f, inactiveBorderZ, pixelDimensionZ - inactiveBorderZ, pixelDimensionZ};
304+ const double arrayZ[4] = {-pixelDimensionZ / 2, -pixelDimensionZ / 2 + inactiveBorderZ, pixelDimensionZ / 2 - inactiveBorderZ, pixelDimensionZ / 2};
305+ for (int i = 0; i < 4; i++) {
306+ LOG(info) << "arrayZ[" << i << "] = " << arrayZ[i];
307+ }
285308 axisInPixelZ = new TAxis(3, arrayZ);
286309
287- // hHitMap = new TH2F(Form("hHitMap_R%.0f", layerRadius), "HitMap;z (cm); r#phi (cm)", 1000, -1000, 1000, 1000, -1000, 1000);
288- // hHitMapInPixel = new TH2F(Form("hHitMapInPixel_R%.0f", layerRadius), "HitMapInPixel;z (cm); r#phi (cm)", 1000, -10, 10, 1000, -10, 10);
310+ hHitMap = new TH2F(Form("hHitMap_R%.0f", layerRadius), "HitMap;z (cm); r#phi (cm)", 1000, -1000, 1000, 1000, -1000, 1000);
311+ hHitMapInPixel = new TH2F(Form("hHitMapInPixel_R%.0f", layerRadius), "HitMapInPixel;z (cm); r#phi (cm)", 1000, -10, 10, 1000, -10, 10);
312+ hHitMapInPixelBefore = new TH2F(Form("hHitMapInPixelBefore_R%.0f", layerRadius), "HitMapInPixel;z (cm); r#phi (cm)", 1000, -10, 10, 1000, -10, 10);
289313 }
290314
291315 bool isInTOFActiveArea(std::array<float, 3> hitPosition)
@@ -333,22 +357,23 @@ struct OnTheFlyTofPid {
333357 if (std::abs(localZ - axisZ->GetBinCenter(pixelIndexZ)) > axisZ->GetBinWidth(pixelIndexZ)) {
334358 // LOG(warning) << "Local hit difference in z is bigger than the pixel size";
335359 }
360+ hHitMapInPixelBefore->Fill(localZ, localRPhi);
336361 switch (axisInPixelRPhi->FindBin(localRPhi)) {
362+ case 0:
337363 case 1:
338364 case 3:
365+ case 4:
339366 return false;
340367 }
341368 switch (axisInPixelZ->FindBin(localZ)) {
369+ case 0:
342370 case 1:
343371 case 3:
372+ case 4:
344373 return false;
345374 }
346- // hHitMap->Fill(z, rphi);
347- // hHitMapInPixel->Fill(localZ, localRPhi);
348- // if (static_cast<int>(hHitMapInPixel->GetEntries()) % 100000 == 0) {
349- // hHitMap->SaveAs(Form("/tmp/%s.png", hHitMap->GetName()));
350- // hHitMapInPixel->SaveAs(Form("/tmp/%s.png", hHitMapInPixel->GetName()));
351- // }
375+ hHitMapInPixel->Fill(localZ, localRPhi);
376+ hHitMap->Fill(z, rphi);
352377 return true;
353378 }
354379
0 commit comments