Skip to content

Commit 7f30b03

Browse files
authored
MCH: introduce digit modifier in filtering workflow (#13924)
* [MCH] introduce digit modifier in filtering workflow The digit modifier allows to change the contents of the digits in the filtering step. It is introduced in order to correct some mapping issues in the CTFs already collected, but the interface is general, and in the future it might be used for any kind of digit manipulation, if needed. * [MCH] added pad remapping function for ST1 The remapping function corrects the pads mapping for seven DS boards on the edge of the bending cathodes, all corresponding to the motif type "1BG". * [MCH] added pad remapping function for ST2 The remapping function corrects the pads mapping for five consecutive motif types on the bending side of ST2 quadrants (types "2Bv1" to "2Bv5").
1 parent 930d71c commit 7f30b03

File tree

7 files changed

+441
-5
lines changed

7 files changed

+441
-5
lines changed

Detectors/MUON/MCH/DigitFiltering/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ o2_add_library(MCHDigitFiltering
1313
SOURCES
1414
src/DigitFilter.cxx
1515
src/DigitFilterParam.cxx
16+
src/DigitModifier.cxx
17+
src/DigitModifierParam.cxx
1618
src/DigitFilteringSpec.cxx
1719
PUBLIC_LINK_LIBRARIES
1820
O2::Framework
@@ -27,4 +29,4 @@ o2_add_executable(
2729
COMPONENT_NAME mch
2830
PUBLIC_LINK_LIBRARIES O2::MCHDigitFiltering)
2931

30-
o2_target_root_dictionary(MCHDigitFiltering HEADERS include/MCHDigitFiltering/DigitFilterParam.h)
32+
o2_target_root_dictionary(MCHDigitFiltering HEADERS include/MCHDigitFiltering/DigitFilterParam.h include/MCHDigitFiltering/DigitModifierParam.h)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef O2_MCH_DIGITFILTERING_DIGITMODIFIER_H_
13+
#define O2_MCH_DIGITFILTERING_DIGITMODIFIER_H_
14+
15+
#include "DataFormatsMCH/Digit.h"
16+
#include <functional>
17+
18+
namespace o2::mch
19+
{
20+
typedef std::function<void(Digit&)> DigitModifier;
21+
22+
DigitModifier createDigitModifier(int runNumber,
23+
bool updateST1,
24+
bool updateST2);
25+
26+
} // namespace o2::mch
27+
28+
#endif
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef O2_MCH_DIGITFILTERING_DIGIT_MODIFIER_PARAM_H_
13+
#define O2_MCH_DIGITFILTERING_DIGIT_MODIFIER_PARAM_H_
14+
15+
#include "CommonUtils/ConfigurableParam.h"
16+
#include "CommonUtils/ConfigurableParamHelper.h"
17+
18+
namespace o2::mch
19+
{
20+
21+
/**
22+
* @class DigitModifierParam
23+
* @brief Configurable parameters for the digit updating
24+
*/
25+
struct DigitModifierParam : public o2::conf::ConfigurableParamHelper<DigitModifierParam> {
26+
27+
bool updateST1 = false; ///< whether or not to modify ST1 digits
28+
bool updateST2 = false; ///< whether or not to modify ST2 digits
29+
30+
O2ParamDef(DigitModifierParam, "MCHDigitModifier");
31+
};
32+
33+
} // namespace o2::mch
34+
35+
#endif

Detectors/MUON/MCH/DigitFiltering/src/DigitFilteringSpec.cxx

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include "MCHStatus/StatusMap.h"
2424
#include "MCHDigitFiltering/DigitFilter.h"
2525
#include "MCHDigitFiltering/DigitFilterParam.h"
26+
#include "MCHDigitFiltering/DigitModifier.h"
27+
#include "MCHDigitFiltering/DigitModifierParam.h"
2628
#include "SimulationDataFormat/MCCompLabel.h"
2729
#include "SimulationDataFormat/MCTruthContainer.h"
2830
#include <fmt/format.h>
@@ -48,6 +50,10 @@ class DigitFilteringTask
4850
mRejectBackground = DigitFilterParam::Instance().rejectBackground;
4951
mStatusMask = DigitFilterParam::Instance().statusMask;
5052
mTimeCalib = DigitFilterParam::Instance().timeOffset;
53+
54+
mUpdateDigitsST1 = DigitModifierParam::Instance().updateST1;
55+
mUpdateDigitsST2 = DigitModifierParam::Instance().updateST2;
56+
5157
auto stop = [this]() {
5258
LOG(info) << "digit filtering duration = "
5359
<< std::chrono::duration<double, std::milli>(mElapsedTime).count() << " ms";
@@ -82,6 +88,11 @@ class DigitFilteringTask
8288

8389
auto tStart = std::chrono::high_resolution_clock::now();
8490

91+
const auto& tinfo = pc.services().get<o2::framework::TimingInfo>();
92+
if (tinfo.runNumber != 0) {
93+
mRunNumber = tinfo.runNumber;
94+
}
95+
8596
if (mSanityCheck) {
8697
LOGP(info, "performing sanity checks");
8798
auto error = sanityCheck(iRofs, iDigits);
@@ -101,8 +112,12 @@ class DigitFilteringTask
101112
auto oLabels = mUseMC ? &pc.outputs().make<MCTruthContainer<MCCompLabel>>(OutputRef{"labels"}) : nullptr;
102113

103114
if (!abort) {
104-
bool selectSignal = false;
105115

116+
mDigitModifier = createDigitModifier(mRunNumber,
117+
mUpdateDigitsST1,
118+
mUpdateDigitsST2);
119+
120+
bool selectSignal = false;
106121
mIsGoodDigit = createDigitFilter(mMinADC,
107122
mRejectBackground,
108123
selectSignal,
@@ -114,20 +129,29 @@ class DigitFilteringTask
114129
// the clustering resolution will suffer.
115130
// That's why we only apply the "reject background" filter, which
116131
// is a loose background cut that does not penalize the signal
132+
117133
int cursor{0};
118134
for (const auto& irof : iRofs) {
119135
const auto digits = iDigits.subspan(irof.getFirstIdx(), irof.getNEntries());
120136

121137
// filter the digits from the current ROF
122138
for (auto i = 0; i < digits.size(); i++) {
123-
const auto& d = digits[i];
124-
if (mIsGoodDigit(d)) {
125-
oDigits.emplace_back(d);
139+
auto digit = digits[i];
140+
141+
// modify the digit if needed
142+
if (mDigitModifier) {
143+
mDigitModifier(digit);
144+
}
145+
146+
// check the digit quality
147+
if (mIsGoodDigit(digit)) {
148+
oDigits.emplace_back(digit);
126149
if (iLabels) {
127150
oLabels->addElements(oLabels->getIndexedSize(), iLabels->getLabels(i + irof.getFirstIdx()));
128151
}
129152
}
130153
}
154+
131155
int nofGoodDigits = oDigits.size() - cursor;
132156
if (nofGoodDigits > 0) {
133157
// we create an ouput ROF only if at least one digit from
@@ -160,14 +184,18 @@ class DigitFilteringTask
160184
}
161185

162186
private:
187+
int mRunNumber{0};
163188
bool mRejectBackground{false};
164189
bool mSanityCheck{false};
165190
bool mUseMC{false};
166191
bool mUseStatusMap{false};
167192
int mMinADC{1};
168193
int32_t mTimeCalib{0};
169194
uint32_t mStatusMask{0};
195+
bool mUpdateDigitsST1{false};
196+
bool mUpdateDigitsST2{false};
170197
DigitFilter mIsGoodDigit;
198+
DigitModifier mDigitModifier;
171199
std::chrono::duration<double> mElapsedTime{};
172200
};
173201

0 commit comments

Comments
 (0)