11 #include <top/modules/collectors/TOPCommonT0BFCollectorModule.h>
12 #include <top/geometry/TOPGeometryPar.h>
40 setDescription(
"A collector for common T0 calibration with a fit of bunch finder residuals (method BF)");
41 setPropertyFlags(c_ParallelProcessingCertified);
44 addParam(
"bunchesPerSSTclk", m_bunchesPerSSTclk,
45 "number of bunches per SST clock period", 24);
46 addParam(
"nx", m_nx,
"number of histogram bins", 200);
51 void TOPCommonT0BFCollectorModule::prepare()
54 m_recBunch.isRequired();
56 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
57 m_bunchTimeSep = geo->getNominalTDC().getSyncTimeBase() / m_bunchesPerSSTclk;
59 auto h1a =
new TH1F(
"offset_a",
"current offset; offset [ns]",
60 m_nx, -m_bunchTimeSep / 2, m_bunchTimeSep / 2);
61 registerObject<TH1F>(
"offset_a", h1a);
63 auto h1b =
new TH1F(
"offset_b",
"current offset; offset [ns]",
64 m_nx, 0.0, m_bunchTimeSep);
65 registerObject<TH1F>(
"offset_b", h1b);
70 void TOPCommonT0BFCollectorModule::collect()
73 if (not m_recBunch.isValid())
return;
74 if (not m_recBunch->isReconstructed())
return;
75 if (m_recBunch->getNumTracks() != 2)
return;
77 auto h1a = getObjectPtr<TH1F>(
"offset_a");
78 auto h1b = getObjectPtr<TH1F>(
"offset_b");
79 auto offset = m_recBunch->getCurrentOffset();
80 if (m_commonT0->isCalibrated()) offset += m_commonT0->getT0();
83 auto a = offset - round(offset / m_bunchTimeSep) * m_bunchTimeSep;
87 auto b = offset - round(offset / m_bunchTimeSep - 0.5) * m_bunchTimeSep;