Skip to content

Commit de78a8f

Browse files
authored
MCH: make reco more parametrizable
1 parent 5c71f57 commit de78a8f

23 files changed

+234
-41
lines changed

Detectors/MUON/MCH/Base/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
o2_add_library(MCHBase
1313
SOURCES
1414
src/PreCluster.cxx
15+
src/SanityCheck.cxx
1516
src/TrackBlock.cxx
1617
src/Trackable.cxx
1718
PUBLIC_LINK_LIBRARIES O2::DataFormatsMCH)
File renamed without changes.

Detectors/MUON/MCH/Workflow/src/SanityCheck.cxx renamed to Detectors/MUON/MCH/Base/src/SanityCheck.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#include "SanityCheck.h"
12+
#include "MCHBase/SanityCheck.h"
1313
#include <fmt/core.h>
1414

1515
namespace o2::mch

Detectors/MUON/MCH/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
add_subdirectory(Base)
1313
add_subdirectory(Contour)
1414
add_subdirectory(Mapping)
15+
add_subdirectory(DigitFiltering)
1516
add_subdirectory(Triggering)
1617
add_subdirectory(TimeClustering)
1718
add_subdirectory(PreClustering)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
o2_add_library(MCHDigitFiltering
13+
SOURCES src/DigitFilterParam.cxx src/DigitFilteringSpec.cxx
14+
PUBLIC_LINK_LIBRARIES O2::MCHBase O2::Framework O2::SimulationDataFormat)
15+
16+
o2_add_executable(
17+
digits-filtering-workflow
18+
SOURCES src/digits-filtering-workflow.cxx
19+
COMPONENT_NAME mch
20+
PUBLIC_LINK_LIBRARIES O2::MCHDigitFiltering)
21+
22+
o2_target_root_dictionary(MCHDigitFiltering HEADERS include/MCHDigitFiltering/DigitFilterParam.h)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
<!-- doxy
3+
\page refDetectorsMUONMCHDigitFiltering Digit filtering
4+
/doxy -->
5+
6+
# MCH Digit Filtering
7+
8+
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_FILTER_PARAM_H_
13+
#define O2_MCH_DIGITFILTERING_DIGIT_FILTER_PARAM_H_
14+
15+
#include "CommonUtils/ConfigurableParam.h"
16+
#include "CommonUtils/ConfigurableParamHelper.h"
17+
18+
namespace o2::mch
19+
{
20+
21+
/**
22+
* @class DigitFilterParam
23+
* @brief Configurable parameters for the digit filtering
24+
*/
25+
struct DigitFilterParam : public o2::conf::ConfigurableParamHelper<DigitFilterParam> {
26+
27+
bool sanityCheck = false; ///< whether or not to perform some sanity checks on the input digits
28+
uint32_t minADC = 1; ///< digits with an ADC below this value are discarded
29+
30+
O2ParamDef(DigitFilterParam, "MCHDigitFilter");
31+
};
32+
33+
} // namespace o2::mch
34+
35+
#endif

Detectors/MUON/MCH/Workflow/src/DigitFilteringSpec.h renamed to Detectors/MUON/MCH/DigitFiltering/include/MCHDigitFiltering/DigitFilteringSpec.h

File renamed without changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
#include "MCHDigitFiltering/DigitFilterParam.h"
13+
#include "CommonUtils/ConfigurableParam.h"
14+
15+
O2ParamImpl(o2::mch::DigitFilterParam)

Detectors/MUON/MCH/Workflow/src/DigitFilteringSpec.cxx renamed to Detectors/MUON/MCH/DigitFiltering/src/DigitFilteringSpec.cxx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#include "DigitFilteringSpec.h"
12+
#include "MCHDigitFiltering/DigitFilteringSpec.h"
1313

1414
#include "DataFormatsMCH/Digit.h"
1515
#include "DataFormatsMCH/ROFRecord.h"
@@ -19,7 +19,8 @@
1919
#include "Framework/OutputSpec.h"
2020
#include "Framework/Task.h"
2121
#include "Framework/WorkflowSpec.h"
22-
#include "SanityCheck.h"
22+
#include "MCHBase/SanityCheck.h"
23+
#include "MCHDigitFiltering/DigitFilterParam.h"
2324
#include "SimulationDataFormat/MCCompLabel.h"
2425
#include "SimulationDataFormat/MCTruthContainer.h"
2526
#include <fmt/format.h>
@@ -39,13 +40,13 @@ class DigitFilteringTask
3940

4041
void init(InitContext& ic)
4142
{
42-
mSanityCheck = ic.options().get<bool>("sanity-check");
43-
mMinADC = ic.options().get<int>("min-adc-value");
43+
mSanityCheck = DigitFilterParam::Instance().sanityCheck;
44+
mMinADC = DigitFilterParam::Instance().minADC;
4445
}
4546

4647
bool isGoodDigit(const Digit& digit) const
4748
{
48-
return digit.getADC() > mMinADC;
49+
return digit.getADC() >= mMinADC;
4950
}
5051

5152
void run(ProcessingContext& pc)
@@ -58,6 +59,7 @@ class DigitFilteringTask
5859
bool abort{false};
5960

6061
if (mSanityCheck) {
62+
LOGP(info, "performing sanity checks");
6163
auto error = sanityCheck(iRofs, iDigits);
6264

6365
if (!isOK(error)) {
@@ -76,9 +78,7 @@ class DigitFilteringTask
7678

7779
if (!abort) {
7880
int cursor{0};
79-
for (auto i = 0; i < iRofs.size(); i++) {
80-
const ROFRecord& irof = iRofs[i];
81-
81+
for (const auto& irof : iRofs) {
8282
const auto digits = iDigits.subspan(irof.getFirstIdx(), irof.getNEntries());
8383

8484
// filter the digits from the current ROF
@@ -87,7 +87,7 @@ class DigitFilteringTask
8787
if (isGoodDigit(d)) {
8888
oDigits.emplace_back(d);
8989
if (iLabels) {
90-
oLabels->addElements(oLabels->getIndexedSize(), iLabels->getLabels(i + cursor));
90+
oLabels->addElements(oLabels->getIndexedSize(), iLabels->getLabels(i + irof.getFirstIdx()));
9191
}
9292
}
9393
}
@@ -160,8 +160,6 @@ framework::DataProcessorSpec
160160
Inputs{select(input.c_str())},
161161
outputs,
162162
AlgorithmSpec{adaptFromTask<DigitFilteringTask>(useMC)},
163-
Options{
164-
{"sanity-check", VariantType::Bool, false, {"perform a few sanity checks on input digits"}},
165-
{"min-adc-value", VariantType::Int, 1, {"minumum ADC value to consider"}}}};
163+
Options{}};
166164
}
167165
} // namespace o2::mch

0 commit comments

Comments
 (0)