Skip to content

Commit ebffba9

Browse files
committed
TRD noise calibration can run as dummy without CCDB upload
1 parent a7acc73 commit ebffba9

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

Detectors/TRD/workflow/include/TRDWorkflow/NoiseCalibSpec.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace trd
3333
class TRDNoiseCalibSpec : public o2::framework::Task
3434
{
3535
public:
36-
TRDNoiseCalibSpec() = default;
36+
TRDNoiseCalibSpec(bool dummy) : mIsDummy(dummy) {}
3737
void init(o2::framework::InitContext& ic) final
3838
{
3939
// Do we need to initialize something?
@@ -44,6 +44,10 @@ class TRDNoiseCalibSpec : public o2::framework::Task
4444
auto digits = pc.inputs().get<gsl::span<Digit>>("trddigits");
4545
auto trigRecs = pc.inputs().get<gsl::span<TriggerRecord>>("trdtriggerrec");
4646

47+
if (mIsDummy) {
48+
return;
49+
}
50+
4751
// Obtain rough time from the data header (done only once)
4852
if (mStartTime == 0) {
4953
o2::dataformats::TFIDInfo ti;
@@ -63,7 +67,7 @@ class TRDNoiseCalibSpec : public o2::framework::Task
6367
sendOutput(pc.outputs());
6468
mHaveSentOutput = true;
6569
} else {
66-
if ((mNTFsProcessed % 50) == 0) {
70+
if ((mNTFsProcessed % 200) == 0) {
6771
LOGP(important, "Not processing anymore. Seen {} TFs in total. Run can be stopped", mNTFsProcessed);
6872
}
6973
}
@@ -96,18 +100,21 @@ class TRDNoiseCalibSpec : public o2::framework::Task
96100
if (mHaveSentOutput) {
97101
LOGP(important, "Received EoS after sending calibration object. All OK");
98102
} else {
99-
LOGP(alarm, "Received EoS before sending calibration object. Not enough digits received");
103+
if (!mIsDummy) {
104+
LOGP(alarm, "Received EoS before sending calibration object. Not enough digits received");
105+
}
100106
}
101107
}
102108

103109
private:
104110
CalibratorNoise mCalibrator{};
105111
size_t mNTFsProcessed{0};
106112
bool mHaveSentOutput{false};
113+
bool mIsDummy{false};
107114
uint64_t mStartTime{0};
108115
};
109116

110-
o2::framework::DataProcessorSpec getTRDNoiseCalibSpec()
117+
o2::framework::DataProcessorSpec getTRDNoiseCalibSpec(bool dummy)
111118
{
112119
std::vector<InputSpec> inputs;
113120
inputs.emplace_back("trddigits", o2::header::gDataOriginTRD, "DIGITS", 0, Lifetime::Timeframe);
@@ -121,7 +128,7 @@ o2::framework::DataProcessorSpec getTRDNoiseCalibSpec()
121128
"trd-noise-calib",
122129
inputs,
123130
outputs,
124-
AlgorithmSpec{adaptFromTask<TRDNoiseCalibSpec>()},
131+
AlgorithmSpec{adaptFromTask<TRDNoiseCalibSpec>(dummy)},
125132
Options{}};
126133
}
127134

Detectors/TRD/workflow/src/trd-calib-workflow.cxx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
2828
{"vDriftAndExB", o2::framework::VariantType::Bool, false, {"enable vDrift and ExB calibration"}},
2929
{"noise", o2::framework::VariantType::Bool, false, {"enable noise and pad status calibration"}},
3030
{"gain", o2::framework::VariantType::Bool, false, {"enable gain calibration"}},
31+
{"calib-dds-collection-index", VariantType::Int, -1, {"allow only single collection to produce calibration objects (use -1 for no limit)"}},
3132
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}};
3233

3334
std::swap(workflowOptions, options);
@@ -55,7 +56,21 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
5556
if (enableRootInp) {
5657
specs.emplace_back(o2::trd::getTRDDigitReaderSpec(false));
5758
}
58-
specs.emplace_back(o2::trd::getTRDNoiseCalibSpec());
59+
int ddsCollectionIdx = configcontext.options().get<int>("calib-dds-collection-index");
60+
bool noiseCalibIsDummy = true;
61+
if (ddsCollectionIdx != -1) {
62+
char* colIdx = getenv("DDS_COLLECTION_INDEX");
63+
int myIdx = colIdx ? atoi(colIdx) : -1;
64+
if (myIdx == ddsCollectionIdx) {
65+
LOG(info) << "TRD noise calib is enabled for this collection, my index " << myIdx;
66+
noiseCalibIsDummy = false;
67+
} else {
68+
LOG(info) << "TRD noise calib is disabled for this collection, my index " << myIdx;
69+
}
70+
} else {
71+
noiseCalibIsDummy = false;
72+
}
73+
specs.emplace_back(o2::trd::getTRDNoiseCalibSpec(noiseCalibIsDummy));
5974
}
6075

6176
if (configcontext.options().get<bool>("gain")) {

0 commit comments

Comments
 (0)