Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v38r0 (2143aa4c)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
RootHistogramSink.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 
14 #include <GaudiKernel/Service.h>
15 #include <TH1D.h>
16 #include <TH2D.h>
17 #include <TH3D.h>
18 #include <TProfile.h>
19 #include <TProfile2D.h>
20 #include <TProfile3D.h>
21 
23 
24  namespace {
25  using namespace std::string_literals;
27  { { "histogram:Histogram"s, 1 }, &saveRootHisto<1, false, TH1D> },
28  { { "histogram:WeightedHistogram"s, 1 }, &saveRootHisto<1, false, TH1D> },
29  { { "histogram:Histogram"s, 2 }, &saveRootHisto<2, false, TH2D> },
30  { { "histogram:WeightedHistogram"s, 2 }, &saveRootHisto<2, false, TH2D> },
31  { { "histogram:Histogram"s, 3 }, &saveRootHisto<3, false, TH3D> },
32  { { "histogram:WeightedHistogram"s, 3 }, &saveRootHisto<3, false, TH3D> },
33  { { "histogram:ProfileHistogram"s, 1 }, &saveRootHisto<1, true, TProfile> },
34  { { "histogram:WeightedProfileHistogram"s, 1 }, &saveRootHisto<1, true, TProfile> },
35  { { "histogram:ProfileHistogram"s, 2 }, &saveRootHisto<2, true, TProfile2D> },
36  { { "histogram:WeightedProfileHistogram"s, 2 }, &saveRootHisto<2, true, TProfile2D> },
37  { { "histogram:ProfileHistogram"s, 3 }, &saveRootHisto<3, true, TProfile3D> },
38  { { "histogram:WeightedProfileHistogram"s, 3 }, &saveRootHisto<3, true, TProfile3D> } };
39  } // namespace
40 
41  struct Root : Base {
42  using Base::Base;
43 
44  StatusCode initialize() override {
45  return Base::initialize().andThen( [&] {
46  for ( auto& [id, func] : registry ) { registerHandler( id, func ); }
47  } );
48  }
49  };
50 
51  DECLARE_COMPONENT( Root )
52 
53 } // namespace Gaudi::Histograming::Sink
StatusCode::andThen
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Definition: StatusCode.h:163
gaudirun.s
string s
Definition: gaudirun.py:346
Gaudi::Histograming::Sink::Base::initialize
StatusCode initialize() override
Definition: Base.h:40
Utils.h
GaudiPluginService.cpluginsvc.registry
def registry()
Definition: cpluginsvc.py:83
StatusCode
Definition: StatusCode.h:65
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:235
Gaudi::Histograming::Sink
Definition: RootHistogramSink.cpp:22
Gaudi::Histograming::Sink::Base::registerHandler
void registerHandler(HistoIdentification const &id, HistoHandler const &func)
Definition: Base.h:69
Gaudi::Histograming::Sink::Root
Definition: RootHistogramSink.cpp:41
Base.h
std::map< HistoIdentification, HistoHandler >
Service.h
Gaudi::Histograming::Sink::Base::Base
Base(std::string name, ISvcLocator *svcloc)
Definition: Base.h:34
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
Gaudi::Histograming::Sink::Base
Definition: Base.h:28
Gaudi::Histograming::Sink::Root::initialize
StatusCode initialize() override
Definition: RootHistogramSink.cpp:44