-
Notifications
You must be signed in to change notification settings - Fork 508
TPC: Add sector edge fluctuation correction infrastructure #15532
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
matthias-kleiner
wants to merge
5
commits into
AliceO2Group:dev
Choose a base branch
from
matthias-kleiner:sectorEdge
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.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e24b99a
TPC splines: add a possibility to merge specific sectors
cbmsw aa951c4
TPC: Add sector edge fluctuation correction methods
matthias-kleiner 573c45b
clang-format
matthias-kleiner da99199
TPC: apply sector edge correction on default
matthias-kleiner 335d1a3
include missing header
matthias-kleiner 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
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
108 changes: 108 additions & 0 deletions
108
Detectors/TPC/calibration/include/TPCCalibration/SectorEdgeFluctuations.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,108 @@ | ||
| // 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. | ||
|
|
||
| /// \file SectorEdgeFluctuations.h | ||
| /// \brief Class to parse and query time-dependent TPC sector edge fluctuation intervals | ||
| /// \author Matthias Kleiner <matthias.kleiner@cern.ch> | ||
|
|
||
| #ifndef ALICEO2_TPC_SECTOREDGEFLUCTUATIONS_H | ||
| #define ALICEO2_TPC_SECTOREDGEFLUCTUATIONS_H | ||
|
|
||
| #include <map> | ||
| #include <vector> | ||
| #include <string> | ||
| #include <utility> | ||
| #include "Rtypes.h" | ||
|
|
||
| class TTree; | ||
|
|
||
| namespace o2::tpc | ||
| { | ||
|
|
||
| /// One time interval during which a set of TPC sectors has edge fluctuations. | ||
| /// Each sector carries an optional scaling factor (default 1.0). | ||
| struct SectorEdgeInterval { | ||
| Long64_t startTimeMS{0}; ///< interval start, Unix time in ms | ||
| Long64_t endTimeMS{0}; ///< interval end, Unix time in ms | ||
| std::vector<std::pair<int, float>> sectors; ///< {o2SectorId, scalingFactor} | ||
| ClassDefNV(SectorEdgeInterval, 1); | ||
| }; | ||
|
|
||
| /// Parses and queries TPC sector edge fluctuation intervals from a CSV text file. | ||
| /// | ||
| /// Expected line format (comma-separated, whitespace around tokens is ignored): | ||
| /// runNumber, startMS, endMS, durationMS, label[, SectorID[=scale], ...] | ||
| /// | ||
| /// The sector list is optional. If omitted (or all tokens fail to parse), the | ||
| /// interval is applied to all 36 sectors (A0-A17 and C0-C17) with scale 1.0. | ||
| /// | ||
| /// Examples: | ||
| /// 560352,1732244770094,1732244771094,1000,edge distortions,A3 | ||
| /// 560352,1732244771344,1732244776344,5000,edge distortions,A3=1.2,C0,C1=0.6,C2,C3 | ||
| /// | ||
| /// If the same sector appears in multiple overlapping intervals at a queried | ||
| /// timestamp, the scale from the interval with the latest end-time is used. | ||
| class SectorEdgeFluctuations | ||
| { | ||
| public: | ||
| /// Load intervals from file. Clears any previously loaded data. | ||
| /// Throws std::runtime_error if the file cannot be opened. | ||
| bool loadFromCSVFile(const std::string& filename); | ||
|
|
||
| /// dump this object to a file | ||
| /// \param file output file | ||
| /// \param name name of the output object | ||
| void dumpToFile(const char* file, const char* name = "ccdb_object", const char* brName = "SectorEdgeFluctuation"); | ||
|
|
||
| /// load from input file (which were written using the dumpToFile method) | ||
| /// \param inpf input file | ||
| /// \param name name of the object in the file | ||
| void loadFromFile(const char* inpf, const char* name = "ccdb_object", const int iEntry = 0, const char* brName = "SectorEdgeFluctuation"); | ||
|
|
||
| /// set this object from input tree | ||
| void setFromTree(TTree& tree, const int iEntry = 0, const char* brName = "SectorEdgeFluctuation"); | ||
|
|
||
| /// Returns all {o2SectorId, scalingFactor} pairs active for the given run | ||
| /// at the given Unix timestamp (milliseconds). Returns empty if none are active | ||
| /// or if the run is not known. | ||
| std::vector<std::pair<int, float>> getSectorsAtTime(int run, Long64_t timestampMS) const; | ||
|
|
||
| /// Convert a sector string such as "A3" or "C14" to the O2 integer sector | ||
| /// index (0-35). Returns -1 on parse error. | ||
| static int parseSectorId(const std::string& sectorStr); | ||
|
|
||
| /// Total number of intervals across all runs. | ||
| size_t size() const | ||
| { | ||
| size_t n = 0; | ||
| for (const auto& [run, v] : mIntervals) { | ||
| n += v.size(); | ||
| } | ||
| return n; | ||
| } | ||
|
|
||
| /// number of total runs stored | ||
| size_t getNRuns() const { return mIntervals.size(); } | ||
| bool empty() const { return mIntervals.empty(); } | ||
|
|
||
| /// get stored data | ||
| const auto& getIntervals() const { return mIntervals; } | ||
|
|
||
| private: | ||
| /// Per-run intervals, each sorted by startTimeMS. | ||
| std::map<int, std::vector<SectorEdgeInterval>> mIntervals; | ||
|
|
||
| ClassDefNV(SectorEdgeFluctuations, 1); | ||
| }; | ||
|
|
||
| } // namespace o2::tpc | ||
|
|
||
| #endif // ALICEO2_TPC_SECTOREDGEFLUCTUATIONS_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
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.
Uh oh!
There was an error while loading. Please reload this page.