Skip to content

Commit 00be70b

Browse files
author
wpierozak
committed
FT0 calibration: fixed ROOT directory compilation, fixed CCDB output
1 parent f49611c commit 00be70b

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

Detectors/FIT/FT0/calibration/include/FT0Calibration/EventsPerBcCalibrator.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,18 @@ namespace o2::ft0
4141
public:
4242
EventsPerBcCalibrator() = default;
4343

44-
bool hasEnoughData(const Slot& slot) const final { return true; }
45-
void initOutput() final;
46-
void finalizeSlot(Slot& slot) final;
47-
Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) final;
44+
bool hasEnoughData(const Slot& slot) const override;
45+
void initOutput() override;
46+
void finalizeSlot(Slot& slot) override;
47+
Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) override;
4848

4949
const std::vector<std::unique_ptr<TH1F>>& getTvxPerBc() { return mTvxPerBcs; }
5050
std::vector<std::unique_ptr<o2::ccdb::CcdbObjectInfo>>& getTvxPerBcCcdbInfo() { return mTvxPerBcInfos; }
5151

5252
private:
5353
std::vector<std::unique_ptr<TH1F>> mTvxPerBcs;
5454
std::vector<std::unique_ptr<o2::ccdb::CcdbObjectInfo>> mTvxPerBcInfos;
55+
uint32_t mMinNumberOfEntries{1000};
5556

5657
ClassDefOverride(EventsPerBcCalibrator, 1);
5758
};

Detectors/FIT/FT0/calibration/src/EventsPerBcCalibrator.cxx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ namespace o2::ft0
1010

1111
void EventsPerBc::fill(const gsl::span<const o2::ft0::Digit> data)
1212
{
13+
size_t oldEntries = entries;
1314
for(const auto& digit: data) {
1415
double isVertex = digit.mTriggers.getVertex();
1516
mTvx[digit.mIntRecord.bc] += isVertex;
1617
entries += isVertex;
1718
}
19+
LOG(debug) << "Container is filled with " << entries - oldEntries << " new VTX events";
1820
}
1921

2022
void EventsPerBc::merge(const EventsPerBc* prev)
@@ -31,8 +33,14 @@ namespace o2::ft0
3133
mTvxPerBcInfos.clear();
3234
}
3335

36+
bool EventsPerBcCalibrator::hasEnoughData(const EventsPerBcCalibrator::Slot& slot) const
37+
{
38+
return slot.getContainer()->entries > mMinNumberOfEntries;
39+
}
40+
3441
void EventsPerBcCalibrator::finalizeSlot(EventsPerBcCalibrator::Slot& slot)
3542
{
43+
LOG(info) << "Finializing slot from " << slot.getStartTimeMS() << " to " << slot.getEndTimeMS();
3644
o2::ft0::EventsPerBc* data = slot.getContainer();
3745
mTvxPerBcs.emplace_back(std::make_unique<TH1F>("TvxPerBc", "FT0 TVX per BC", o2::constants::lhc::LHCMaxBunches, 0, o2::constants::lhc::LHCMaxBunches - 1));
3846
for(int bin = 0; bin < o2::constants::lhc::LHCMaxBunches; bin++) {
@@ -42,6 +50,7 @@ namespace o2::ft0
4250
auto flName = o2::ccdb::CcdbApi::generateFileName(clName);
4351
std::map<std::string, std::string> metaData;
4452
mTvxPerBcInfos.emplace_back(std::make_unique<o2::ccdb::CcdbObjectInfo>("FT0/Calib/TvxPerBc", clName, flName, metaData, slot.getStartTimeMS(), slot.getEndTimeMS()));
53+
LOG(info) << "Created new calibration object. Current number of objects: " << mTvxPerBcs.size();
4554
}
4655

4756
EventsPerBcCalibrator::Slot& EventsPerBcCalibrator::emplaceNewSlot(bool front, TFType tstart, TFType tend)

Detectors/FIT/FT0/calibration/src/FT0CalibrationLinkDef.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
#pragma link off all functions;
1717

1818
#pragma link C++ class o2::ft0::FT0TimeOffsetSlotContainer + ;
19-
#pragma link C++ class o2::calibration::EventsPerBcCalibrator + ;
19+
#pragma link C++ class o2::ft0::EventsPerBcCalibrator + ;
2020
#pragma link C++ class o2::calibration::TimeSlot < o2::ft0::FT0TimeOffsetSlotContainer>;
2121
#pragma link C++ class o2::calibration::TimeSlotCalibration < o2::ft0::FT0TimeOffsetSlotContainer>;
22-
22+
#pragma link C++ class o2::calibration::TimeSlot < o2::ft0::EventsPerBc> + ;
23+
#pragma link C++ class o2::calibration::TimeSlotCalibration < o2::ft0::EventsPerBc> + ;
2324
#endif

Detectors/FIT/FT0/calibration/workflow/FT0EventsPerBcProcessor-Workflow.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext co
66
std::vector<InputSpec> inputs;
77
inputs.emplace_back("digits", "FT0", "DIGITSBC");
88
std::vector<OutputSpec> outputs;
9-
outputs.emplace_back(ConcreteDataTypeMatcher{"FT0", "EventsPerBc"}, Lifetime::Sporadic);
9+
outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBWrapper, "EventsPerBc"}, Lifetime::Sporadic);
10+
outputs.emplace_back(ConcreteDataTypeMatcher{o2::calibration::Utils::gDataOriginCDBPayload, "EventsPerBc"}, Lifetime::Sporadic);
1011
DataProcessorSpec dataProcessorSpec{
1112
"FT0EventsPerBcProcessor",
1213
inputs,

Detectors/FIT/FT0/calibration/workflow/FT0EventsPerBcSpec.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ namespace o2::calibration
4242
void run(o2::framework::ProcessingContext& pc) final
4343
{
4444
auto digits = pc.inputs().get<gsl::span<o2::ft0::Digit>>("digits");
45+
if(digits.size() == 0) {
46+
return;
47+
}
4548
mCalibrator->process(digits);
4649
if(mOneObjectPerRun == false) {
4750
sendOutput(pc.outputs());
@@ -58,7 +61,6 @@ namespace o2::calibration
5861
void sendOutput(o2::framework::DataAllocator& output)
5962
{
6063
using o2::framework::Output;
61-
6264
const auto& tvxHists = mCalibrator->getTvxPerBc();
6365
auto& infos = mCalibrator->getTvxPerBcCcdbInfo();
6466
for(int idx = 0; idx < tvxHists.size(); idx++){
@@ -68,8 +70,8 @@ namespace o2::calibration
6870
auto image = o2::ccdb::CcdbApi::createObjectImage(payload.get(), info.get());
6971
LOG(info) << "Sending object " << info->getPath() << "/" << info->getFileName() << " of size " << image->size()
7072
<< " bytes, valid for " << info->getStartValidityTimestamp() << " : " << info->getEndValidityTimestamp();
71-
output.snapshot(Output{o2::header::gDataOriginFT0, "EventsPerBc", idx}, *image.get());
72-
output.snapshot(Output{o2::header::gDataOriginFT0, "EventsPerBc", idx}, *info.get());
73+
output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, "EventsPerBc", idx}, *image.get());
74+
output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBWrapper, "EventsPerBc", idx}, *info.get());
7375
}
7476

7577
if(tvxHists.size()) {

0 commit comments

Comments
 (0)