Skip to content

Commit b770a34

Browse files
sevdokimshahor02
authored andcommitted
CPV: do not stop clusterizer when 0 digits recieved
1 parent 5a2d061 commit b770a34

File tree

3 files changed

+48
-10
lines changed

3 files changed

+48
-10
lines changed

Detectors/CPV/workflow/include/CPVWorkflow/RawToDigitConverterSpec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class RawToDigitConverterSpec : public framework::Task
6464
char CheckHWAddress(short ddl, short hwAddress, short& fee);
6565

6666
private:
67+
bool mIsUsingGainCalibration; ///< Use gain calibration from CCDB
68+
bool mIsUsingBadMap; ///< Use BadChannelMap to mask bad channels
6769
bool mIsPedestalData; ///< Do not subtract pedestals if true
6870
bool mIsUsingCcdbMgr; ///< Are we using CCDB manager?
6971
long mCurrentTimeStamp; ///< Current timestamp for CCDB querying

Detectors/CPV/workflow/src/ClusterizerSpec.cxx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,20 @@ void ClusterizerSpec::run(framework::ProcessingContext& ctx)
3333
LOG(DEBUG) << "CPVClusterizer - run on digits called";
3434

3535
auto digits = ctx.inputs().get<std::vector<Digit>>("digits");
36-
if (!digits.size()) {
36+
37+
if (!digits.size()) { // nothing to process
3738
LOG(INFO) << "ClusterizerSpec::run() : no digits; moving on";
38-
ctx.services().get<o2::framework::ControlService>().readyToQuit(framework::QuitRequest::Me);
39+
//ctx.services().get<o2::framework::ControlService>().readyToQuit(framework::QuitRequest::Me);
40+
mOutputClusters.clear();
41+
ctx.outputs().snapshot(o2::framework::Output{"CPV", "CLUSTERS", 0, o2::framework::Lifetime::Timeframe}, mOutputClusters);
42+
mOutputClusterTrigRecs.clear();
43+
ctx.outputs().snapshot(o2::framework::Output{"CPV", "CLUSTERTRIGRECS", 0, o2::framework::Lifetime::Timeframe}, mOutputClusterTrigRecs);
44+
if (mPropagateMC) {
45+
mOutputTruthCont.clear();
46+
ctx.outputs().snapshot(o2::framework::Output{"CPV", "CLUSTERTRUEMC", 0, o2::framework::Lifetime::Timeframe}, mOutputTruthCont);
47+
}
3948
return;
4049
}
41-
4250
auto digitsTR = ctx.inputs().get<std::vector<o2::cpv::TriggerRecord>>("digitTriggerRecords");
4351

4452
//const o2::dataformats::MCTruthContainer<MCCompLabel>* truthcont = nullptr;

Detectors/CPV/workflow/src/RawToDigitConverterSpec.cxx

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ void RawToDigitConverterSpec::init(framework::InitContext& ctx)
4242
return; //skip CCDB initialization for pedestal runs
4343
}
4444

45+
// is no-gain-calibration flag setted?
46+
mIsUsingGainCalibration = true;
47+
if (ctx.options().isSet("no-gain-calibration")) {
48+
mIsUsingGainCalibration = !ctx.options().get<bool>("no-gain-calibration");
49+
LOG(INFO) << "no-gain-calibration is swithed ON";
50+
}
51+
52+
// is no-bad-channel-map flag setted?
53+
mIsUsingBadMap = true;
54+
if (ctx.options().isSet("no-bad-channel-map")) {
55+
mIsUsingBadMap = !ctx.options().get<bool>("no-bad-channel-map");
56+
LOG(INFO) << "no-bad-channel-map is swithed ON";
57+
}
58+
4559
//CCDB Url
4660
std::string ccdbUrl = "localtest";
4761
if (ctx.options().isSet("ccdb-url")) {
@@ -81,16 +95,28 @@ void RawToDigitConverterSpec::init(framework::InitContext& ctx)
8195
mCurrentTimeStamp = o2::ccdb::getCurrentTimestamp();
8296
ccdbMgr.setTimestamp(mCurrentTimeStamp);
8397

84-
mCalibParams = ccdbMgr.get<o2::cpv::CalibParams>("CPV/Calib/Gains");
85-
if (!mCalibParams) {
86-
LOG(ERROR) << "Cannot get o2::cpv::CalibParams from CCDB. Using dummy calibration!";
98+
if (mIsUsingGainCalibration) {
99+
mCalibParams = ccdbMgr.get<o2::cpv::CalibParams>("CPV/Calib/Gains");
100+
if (!mCalibParams) {
101+
LOG(ERROR) << "Cannot get o2::cpv::CalibParams from CCDB. Using dummy calibration!";
102+
mCalibParams = new o2::cpv::CalibParams(1);
103+
}
104+
} else {
105+
LOG(INFO) << "Using dummy gain calibration (all coeffs = 1.)";
87106
mCalibParams = new o2::cpv::CalibParams(1);
88107
}
89-
mBadMap = ccdbMgr.get<o2::cpv::BadChannelMap>("CPV/Calib/BadChannelMap");
90-
if (!mBadMap) {
91-
LOG(ERROR) << "Cannot get o2::cpv::BadChannelMap from CCDB. Using dummy calibration!";
108+
109+
if (mIsUsingBadMap) {
110+
mBadMap = ccdbMgr.get<o2::cpv::BadChannelMap>("CPV/Calib/BadChannelMap");
111+
if (!mBadMap) {
112+
LOG(ERROR) << "Cannot get o2::cpv::BadChannelMap from CCDB. Using dummy calibration!";
113+
mBadMap = new o2::cpv::BadChannelMap(1);
114+
}
115+
} else {
92116
mBadMap = new o2::cpv::BadChannelMap(1);
117+
LOG(INFO) << "Using dummy bad map (all channels are good)";
93118
}
119+
94120
mPedestals = ccdbMgr.get<o2::cpv::Pedestals>("CPV/Calib/Pedestals");
95121
if (!mPedestals) {
96122
LOG(ERROR) << "Cannot get o2::cpv::Pedestals from CCDB. Using dummy calibration!";
@@ -232,7 +258,7 @@ void RawToDigitConverterSpec::run(framework::ProcessingContext& ctx)
232258
}
233259
digitBuffer.clear();
234260

235-
LOG(DEBUG) << "[CPVRawToDigitConverter - run] Writing " << mOutputDigits.size() << " digits ...";
261+
LOG(INFO) << "[CPVRawToDigitConverter - run] Sending " << mOutputDigits.size() << " digits in " << mOutputTriggerRecords.size() << "trigger records.";
236262
ctx.outputs().snapshot(o2::framework::Output{"CPV", "DIGITS", 0, o2::framework::Lifetime::Timeframe}, mOutputDigits);
237263
ctx.outputs().snapshot(o2::framework::Output{"CPV", "DIGITTRIGREC", 0, o2::framework::Lifetime::Timeframe}, mOutputTriggerRecords);
238264
ctx.outputs().snapshot(o2::framework::Output{"CPV", "RAWHWERRORS", 0, o2::framework::Lifetime::Timeframe}, mOutputHWErrors);
@@ -259,5 +285,7 @@ o2::framework::DataProcessorSpec o2::cpv::reco_workflow::getRawToDigitConverterS
259285
o2::framework::Options{
260286
{"pedestal", o2::framework::VariantType::Bool, false, {"do not subtract pedestals from digits"}},
261287
{"ccdb-url", o2::framework::VariantType::String, "http://ccdb-test.cern.ch:8080", {"CCDB Url"}},
288+
{"no-gain-calibration", o2::framework::VariantType::Bool, false, {"do not apply gain calibration"}},
289+
{"no-bad-channel-map", o2::framework::VariantType::Bool, false, {"do not mask bad channels"}},
262290
}};
263291
}

0 commit comments

Comments
 (0)