@@ -43,10 +43,10 @@ class VdAndExBCalibDevice : public o2::framework::Task
4343 {
4444 o2::base::GRPGeomHelper::instance ().setRequest (mCCDBRequest );
4545 int minEnt = ic.options ().get <int >(" min-entries" );
46- auto slotL = ic.options ().get <uint32_t >(" tf -per-slot" );
46+ auto slotL = ic.options ().get <uint32_t >(" sec -per-slot" );
4747 auto delay = ic.options ().get <uint32_t >(" max-delay" );
4848 mCalibrator = std::make_unique<o2::trd::CalibratorVdExB>(minEnt);
49- mCalibrator ->setSlotLength (slotL);
49+ mCalibrator ->setSlotLengthInSeconds (slotL);
5050 mCalibrator ->setMaxSlotsDelay (delay);
5151 }
5252
@@ -78,9 +78,26 @@ class VdAndExBCalibDevice : public o2::framework::Task
7878 // ________________________________________________________________
7979 void sendOutput (DataAllocator& output)
8080 {
81- // See LHCClockCalibratorSpec.h
82- // Before this can be implemented the output CCDB objects need to be defined
83- // and added to CalibratorVdExB
81+ // extract CCDB infos and calibration objects, convert it to TMemFile and send them to the output
82+ // TODO in principle, this routine is generic, can be moved to Utils.h
83+
84+ using clbUtils = o2::calibration::Utils;
85+ const auto & payloadVec = mCalibrator ->getCcdbObjectVector ();
86+ auto & infoVec = mCalibrator ->getCcdbObjectInfoVector (); // use non-const version as we update it
87+ assert (payloadVec.size () == infoVec.size ());
88+
89+ for (uint32_t i = 0 ; i < payloadVec.size (); i++) {
90+ auto & w = infoVec[i];
91+ auto image = o2::ccdb::CcdbApi::createObjectImage (&payloadVec[i], &w);
92+ LOG (info) << " Sending object " << w.getPath () << " /" << w.getFileName () << " of size " << image->size ()
93+ << " bytes, valid for " << w.getStartValidityTimestamp () << " : " << w.getEndValidityTimestamp ();
94+
95+ output.snapshot (Output{clbUtils::gDataOriginCDBPayload , " VDRIFTEXB" , i}, *image.get ()); // vector<char>
96+ output.snapshot (Output{clbUtils::gDataOriginCDBWrapper , " VDRIFTEXB" , i}, w); // root-serialized
97+ }
98+ if (payloadVec.size ()) {
99+ mCalibrator ->initOutput (); // reset the outputs once they are already sent
100+ }
84101 }
85102};
86103
@@ -95,8 +112,8 @@ DataProcessorSpec getTRDVdAndExBCalibSpec()
95112 using clbUtils = o2::calibration::Utils;
96113
97114 std::vector<OutputSpec> outputs;
98- // outputs.emplace_back(ConcreteDataTypeMatcher{clbUtils::gDataOriginCLB, clbUtils::gDataDescriptionCLBPayload} );
99- // outputs.emplace_back(ConcreteDataTypeMatcher{clbUtils::gDataOriginCLB, clbUtils::gDataDescriptionCLBInfo} );
115+ outputs.emplace_back (ConcreteDataTypeMatcher{o2::calibration::Utils:: gDataOriginCDBPayload , " VDRIFTEXB " }, Lifetime::Sporadic );
116+ outputs.emplace_back (ConcreteDataTypeMatcher{o2::calibration::Utils:: gDataOriginCDBWrapper , " VDRIFTEXB " }, Lifetime::Sporadic );
100117 std::vector<InputSpec> inputs{{" input" , " TRD" , " ANGRESHISTS" }};
101118 auto ccdbRequest = std::make_shared<o2::base::GRPGeomRequest>(true , // orbitResetTime
102119 true , // GRPECS=true
@@ -111,9 +128,9 @@ DataProcessorSpec getTRDVdAndExBCalibSpec()
111128 outputs,
112129 AlgorithmSpec{adaptFromTask<device>(ccdbRequest)},
113130 Options{
114- {" tf -per-slot" , VariantType::UInt32, 5u , {" number of TFs per calibration time slot" }},
115- {" max-delay" , VariantType::UInt32, 90'000u , {" number of slots in past to consider" }}, // 15 minutes delay, 10ms TF
116- {" min-entries" , VariantType::Int, 500 , {" minimum number of entries to fit single time slot" }}}};
131+ {" sec -per-slot" , VariantType::UInt32, 900u , {" number of seconds per calibration time slot" }},
132+ {" max-delay" , VariantType::UInt32, 2u , {" number of slots in past to consider" }},
133+ {" min-entries" , VariantType::Int, 40'000 , {" minimum number of entries to fit single time slot" }}}}; // around 3 entries per bin per chamber
117134}
118135
119136} // namespace framework
0 commit comments