-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[QC-910] Moving windows in asynchronous QC (#2014)
* [QC-910] Moving windows in asynchronous QC This commit allows to create objects containing data points for adjacent time windows alongside of having an integrated object for the whole run. The window length is set by the usual "cycleDurationSeconds" parameter and the windows are guaranteed not to overlap. The generated objects can be subject to Checks, just as integrated objects. Technically, the commit brings a few major changes as well: - The decision on finishing a cycle is now up to Timekeeper (excluding end of stream), which is still timer-based in sync QC, but data-driven in async QC, i.e. a new cycle is started when a sample does not fall into currently processed window. - The QC file I/O has been refactored by bringing it into a dedicated class - The QC file structure was reorganized by having two directories at the top - "int" and "mw". The first contains the integrated plots in the usual structure. The latter contains moving windows in the hierarchy "mw/<DET>/<TASK>/<MW START>". This should allow for easy usage by any user scripts (at the cost of a bit more complex walking algorithms for reading it back in the QC chain) * documentation * explain what dataReady() does, rename to isDataReady * add an explanation for creating outputspecs for moving windows * improve logging in RootFileStorage, decrease verbosity of some * tidy up RootFileStorage.h
- Loading branch information
Showing
27 changed files
with
1,157 additions
and
186 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,101 @@ | ||
// 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 RootFileStorage.h | ||
/// \author Piotr Konopka | ||
/// | ||
|
||
#ifndef QUALITYCONTROL_ROOTFILESTORAGE_H | ||
#define QUALITYCONTROL_ROOTFILESTORAGE_H | ||
|
||
#include <string> | ||
#include <map> | ||
#include <variant> | ||
#include <vector> | ||
|
||
class TFile; | ||
class TDirectory; | ||
|
||
namespace o2::quality_control::core | ||
{ | ||
|
||
class MonitorObjectCollection; | ||
|
||
/// \brief Manager for storage and retrieval of MonitorObjectCollections in TFiles | ||
class RootFileStorage | ||
{ | ||
public: | ||
struct MonitorObjectCollectionNode { | ||
std::string fullPath{}; | ||
std::string name{}; | ||
MonitorObjectCollection* moc = nullptr; | ||
}; | ||
struct DirectoryNode { | ||
std::string fullPath{}; | ||
std::string name{}; | ||
std::map<std::string, std::variant<DirectoryNode, MonitorObjectCollectionNode>> children = {}; | ||
}; | ||
|
||
enum class ReadMode { | ||
Read, | ||
Update | ||
}; | ||
|
||
explicit RootFileStorage(const std::string& filePath, ReadMode); | ||
~RootFileStorage(); | ||
|
||
DirectoryNode readStructure(bool loadObjects = false) const; | ||
MonitorObjectCollection* readMonitorObjectCollection(const std::string& path) const; | ||
|
||
void storeIntegralMOC(MonitorObjectCollection* const moc); | ||
void storeMovingWindowMOC(MonitorObjectCollection* const moc); | ||
|
||
private: | ||
DirectoryNode readStructureImpl(TDirectory* currentDir, bool loadObjects) const; | ||
|
||
private: | ||
TFile* mFile = nullptr; | ||
}; | ||
|
||
/// \brief walks over integral MOC paths in the alphabetical order of detectors and task names | ||
class IntegralMocWalker | ||
{ | ||
public: | ||
explicit IntegralMocWalker(const RootFileStorage::DirectoryNode& rootNode); | ||
|
||
bool hasNextPath(); | ||
std::string nextPath(); | ||
|
||
private: | ||
using child_iterator = decltype(std::declval<RootFileStorage::DirectoryNode>().children.cbegin()); | ||
std::vector<std::string> mOrder; | ||
std::vector<std::string>::const_iterator mPathIterator; | ||
}; | ||
|
||
/// \brief walks over moving window MOC paths in the chronological order | ||
class MovingWindowMocWalker | ||
{ | ||
public: | ||
explicit MovingWindowMocWalker(const RootFileStorage::DirectoryNode& rootNode); | ||
|
||
bool hasNextPath() const; | ||
std::string nextPath(); | ||
|
||
private: | ||
using child_iterator = decltype(std::declval<RootFileStorage::DirectoryNode>().children.begin()); | ||
std::multimap<uint64_t, std::string> mOrder; | ||
std::multimap<uint64_t, std::string>::const_iterator mPathIterator; | ||
}; | ||
|
||
} // namespace o2::quality_control::core | ||
|
||
#endif // QUALITYCONTROL_ROOTFILESTORAGE_H |
This file contains 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 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 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 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 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 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 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 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 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.