-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[QC-1176] added tools to QC to check whether objects is mergeable (#1…
…3472) * added tools to QC to check whether objects is mergeable * fix copyright, fix comment --------- Co-authored-by: Michal Tichák <michal.tichak@cern.ch>
- Loading branch information
1 parent
6fbc0f9
commit 80195a0
Showing
3 changed files
with
91 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2019-2024 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 ALICEO2_MERGERS_H | ||
#define ALICEO2_MERGERS_H | ||
|
||
/// \file Mergeable.h | ||
/// \brief Mergeable concept. | ||
/// | ||
/// \author Michal Tichak, michal.tichak@cern.ch | ||
|
||
#include <concepts> | ||
|
||
class TObject; | ||
class TH1; | ||
class TCollection; | ||
class TObjArray; | ||
class TH1; | ||
class TTree; | ||
class THnBase; | ||
class TEfficiency; | ||
class TGraph; | ||
class TCanvas; | ||
|
||
namespace o2::mergers | ||
{ | ||
|
||
class MergeInterface; | ||
|
||
template <typename T, typename... Ts> | ||
constexpr bool IsDerivedFrom = (std::derived_from<T, Ts> || ...); | ||
|
||
// \brief Concept to be used to test if some parameter is mergeable | ||
// | ||
// \parameter T type to be restricted | ||
template <typename T> | ||
concept Mergeable = IsDerivedFrom<std::remove_pointer_t<T>, mergers::MergeInterface, TCollection, TH1, TTree, TGraph, TEfficiency, THnBase>; | ||
|
||
// \brief runtime check whether TObject is mergeable | ||
bool isMergeable(TObject* obj); | ||
|
||
} // namespace o2::mergers | ||
|
||
#endif |
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,36 @@ | ||
// Copyright 2019-2024 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 <TCollection.h> | ||
#include <TEfficiency.h> | ||
#include <TGraph.h> | ||
#include <TH1.h> | ||
#include <THnBase.h> | ||
#include <TObject.h> | ||
#include <TTree.h> | ||
#include "Mergers/MergeInterface.h" | ||
#include "Mergers/Mergeable.h" | ||
|
||
namespace o2::mergers | ||
{ | ||
|
||
bool isMergeable(TObject* obj) | ||
{ | ||
return obj->InheritsFrom(mergers::MergeInterface::Class()) || | ||
obj->InheritsFrom(TCollection::Class()) || | ||
obj->InheritsFrom(TH1::Class()) || | ||
obj->InheritsFrom(THnBase::Class()) || | ||
obj->InheritsFrom(TTree::Class()) || | ||
obj->InheritsFrom(TGraph::Class()) || | ||
obj->InheritsFrom(TEfficiency::Class()); | ||
} | ||
|
||
} // namespace o2::mergers |