-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tools to QC to check whether objects is mergeable
- Loading branch information
Michal Tichák
committed
Sep 3, 2024
1 parent
7ce6af5
commit e8bc3ca
Showing
3 changed files
with
92 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,53 @@ | ||
// Copyright 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 Ignore can disable whole concept, if user is really sure that he wants to pass anything into this | ||
// \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 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 |