Skip to content

Commit 2c13b2e

Browse files
mfasDashahor02
authored andcommitted
[EMCAL-838] Load RecoParams from the CCDB in EMCAL reconstruction workflow
- RecoParams are by default loaded from the CCDB - Option to disable loading from CCDB available in RawToCellConverterSpec (will take the default parameters in the constructor)
1 parent 4331add commit 2c13b2e

3 files changed

Lines changed: 32 additions & 4 deletions

File tree

Detectors/EMCAL/workflow/include/EMCALWorkflow/RawToCellConverterSpec.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <chrono>
1313
#include <vector>
1414

15+
#include "Framework/ConcreteDataMatcher.h"
1516
#include "Framework/DataProcessorSpec.h"
1617
#include "Framework/Task.h"
1718
#include "DataFormatsEMCAL/Cell.h"
@@ -41,6 +42,7 @@ class RawToCellConverterSpec : public framework::Task
4142
/// \brief Constructor
4243
/// \param subspecification Output subspecification for parallel running on multiple nodes
4344
/// \param hasDecodingErrors Option to swich on/off creating raw decoding error objects for later monitoring
45+
/// \param loadRecoParamsFromCCDB Option to load the RecoParams from the CCDB
4446
RawToCellConverterSpec(int subspecification, bool hasDecodingErrors) : framework::Task(), mSubspecification(subspecification), mCreateRawDataErrors(hasDecodingErrors){};
4547

4648
/// \brief Destructor
@@ -59,11 +61,19 @@ class RawToCellConverterSpec : public framework::Task
5961
/// Output cells trigger record: {"EMC", "CELLSTR", 0, Lifetime::Timeframe}
6062
void run(framework::ProcessingContext& ctx) final;
6163

64+
/// \brief Handle objects obtained from the CCDB
65+
/// \param matcher Matcher providing the CCDB path of the object
66+
/// \param obj CCDB object loaded by the CCDB interface
67+
void finaliseCCDB(framework::ConcreteDataMatcher& matcher, void* obj) final;
68+
6269
/// \brief Set max number of error messages printed
6370
/// \param maxMessages Max. amount of messages printed
6471
///
6572
/// Error messages will be suppressed once the maximum is reached
66-
void setMaxErrorMessages(int maxMessages) { mMaxErrorMessages = maxMessages; }
73+
void setMaxErrorMessages(int maxMessages)
74+
{
75+
mMaxErrorMessages = maxMessages;
76+
}
6777

6878
void setNoiseThreshold(int thresold) { mNoiseThreshold = thresold; }
6979
int getNoiseThreshold() const { return mNoiseThreshold; }
@@ -134,9 +144,12 @@ class RawToCellConverterSpec : public framework::Task
134144
};
135145

136146
/// \brief Creating DataProcessorSpec for the EMCAL Cell Converter Spec
147+
/// \param askDISTSTF Include input spec FLP/DISTSUBTIMEFRAME
148+
/// \param loadRecoParamsFromCCDB Obtain reco params from the CCDB
149+
/// \param subspecification Subspecification used in the output spec
137150
///
138151
/// Refer to RawToCellConverterSpec::run for input and output specs
139-
framework::DataProcessorSpec getRawToCellConverterSpec(bool askDISTSTF, bool disableDecodingErrors, int subspecification);
152+
framework::DataProcessorSpec getRawToCellConverterSpec(bool askDISTSTF, bool disableDecodingError, int subspecification);
140153

141154
} // namespace reco_workflow
142155

Detectors/EMCAL/workflow/include/EMCALWorkflow/RecoWorkflow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ enum struct OutputType { Digits, ///< EMCAL digits
5151
/// \param subspecification Subspecification in case of running on different FLPs
5252
/// \param cfgInput Input objects processed in the workflow
5353
/// \param cfgOutput Output objects created in the workflow
54+
/// \param loadRecoParamsFromCCDB Load the reco params from the CCDB
5455
/// \return EMCAL reconstruction workflow for the configuration provided
5556
/// \ingroup EMCALwokflow
5657
framework::WorkflowSpec getWorkflow(bool propagateMC = true,

Detectors/EMCAL/workflow/src/RawToCellConverterSpec.cxx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "CommonConstants/Triggers.h"
1919
#include "CommonDataFormat/InteractionRecord.h"
20+
#include "Framework/CCDBParamSpec.h"
2021
#include "Framework/ConfigParamRegistry.h"
2122
#include "Framework/ControlService.h"
2223
#include "Framework/InputRecordWalker.h"
@@ -92,8 +93,6 @@ void RawToCellConverterSpec::init(framework::InitContext& ctx)
9293
mDisablePedestalEvaluation = ctx.options().get<bool>("no-evalpedestal");
9394

9495
LOG(info) << "Running gain merging mode: " << (mMergeLGHG ? "yes" : "no");
95-
LOG(info) << "Using time shift: " << RecoParam::Instance().getCellTimeShiftNanoSec() << " ns";
96-
LOG(info) << "Using BCshfit phase:" << RecoParam::Instance().getPhaseBCmod4() << " BCs";
9796
LOG(info) << "Using L0LM delay: " << o2::ctp::TriggerOffsetsParam::Instance().LM_L0 << " BCs";
9897

9998
mRawFitter->setAmpCut(mNoiseThreshold);
@@ -103,6 +102,9 @@ void RawToCellConverterSpec::init(framework::InitContext& ctx)
103102
void RawToCellConverterSpec::run(framework::ProcessingContext& ctx)
104103
{
105104
LOG(debug) << "[EMCALRawToCellConverter - run] called";
105+
// for reading the reco param object from the ccdb
106+
ctx.inputs().get<o2::emcal::RecoParam*>("EMC_RecoParam");
107+
106108
double timeshift = RecoParam::Instance().getCellTimeShiftNanoSec(); // subtract offset in ns in order to center the time peak around the nominal delay
107109
constexpr auto originEMC = o2::header::gDataOriginEMC;
108110
constexpr auto descRaw = o2::header::gDataDescriptionRawData;
@@ -591,6 +593,16 @@ void RawToCellConverterSpec::run(framework::ProcessingContext& ctx)
591593
sendData(ctx, mOutputCells, mOutputTriggerRecords, mOutputDecoderErrors);
592594
}
593595

596+
void RawToCellConverterSpec::finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj)
597+
{
598+
// check if calib params need to be updated
599+
if (matcher == framework::ConcreteDataMatcher("EMC", "EMCALRECOPARAM", 0)) {
600+
LOG(info) << "RecoParams updated";
601+
o2::emcal::RecoParam::Instance().printKeyValues(true, true);
602+
return;
603+
}
604+
}
605+
594606
bool RawToCellConverterSpec::isLostTimeframe(framework::ProcessingContext& ctx) const
595607
{
596608
constexpr auto originEMC = header::gDataOriginEMC;
@@ -642,6 +654,8 @@ o2::framework::DataProcessorSpec o2::emcal::reco_workflow::getRawToCellConverter
642654
if (askDISTSTF) {
643655
inputs.emplace_back("stdDist", "FLP", "DISTSUBTIMEFRAME", 0, o2::framework::Lifetime::Timeframe);
644656
}
657+
// CCDB objects
658+
inputs.emplace_back("EMC_RecoParam", o2::header::gDataOriginEMC, "EMCALRECOPARAM", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec("EMC/Config/RecoParam"));
645659

646660
return o2::framework::DataProcessorSpec{"EMCALRawToCellConverterSpec",
647661
inputs,

0 commit comments

Comments
 (0)