Skip to content

Commit 80195a0

Browse files
justonedev1Michal Tichák
andauthored
[QC-1176] added tools to QC to check whether objects is mergeable (#13472)
* added tools to QC to check whether objects is mergeable * fix copyright, fix comment --------- Co-authored-by: Michal Tichák <michal.tichak@cern.ch>
1 parent 6fbc0f9 commit 80195a0

File tree

3 files changed

+91
-2
lines changed

3 files changed

+91
-2
lines changed

Utilities/Mergers/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# FIXME: the LinkDef should not be in the public area
1313

1414
o2_add_library(Mergers
15-
SOURCES src/MergerAlgorithm.cxx src/IntegratingMerger.cxx src/MergerInfrastructureBuilder.cxx
16-
src/MergerBuilder.cxx src/FullHistoryMerger.cxx src/ObjectStore.cxx
15+
SOURCES src/FullHistoryMerger.cxx src/IntegratingMerger.cxx src/Mergeable.cxx
16+
src/MergerAlgorithm.cxx src/MergerBuilder.cxx src/MergerInfrastructureBuilder.cxx
17+
src/ObjectStore.cxx
1718
PUBLIC_LINK_LIBRARIES O2::Framework AliceO2::InfoLogger)
1819

1920
o2_target_root_dictionary(
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2019-2024 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef ALICEO2_MERGERS_H
13+
#define ALICEO2_MERGERS_H
14+
15+
/// \file Mergeable.h
16+
/// \brief Mergeable concept.
17+
///
18+
/// \author Michal Tichak, michal.tichak@cern.ch
19+
20+
#include <concepts>
21+
22+
class TObject;
23+
class TH1;
24+
class TCollection;
25+
class TObjArray;
26+
class TH1;
27+
class TTree;
28+
class THnBase;
29+
class TEfficiency;
30+
class TGraph;
31+
class TCanvas;
32+
33+
namespace o2::mergers
34+
{
35+
36+
class MergeInterface;
37+
38+
template <typename T, typename... Ts>
39+
constexpr bool IsDerivedFrom = (std::derived_from<T, Ts> || ...);
40+
41+
// \brief Concept to be used to test if some parameter is mergeable
42+
//
43+
// \parameter T type to be restricted
44+
template <typename T>
45+
concept Mergeable = IsDerivedFrom<std::remove_pointer_t<T>, mergers::MergeInterface, TCollection, TH1, TTree, TGraph, TEfficiency, THnBase>;
46+
47+
// \brief runtime check whether TObject is mergeable
48+
bool isMergeable(TObject* obj);
49+
50+
} // namespace o2::mergers
51+
52+
#endif
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2019-2024 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#include <TCollection.h>
13+
#include <TEfficiency.h>
14+
#include <TGraph.h>
15+
#include <TH1.h>
16+
#include <THnBase.h>
17+
#include <TObject.h>
18+
#include <TTree.h>
19+
#include "Mergers/MergeInterface.h"
20+
#include "Mergers/Mergeable.h"
21+
22+
namespace o2::mergers
23+
{
24+
25+
bool isMergeable(TObject* obj)
26+
{
27+
return obj->InheritsFrom(mergers::MergeInterface::Class()) ||
28+
obj->InheritsFrom(TCollection::Class()) ||
29+
obj->InheritsFrom(TH1::Class()) ||
30+
obj->InheritsFrom(THnBase::Class()) ||
31+
obj->InheritsFrom(TTree::Class()) ||
32+
obj->InheritsFrom(TGraph::Class()) ||
33+
obj->InheritsFrom(TEfficiency::Class());
34+
}
35+
36+
} // namespace o2::mergers

0 commit comments

Comments
 (0)