-
Notifications
You must be signed in to change notification settings - Fork 488
O2 6563 #14986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wpierozak
wants to merge
23
commits into
AliceO2Group:dev
Choose a base branch
from
wpierozak:O2-6563
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+545
−30
Open
O2 6563 #14986
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
13e19c5
FT0: created first sketch of implementation of generation of TVX per …
24919bb
Fixed typos and scope issues
eb60797
Fixing bugs
aec692a
FT0: Updated CMakeLists for calibration
f49611c
FT0: Added missing entry in FT0CalibrationLinkDef.h
00be70b
FT0 calibration: fixed ROOT directory compilation, fixed CCDB output
675464b
FT0: refined logs in EventsPerBc calibration, fixed setting TF info i…
986a12b
FT0: executed clang-format
05cc06e
FT0: Added readme to calibrations
864d008
FT0: Changed calibration object name, implemented missing OrbitReset …
56e38b6
FT0 EventsPerBc calibration: storing histograms in float format, upda…
797d924
Changed type of EventsPerBc calibration object to std::array
61f71e9
FT0: corrected macro FT0readEventsPerBc, corrected typo in calibratio…
3c5b138
Please consider the following formatting changes
alibuild b4aead4
Merge pull request #5 from alibuild/alibot-cleanup-14986
wpierozak 3fc6d24
Created CCDB object class for EvetnsPerBC calibration
21746d8
FT0: formatted EvensPerBc.h
e3f58ca
FT0: removed amplitudes thresholds from EventsPerBc
35d6fec
FT0: fixed bugs after rebase
8c28976
Please consider the following formatting changes
alibuild 7ae0fa7
Merge pull request #7 from alibuild/alibot-cleanup-14986
wpierozak c10563b
Fixed formatting isues
dbb62e1
Fixed formatting isues
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/EventsPerBc.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| // All rights not expressly granted are reserved. | ||
| // | ||
| // This software is distributed under the terms of the GNU General Public | ||
| // License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // In applying this license CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
| #ifndef _FT0_EVENTS_PER_BC_CALIB_OBJECT | ||
| #define _FT0_EVENTS_PER_BC_CALIB_OBJECT | ||
|
|
||
| #include "CommonConstants/LHCConstants.h" | ||
| #include <Rtypes.h> | ||
|
|
||
| namespace o2::ft0 | ||
| { | ||
| struct EventsPerBc { | ||
| std::array<double, o2::constants::lhc::LHCMaxBunches> histogram; | ||
| ClassDefNV(EventsPerBc, 1); | ||
| }; | ||
| } // namespace o2::ft0 | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Calibrations | ||
|
|
||
| ## Events per BC Calibration | ||
| ### Description | ||
| Generates histograms of **Events per Bunch Crossing (BC)**. Events can be filtered by applying amplitude thresholds to the **A-side** and **C-side**. | ||
|
|
||
| ### Command-Line Options | ||
| | Option | Default | Description | | ||
| | :--- | :--- | :--- | | ||
| | `--slot-len-sec` | `3600` | Duration of each slot in seconds. | | ||
| | `--slot-len-tf` | `0` | Slot length in Time Frames (TFs). | | ||
| | `--one-object-per-run` | — | If set, the workflow creates only one calibration object per run. | | ||
| | `--min-entries-number` | `0` | Minimum number of entries required for a slot to be valid. | | ||
| | `--min-ampl-side-a` | `-2147483648` | Amplitude threshold for Side A events. | | ||
| | `--min-ampl-side-c` | `-2147483648` | Amplitude threshold for Side C events. | | ||
|
|
||
| --- | ||
|
|
||
| ## How to Run | ||
|
|
||
| ### Simulation Data | ||
| First, it is important to digitize data with a non-zero run number, orbit, and timestamp. To set these parameters, one can use the `--configKeyValues` option, as shown in the example below. | ||
| ``` | ||
| o2-sim-digitizer-workflow \ | ||
| --onlyDet FT0 \ | ||
| --configKeyValues="HBFUtils.nHBFPerTF=128;HBFUtils.orbitFirst=128;HBFUtils.orbitFirstSampled=256;HBFUtils.runNumber=560560;HBFUtils.startTime=1768464099000" | ||
| ``` | ||
|
|
||
| To process simulation data, digits must first be converted to RAW format. The `o2-ft0-digi2raw` tool performs this conversion and generates the required configuration file. | ||
|
|
||
| Once converted, you can run the calibration either as a single integrated workflow or by spawning as the sender and receiver components separately. | ||
|
|
||
| #### Single Workflow Example | ||
| Execute the following command within the simulation directory: | ||
| ``` | ||
| o2-raw-file-reader-workflow --input-conf FT0raw.cfg --loop -1 \ | ||
| | o2-ft0-flp-dpl-workflow --condition-backend=http://localhost:8080 \ | ||
| | o2-calibration-ft0-events-per-bc-processor --FT0EventsPerBcProcessor "--slot-len-sec=10" \ | ||
| | o2-calibration-ccdb-populator-workflow --ccdb-path=http://localhost:8080 | ||
| ``` | ||
|
|
||
| Sender example (in simulation directory): | ||
| ``` | ||
| o2-raw-file-reader-workflow --input-conf FT0raw.cfg --loop -1 \ | ||
| | o2-ft0-flp-dpl-workflow --condition-backend=http://localhost:8080 \ | ||
| | o2-dpl-output-proxy --channel-config "name=downstream,method=connect,address=tcp://localhost:30453,type=push,transport=zeromq" --dataspec "downstream:FT0/DIGITSBC" | ||
| ``` | ||
|
|
||
| Receiver example: | ||
| ``` | ||
| o2-dpl-raw-proxy --channel-config "name=readout-proxy,type=pull,method=bind,address=tcp://localhost:30453,rateLogging=1,transport=zeromq" --dataspec "A:FT0/DIGITSBC/0" \ | ||
| | o2-calibration-ft0-events-per-bc-processor --FT0EventsPerBcProcessor "--slot-len-sec=10 --min-ampl-side-a=0" \ | ||
| | o2-calibration-ccdb-populator-workflow --ccdb-path=http://localhost:8080/ | ||
| ``` | ||
|
|
||
| ### CTF Data | ||
| Example: | ||
| ``` | ||
| o2-ctf-reader-workflow --ctf-input ctf.root --onlyDet FT0 \ | ||
| | o2-calibration-ft0-events-per-bc-processor --FT0EventsPerBcProcessor "--slot-len-sec=10" \ | ||
| | o2-calibration-ccdb-populator-workflow --ccdb-path=http://localhost:8080/ | ||
| ``` |
81 changes: 81 additions & 0 deletions
81
Detectors/FIT/FT0/calibration/include/FT0Calibration/EventsPerBcCalibrator.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| // All rights not expressly granted are reserved. | ||
| // | ||
| // This software is distributed under the terms of the GNU General Public | ||
| // License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // In applying this license CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
| #ifndef O2_FT0TVXPERBCID | ||
| #define O2_FT0TVXPERBCID | ||
|
|
||
| #include <bitset> | ||
| #include <array> | ||
| #include <limits> | ||
| #include <TH1F.h> | ||
|
|
||
| #include "CommonDataFormat/FlatHisto2D.h" | ||
| #include "CommonConstants/LHCConstants.h" | ||
| #include "DataFormatsFT0/SpectraInfoObject.h" | ||
| #include "DataFormatsFT0/Digit.h" | ||
| #include "DataFormatsFT0/EventsPerBc.h" | ||
| #include "DetectorsCalibration/TimeSlotCalibration.h" | ||
| #include "DetectorsCalibration/TimeSlot.h" | ||
| #include "CommonDataFormat/TFIDInfo.h" | ||
| #include "TH1F.h" | ||
| #include "Rtypes.h" | ||
|
|
||
| namespace o2::ft0 | ||
| { | ||
| struct EventsPerBcContainer { | ||
| EventsPerBcContainer(int32_t minAmplitudeSideA, int32_t minAmplitudeSideC) : mMinAmplitudeSideA(minAmplitudeSideA), mMinAmplitudeSideC(minAmplitudeSideC) {} | ||
|
|
||
| size_t getEntries() const { return entries; } | ||
| void print() const; | ||
| void fill(const o2::dataformats::TFIDInfo& ti, const gsl::span<const o2::ft0::Digit> data); | ||
| void merge(const EventsPerBcContainer* prev); | ||
|
|
||
| const int32_t mMinAmplitudeSideA; | ||
| const int32_t mMinAmplitudeSideC; | ||
|
|
||
| std::array<double, o2::constants::lhc::LHCMaxBunches> mTvx{0.0}; | ||
| size_t entries{0}; | ||
| long startTimeStamp{0}; | ||
| long stopTimeStamp{0}; | ||
|
|
||
| ClassDefNV(EventsPerBcContainer, 1); | ||
| }; | ||
|
|
||
| class EventsPerBcCalibrator final : public o2::calibration::TimeSlotCalibration<o2::ft0::EventsPerBcContainer> | ||
| { | ||
| using Slot = o2::calibration::TimeSlot<o2::ft0::EventsPerBcContainer>; | ||
| using TFType = o2::calibration::TFType; | ||
| using EventsHistogram = std::array<double, o2::constants::lhc::LHCMaxBunches>; | ||
|
|
||
| public: | ||
| EventsPerBcCalibrator(uint32_t minNumberOfEntries, int32_t minAmplitudeSideA, int32_t minAmplitudeSideC); | ||
|
|
||
| bool hasEnoughData(const Slot& slot) const override; | ||
| void initOutput() override; | ||
| void finalizeSlot(Slot& slot) override; | ||
| Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) override; | ||
|
|
||
| const std::vector<EventsPerBc>& getTvxPerBc() { return mTvxPerBcs; } | ||
| std::vector<std::unique_ptr<o2::ccdb::CcdbObjectInfo>>& getTvxPerBcCcdbInfo() { return mTvxPerBcInfos; } | ||
|
|
||
| private: | ||
| const uint32_t mMinNumberOfEntries; | ||
| const int32_t mMinAmplitudeSideA; | ||
| const int32_t mMinAmplitudeSideC; | ||
|
|
||
| std::vector<EventsPerBc> mTvxPerBcs; | ||
| std::vector<std::unique_ptr<o2::ccdb::CcdbObjectInfo>> mTvxPerBcInfos; | ||
|
|
||
| ClassDefOverride(EventsPerBcCalibrator, 1); | ||
| }; | ||
| } // namespace o2::ft0 | ||
|
|
||
| #endif |
83 changes: 83 additions & 0 deletions
83
Detectors/FIT/FT0/calibration/src/EventsPerBcCalibrator.cxx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| // Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| // All rights not expressly granted are reserved. | ||
| // | ||
| // This software is distributed under the terms of the GNU General Public | ||
| // License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // In applying this license CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
| #include "FT0Calibration/EventsPerBcCalibrator.h" | ||
| #include "CommonUtils/MemFileHelper.h" | ||
|
|
||
| namespace o2::ft0 | ||
| { | ||
| void EventsPerBcContainer::print() const | ||
| { | ||
| LOG(info) << entries << " entries"; | ||
| } | ||
|
|
||
| void EventsPerBcContainer::fill(const o2::dataformats::TFIDInfo& ti, const gsl::span<const o2::ft0::Digit> data) | ||
| { | ||
| size_t oldEntries = entries; | ||
| for (const auto& digit : data) { | ||
| double isVertex = digit.mTriggers.getVertex(); | ||
| if (digit.mTriggers.getAmplA() < mMinAmplitudeSideA || digit.mTriggers.getAmplC() < mMinAmplitudeSideC) { | ||
| continue; | ||
| } | ||
| mTvx[digit.mIntRecord.bc] += isVertex; | ||
| entries += isVertex; | ||
| } | ||
| LOG(debug) << "Container is filled with " << entries - oldEntries << " new events"; | ||
| } | ||
|
|
||
| void EventsPerBcContainer::merge(const EventsPerBcContainer* prev) | ||
| { | ||
| for (int bc = 0; bc < o2::constants::lhc::LHCMaxBunches; bc++) { | ||
| mTvx[bc] += prev->mTvx[bc]; | ||
| } | ||
| entries += prev->entries; | ||
| } | ||
|
|
||
| void EventsPerBcCalibrator::initOutput() | ||
| { | ||
| mTvxPerBcs.clear(); | ||
| mTvxPerBcInfos.clear(); | ||
| } | ||
|
|
||
| EventsPerBcCalibrator::EventsPerBcCalibrator(uint32_t minNumberOfEntries, int32_t minAmplitudeSideA, int32_t minAmplitudeSideC) : mMinNumberOfEntries(minNumberOfEntries), mMinAmplitudeSideA(minAmplitudeSideA), mMinAmplitudeSideC(minAmplitudeSideC) | ||
| { | ||
| LOG(info) << "Defined threshold for number of entires per slot: " << mMinNumberOfEntries; | ||
| LOG(info) << "Defined threshold for side A amplitude for event: " << mMinAmplitudeSideA; | ||
| LOG(info) << "Defined threshold for side C amplitude for event: " << mMinAmplitudeSideC; | ||
| } | ||
|
|
||
| bool EventsPerBcCalibrator::hasEnoughData(const EventsPerBcCalibrator::Slot& slot) const | ||
| { | ||
| return slot.getContainer()->entries > mMinNumberOfEntries; | ||
| } | ||
|
|
||
| void EventsPerBcCalibrator::finalizeSlot(EventsPerBcCalibrator::Slot& slot) | ||
| { | ||
| LOG(info) << "Finalizing slot from " << slot.getStartTimeMS() << " to " << slot.getEndTimeMS(); | ||
| o2::ft0::EventsPerBcContainer* data = slot.getContainer(); | ||
| mTvxPerBcs.emplace_back(data->mTvx); | ||
|
|
||
| auto clName = o2::utils::MemFileHelper::getClassName(mTvxPerBcs.back()); | ||
| auto flName = o2::ccdb::CcdbApi::generateFileName(clName); | ||
|
|
||
| std::map<std::string, std::string> metaData; | ||
| mTvxPerBcInfos.emplace_back(std::make_unique<o2::ccdb::CcdbObjectInfo>("FT0/Calib/EventsPerBcContainer", clName, flName, metaData, slot.getStartTimeMS(), slot.getEndTimeMS())); | ||
| LOG(info) << "Created object valid from " << mTvxPerBcInfos.back()->getStartValidityTimestamp() << " to " << mTvxPerBcInfos.back()->getEndValidityTimestamp(); | ||
| } | ||
|
|
||
| EventsPerBcCalibrator::Slot& EventsPerBcCalibrator::emplaceNewSlot(bool front, TFType tstart, TFType tend) | ||
| { | ||
| auto& cont = getSlots(); | ||
| auto& slot = front ? cont.emplace_front(tstart, tend) : cont.emplace_back(tstart, tend); | ||
| slot.setContainer(std::make_unique<EventsPerBcContainer>(mMinAmplitudeSideA, mMinAmplitudeSideC)); | ||
| return slot; | ||
| } | ||
| } // namespace o2::ft0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply
?