Project
Loading...
Searching...
No Matches
EventsPerBcCalibrator.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15namespace o2::ft0
16{
18{
19 LOG(info) << entries << " entries";
20}
21
22void EventsPerBcContainer::fill(const o2::dataformats::TFIDInfo& ti, const gsl::span<const o2::ft0::Digit> data)
23{
24 size_t oldEntries = entries;
25 for (const auto& digit : data) {
26 if (digit.mTriggers.getVertex() && digit.mTriggers.getAmplA() >= mMinAmplitudeSideA && digit.mTriggers.getAmplC() >= mMinAmplitudeSideC) {
27 mTvx[digit.mIntRecord.bc]++;
28 entries++;
29 }
30 }
31 LOG(debug) << "Container is filled with " << entries - oldEntries << " new events";
32}
33
35{
36 for (int bc = 0; bc < o2::constants::lhc::LHCMaxBunches; bc++) {
37 mTvx[bc] += prev->mTvx[bc];
38 }
39 entries += prev->entries;
40}
41
43{
44 mTvxPerBcs.clear();
45 mTvxPerBcInfos.clear();
46}
47
48EventsPerBcCalibrator::EventsPerBcCalibrator(uint32_t minNumberOfEntries, int32_t minAmplitudeSideA, int32_t minAmplitudeSideC) : mMinNumberOfEntries(minNumberOfEntries), mMinAmplitudeSideA(minAmplitudeSideA), mMinAmplitudeSideC(minAmplitudeSideC)
49{
50 LOG(info) << "Defined threshold for number of entires per slot: " << mMinNumberOfEntries;
51 LOG(info) << "Defined threshold for side A amplitude for event: " << mMinAmplitudeSideA;
52 LOG(info) << "Defined threshold for side C amplitude for event: " << mMinAmplitudeSideC;
53}
54
56{
57 return slot.getContainer()->entries > mMinNumberOfEntries;
58}
59
61{
62 LOG(info) << "Finalizing slot from " << slot.getStartTimeMS() << " to " << slot.getEndTimeMS();
64 mTvxPerBcs.emplace_back(data->mTvx);
65
66 auto clName = o2::utils::MemFileHelper::getClassName(mTvxPerBcs.back());
67 auto flName = o2::ccdb::CcdbApi::generateFileName(clName);
68
69 std::map<std::string, std::string> metaData;
70 mTvxPerBcInfos.emplace_back(std::make_unique<o2::ccdb::CcdbObjectInfo>("FT0/Calib/EventsPerBc", clName, flName, metaData, slot.getStartTimeMS(), slot.getEndTimeMS()));
71 LOG(info) << "Created object valid from " << mTvxPerBcInfos.back()->getStartValidityTimestamp() << " to " << mTvxPerBcInfos.back()->getEndValidityTimestamp();
72}
73
75{
76 auto& cont = getSlots();
77 auto& slot = front ? cont.emplace_front(tstart, tend) : cont.emplace_back(tstart, tend);
78 slot.setContainer(std::make_unique<EventsPerBcContainer>(mMinAmplitudeSideA, mMinAmplitudeSideC));
79 return slot;
80}
81} // namespace o2::ft0
std::ostringstream debug
uint64_t bc
Definition RawEventData.h:5
long getStartTimeMS() const
Definition TimeSlot.h:50
long getEndTimeMS() const
Definition TimeSlot.h:51
const Container * getContainer() const
Definition TimeSlot.h:53
static std::string generateFileName(const std::string &inp)
Definition CcdbApi.cxx:824
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) override
void finalizeSlot(Slot &slot) override
bool hasEnoughData(const Slot &slot) const override
EventsPerBcCalibrator(uint32_t minNumberOfEntries, int32_t minAmplitudeSideA, int32_t minAmplitudeSideC)
GLboolean * data
Definition glcorearb.h:298
constexpr int LHCMaxBunches
void merge(const EventsPerBcContainer *prev)
void fill(const o2::dataformats::TFIDInfo &ti, const gsl::span< const o2::ft0::Digit > data)
std::array< double, o2::constants::lhc::LHCMaxBunches > mTvx
static std::string getClassName(const T &obj)
get the class name of the object
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"