9 #include <top/modules/collectors/TOPCommonT0BFCollectorModule.h>
10 #include <top/geometry/TOPGeometryPar.h>
35 TOPCommonT0BFCollectorModule::TOPCommonT0BFCollectorModule()
38 setDescription(
"A collector for common T0 calibration with a fit of bunch finder residuals (method BF)");
39 setPropertyFlags(c_ParallelProcessingCertified);
42 addParam(
"bunchesPerSSTclk", m_bunchesPerSSTclk,
43 "number of bunches per SST clock period", 24);
44 addParam(
"nx", m_nx,
"number of histogram bins", 200);
49 void TOPCommonT0BFCollectorModule::prepare()
52 m_recBunch.isRequired();
54 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
55 m_bunchTimeSep = geo->getNominalTDC().getSyncTimeBase() / m_bunchesPerSSTclk;
57 auto h1a =
new TH1F(
"offset_a",
"current offset; offset [ns]",
58 m_nx, -m_bunchTimeSep / 2, m_bunchTimeSep / 2);
59 registerObject<TH1F>(
"offset_a", h1a);
61 auto h1b =
new TH1F(
"offset_b",
"current offset; offset [ns]",
62 m_nx, 0.0, m_bunchTimeSep);
63 registerObject<TH1F>(
"offset_b", h1b);
68 void TOPCommonT0BFCollectorModule::collect()
71 if (not m_recBunch.isValid())
return;
72 if (not m_recBunch->isReconstructed())
return;
73 if (m_recBunch->getNumTracks() != 2)
return;
75 auto h1a = getObjectPtr<TH1F>(
"offset_a");
76 auto h1b = getObjectPtr<TH1F>(
"offset_b");
77 auto offset = m_recBunch->getCurrentOffset();
78 if (m_commonT0->isCalibrated()) offset += m_commonT0->getT0();
81 auto a = offset - round(offset / m_bunchTimeSep) * m_bunchTimeSep;
85 auto b = offset - round(offset / m_bunchTimeSep - 0.5) * m_bunchTimeSep;
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.