Skip to content

Commit 968f992

Browse files
author
wpierozak
committed
FT0: Removed from EventsPerBc calibarion option to define slot lenght in TFs; Small code cleaning
1 parent dbb62e1 commit 968f992

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ void EventsPerBcContainer::fill(const o2::dataformats::TFIDInfo& ti, const gsl::
2323
{
2424
size_t oldEntries = entries;
2525
for (const auto& digit : data) {
26-
double isVertex = digit.mTriggers.getVertex();
27-
if (digit.mTriggers.getAmplA() < mMinAmplitudeSideA || digit.mTriggers.getAmplC() < mMinAmplitudeSideC) {
28-
continue;
26+
if (digit.mTriggers.getVertex() && digit.mTriggers.getAmplA() >= mMinAmplitudeSideA && digit.mTriggers.getAmplC() >= mMinAmplitudeSideC) {
27+
mTvx[digit.mIntRecord.bc]++;
28+
entries++;
2929
}
30-
mTvx[digit.mIntRecord.bc] += isVertex;
31-
entries += isVertex;
3230
}
3331
LOG(debug) << "Container is filled with " << entries - oldEntries << " new events";
3432
}
@@ -69,7 +67,7 @@ void EventsPerBcCalibrator::finalizeSlot(EventsPerBcCalibrator::Slot& slot)
6967
auto flName = o2::ccdb::CcdbApi::generateFileName(clName);
7068

7169
std::map<std::string, std::string> metaData;
72-
mTvxPerBcInfos.emplace_back(std::make_unique<o2::ccdb::CcdbObjectInfo>("FT0/Calib/EventsPerBcContainer", clName, flName, metaData, slot.getStartTimeMS(), slot.getEndTimeMS()));
70+
mTvxPerBcInfos.emplace_back(std::make_unique<o2::ccdb::CcdbObjectInfo>("FT0/Calib/EventsPerBc", clName, flName, metaData, slot.getStartTimeMS(), slot.getEndTimeMS()));
7371
LOG(info) << "Created object valid from " << mTvxPerBcInfos.back()->getStartValidityTimestamp() << " to " << mTvxPerBcInfos.back()->getEndValidityTimestamp();
7472
}
7573

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext co
3636
AlgorithmSpec(adaptFromTask<FT0EventsPerBcProcessor>(ccdbRequest)),
3737
Options{
3838
{"slot-len-sec", VariantType::UInt32, 3600u, {"Duration of each slot in seconds"}},
39-
{"slot-len-tf", VariantType::UInt32, 0u, {"Slot length in Time Frames (TFs)"}},
4039
{"one-object-per-run", VariantType::Bool, false, {"If set, workflow creates only one calibration object per run"}},
41-
{"min-entries-number", VariantType::UInt32, 0u, {"Minimum number of entries required for a slot to be valid"}},
40+
{"min-entries-number", VariantType::UInt32, 5000, {"Minimum number of entries required for a slot to be valid"}},
4241
{"min-ampl-side-a", VariantType::Int, 0, {"Amplitude threshold for Side A events"}},
4342
{"min-ampl-side-c", VariantType::Int, 0, {"Amplitude threshold for Side C events"}}}};
4443

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ class FT0EventsPerBcProcessor final : public o2::framework::Task
4141
if (ic.options().hasOption("one-object-per-run")) {
4242
mOneObjectPerRun = ic.options().get<bool>("one-object-per-run");
4343
}
44-
if (ic.options().hasOption("slot-len-tf")) {
45-
mSlotLen = ic.options().get<o2::calibration::TFType>("slot-len-tf");
46-
}
4744
if (ic.options().hasOption("min-entries-number")) {
4845
mMinNumberOfEntries = ic.options().get<uint32_t>("min-entries-number");
4946
}
@@ -60,14 +57,10 @@ class FT0EventsPerBcProcessor final : public o2::framework::Task
6057
LOG(info) << "Only one object will be created at the end of run";
6158
mCalibrator->setUpdateAtTheEndOfRunOnly();
6259
}
63-
if (mOneObjectPerRun == false && mSlotLen == 0) {
60+
if (mOneObjectPerRun == false) {
6461
LOG(info) << "Defined slot interval to " << mSlotLenSec << " seconds";
6562
mCalibrator->setSlotLengthInSeconds(mSlotLenSec);
6663
}
67-
if (mOneObjectPerRun == false && mSlotLen != 0) {
68-
LOG(info) << "Defined slot interval to " << mSlotLen << " TFS";
69-
mCalibrator->setSlotLength(mSlotLen);
70-
}
7164
}
7265

7366
void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj)
@@ -123,7 +116,6 @@ class FT0EventsPerBcProcessor final : public o2::framework::Task
123116
std::unique_ptr<o2::ft0::EventsPerBcCalibrator> mCalibrator;
124117
bool mOneObjectPerRun;
125118
uint32_t mSlotLenSec;
126-
o2::calibration::TFType mSlotLen;
127119
uint32_t mMinNumberOfEntries;
128120
int32_t mMinAmplitudeSideA;
129121
int32_t mMinAmplitudeSideC;

Detectors/FIT/FT0/macros/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ o2_add_test_root_macro(FT0Misaligner.C
1515
LABELS ft0)
1616

1717
o2_add_test_root_macro(FT0readEventsPerBc.C
18-
PUBLIC_LINK_LIBRARIES O2::CCDB
18+
PUBLIC_LINK_LIBRARIES
19+
O2::CCDB
20+
O2::DataFormatsFT0
1921
LABELS ft0)

Detectors/FIT/FT0/macros/FT0readEventsPerBc.C

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
#if !defined(__CLING__) || defined(__ROOTCLING__)
1313
#include <iostream>
1414
#include <array>
15+
#endif
16+
1517
#include "CCDB/CcdbApi.h"
18+
#include "CCDB/CCDBTimeStampUtils.h"
1619
#include "TH1F.h"
1720
#include "DataFormatsFT0/EventsPerBc.h"
1821
#include "Framework/Logger.h"
1922
#include "CommonConstants/LHCConstants.h"
20-
#endif
2123

2224
std::unique_ptr<TH1F> hist;
2325
std::unique_ptr<TCanvas> canvas;
@@ -33,7 +35,7 @@ void FT0readEventsPerBc(std::string ccdbUrl, long timestamp)
3335
timestamp = o2::ccdb::getCurrentTimestamp();
3436
}
3537

36-
EventsArray* events = ccdbApi.retrieveFromTFileAny<o2::ft0::EventsPerBc>(ccdbPath, metadata, timestamp);
38+
std::unique_ptr<o2::ft0::EventsPerBc> events(ccdbApi.retrieveFromTFileAny<o2::ft0::EventsPerBc>(ccdbPath, metadata, timestamp));
3739

3840
if (!events) {
3941
LOGP(fatal, "EventsPerBc object not found in {}/{} for timestamp {}.", ccdbUrl, ccdbPath, timestamp);

0 commit comments

Comments
 (0)