9 #include <top/modules/collectors/TOPOffsetCollectorModule.h>
10 #include <framework/logging/Logger.h>
32 TOPOffsetCollectorModule::TOPOffsetCollectorModule()
35 setDescription(
"A collector for eventT0 and fill pattern offset calibrations");
36 setPropertyFlags(c_ParallelProcessingCertified);
41 void TOPOffsetCollectorModule::prepare()
43 m_recBunch.isRequired();
44 m_eventT0.isRequired();
46 m_names[Const::SVD] =
"svdOffset";
47 m_names[Const::CDC] =
"cdcOffset";
48 for (
const auto& x : m_names) {
49 registerObject<TH1F>(x.second,
new TH1F(x.second.c_str(),
"Event T0 difference w.r.t TOP; #Delta T_{0} [ns]",
53 int RFBuckets = m_bunchStructure->getRFBucketsPerRevolution();
54 registerObject<TH1F>(
"fillPattern",
new TH1F(
"fillPattern",
"Fill pattern from DB; bucket number",
55 RFBuckets, 0, RFBuckets));
56 registerObject<TH1F>(
"recBuckets",
new TH1F(
"recBuckets",
"Reconstructed buckets; bucket number",
57 RFBuckets, 0, RFBuckets));
61 void TOPOffsetCollectorModule::collect()
65 if (m_bunchStructure->isSet()) {
66 auto h = getObjectPtr<TH1F>(
"fillPattern");
67 int RFBuckets = m_bunchStructure->getRFBucketsPerRevolution();
68 for (
int i = 0; i < RFBuckets; i++) {
69 if (m_bunchStructure->getBucket(i)) h->SetBinContent(i + 1, 1);
74 if (not m_recBunch->isReconstructed())
return;
76 for (
const auto& x : m_names) {
77 const auto& detector = x.first;
78 if (m_eventT0->hasTemporaryEventT0(detector)) {
79 auto eventT0s = m_eventT0->getTemporaryEventT0s(detector);
80 if (eventT0s.empty())
continue;
81 if (detector == Const::CDC and eventT0s.back().algorithm !=
"chi2")
continue;
82 double t0 = eventT0s.back().eventT0;
83 auto h = getObjectPtr<TH1F>(x.second);
84 h->Fill(t0 - m_recBunch->getTime());
88 auto h = getObjectPtr<TH1F>(
"recBuckets");
89 h->Fill(m_recBunch->getBucketNumber(0, m_bunchStructure->getRFBucketsPerRevolution()));
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.