63 mTimeClusterWidth =
param.maxClusterWidth;
64 mNbinsInOneWindow =
param.peakSearchNbins;
65 mMinDigitPerROF =
param.minDigitsPerROF;
66 mOnlyTrackable =
param.onlyTrackable;
67 mPeakSearchSignalOnly =
param.peakSearchSignalOnly;
68 mIRFramesOnly =
param.irFramesOnly;
70 mROFRejectionFraction =
param.rofRejectionFraction;
73 fair::Logger::SetConsoleColor(
true);
76 if (mNbinsInOneWindow < 3) {
77 mNbinsInOneWindow = 3;
80 if ((mNbinsInOneWindow % 2) == 0) {
81 mNbinsInOneWindow += 1;
83 if (mROFRejectionFraction > 0) {
84 std::random_device
rd;
85 mGenerator = std::mt19937(
rd());
88 LOGP(info,
"TimeClusterWidth : {}", mTimeClusterWidth);
89 LOGP(info,
"BinsInOneWindow : {} ", mNbinsInOneWindow);
90 LOGP(info,
"MinDigitPerROF : {}", mMinDigitPerROF);
91 LOGP(info,
"OnlyTrackable : {}", mOnlyTrackable);
92 LOGP(info,
"PeakSearchSignalOnly : {}", mPeakSearchSignalOnly);
93 LOGP(info,
"IRFramesOnly : {}", mIRFramesOnly);
94 LOGP(info,
"ROFRejectionFraction : {}", mROFRejectionFraction);
96 auto stop = [
this]() {
98 LOGP(info,
"duration = {} us / TF", mTimeProcess.count() * 1000 / mTFcount);
106 return [
this, rejectionFraction](
const ROFRecord& ) {
107 double rnd = mDistribution(mGenerator);
108 return rnd > rejectionFraction;
115 auto rofs = pc.
inputs().
get<gsl::span<o2::mch::ROFRecord>>(
"rofs");
121 LOGP(warning,
"{:=>60} ", fmt::format(
"{:6d} Input ROFS", rofs.size()));
124 auto tStart = std::chrono::high_resolution_clock::now();
125 rofProcessor.process();
126 auto tEnd = std::chrono::high_resolution_clock::now();
127 mTimeProcess += tEnd - tStart;
130 LOGP(warning,
"{:=>60} ", fmt::format(
"{:6d} Output ROFS", rofProcessor.getROFRecords().size()));
134 const auto& pRofs = rofProcessor.getROFRecords();
137 std::vector<ROFFilter> filters;
139 if (mOnlyTrackable) {
142 std::array<bool, 5> requestStation{
143 trackerParam.requestStation[0],
144 trackerParam.requestStation[1],
145 trackerParam.requestStation[2],
146 trackerParam.requestStation[3],
147 trackerParam.requestStation[4]};
150 trackerParam.moreCandidates));
152 if (mMinDigitPerROF > 0) {
158 auto irFrames = pc.
inputs().
get<gsl::span<o2::dataformats::IRFrame>>(
"irframes");
162 std::string extraMsg =
"";
164 if (mROFRejectionFraction > 0) {
166 extraMsg = fmt::format(
" (CAUTION : hard-rejected {:3.0f}% of the output ROFs)", mROFRejectionFraction * 100);
172 std::copy_if(begin(pRofs),
174 std::back_inserter(outRofs),
177 const float p1 = rofs.size() > 0 ? 100. * pRofs.size() / rofs.size() : 0;
178 const float p2 = rofs.size() > 0 ? 100. * outRofs.size() / rofs.size() : 0;
181 "TF {} Processed {} input ROFs, "
182 "time-clusterized them into {} ROFs ({:3.0f}%) "
183 "and output {} ({:3.0f}%) of them{}",
184 mTFcount, rofs.size(),
186 outRofs.size(),
p2, extraMsg);
191 std::chrono::duration<double, std::milli>
194 uint32_t mTimeClusterWidth;
195 uint32_t mNbinsInOneWindow;
199 bool mPeakSearchSignalOnly;
202 float mROFRejectionFraction;
203 std::uniform_real_distribution<double> mDistribution{0.0, 1.0};
204 std::mt19937 mGenerator;
210 std::string_view inputDigitDataDescription,
211 std::string_view inputDigitRofDataDescription,
212 std::string_view outputDigitRofDataDescription,
213 std::string_view inputIRFrameDataDescription)
215 std::string input = fmt::format(
"rofs:MCH/{}/0;digits:MCH/{}/0",
216 inputDigitRofDataDescription.data(),
217 inputDigitDataDescription.data());
219 LOGP(info,
"will select IRFrames from {}", inputIRFrameDataDescription);
220 input +=
";irframes:";
221 input += inputIRFrameDataDescription;
223 std::string
output = fmt::format(
"rofs:MCH/{}/0", outputDigitRofDataDescription.data());
225 std::vector<OutputSpec> outputs;
227 for (
auto& matcher : matchers) {
236 Options{{
"mch-debug", VariantType::Bool,
false, {
"enable verbose output"}}}};
constexpr int p1()
constexpr to accelerate the coordinates changing
Class to delimit start and end IR of certain time period.
Configurable parameters for MCH tracking.
Class to group the fired pads according to their time stamp.
Definition of a data processor to run the time clusterizer.
static const TimeClusterizerParam & Instance()
T get(const char *key) const
decltype(auto) make(const Output &spec, Args... args)
ServiceRegistryRef services()
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
ROFFilter createRandomRejectionFilter(float rejectionFraction)
void init(framework::InitContext &ic)
void run(framework::ProcessingContext &pc)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > select(char const *matcher="")
std::vector< InputSpec > Inputs
std::function< bool(const ROFRecord &)> ROFFilter
ROFFilter createMultiplicityFilter(int minMultiplicity)
ROFFilter createROFFilter(gsl::span< const ROFFilter > filters)
o2::framework::DataProcessorSpec getTimeClusterFinderSpec(const char *specName="mch-time-cluster-finder", std::string_view inputDigitDataDescription="F-DIGITS", std::string_view inputDigitRofDataDescription="F-DIGITROFS", std::string_view outputDigitRofDataDescription="TC-F-DIGITROFS", std::string_view inputIRFrameDataDescription="ITS/IRFRAMES")
ROFFilter createIRFrameFilter(gsl::span< const o2::dataformats::IRFrame > irframes)
ROFFilter createTrackableFilter(gsl::span< const T > items, std::array< bool, 5 > requestStation={true, true, true, true, true}, bool moreCandidates=false)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
static OutputSpec asOutputSpec(InputSpec const &spec)
std::vector< Digit > digits