The Gaudi Framework  v37r1 (a7f61348)
P2D.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 #pragma once
12 
13 #include "Generic2D.h"
14 #include <AIDA/IProfile1D.h>
16 #include <GaudiKernel/DataObject.h>
17 #include <TProfile2D.h>
18 
19 #include <nlohmann/json.hpp>
20 
21 namespace Gaudi {
22 
29  class GAUDI_API Profile2D : public DataObject, public Generic2D<AIDA::IProfile2D, TProfile2D> {
30  public:
32  Profile2D() : Base( new TProfile2D() ) {
33  m_classType = "IProfile2D";
34  m_rep->SetErrorOption( "s" );
35  m_rep->SetDirectory( nullptr );
36  }
38  Profile2D( TProfile2D* rep );
39 
41  bool fill( double x, double y, double z, double weight ) override {
42  // avoid race conditions when filling the profile
43  auto guard = std::scoped_lock{ m_fillSerialization };
44  m_rep->Fill( x, y, z, weight );
45  return true;
46  }
47  friend void reset( Profile2D& h ) { h.reset(); }
49  friend void to_json( nlohmann::json& j, Profile2D const& p ) { j = *p.m_rep.get(); }
51  const CLID& clID() const override { return classID(); }
52  static const CLID& classID() { return CLID_ProfileH2; }
53 
54  private:
56  };
57 } // namespace Gaudi
Gaudi::Profile2D
Definition: P2D.h:29
Gaudi::Profile2D::to_json
friend void to_json(nlohmann::json &j, Profile2D const &p)
conversion to json via nlohmann library
Definition: P2D.h:49
Gaudi::Profile2D::classID
static const CLID & classID()
Definition: P2D.h:52
jsonFromLHCbLog.json
json
Definition: jsonFromLHCbLog.py:87
Gaudi::Profile2D::fill
bool fill(double x, double y, double z, double weight) override
Fill bin content.
Definition: P2D.h:41
std::unique_ptr::get
T get(T... args)
Gaudi::Profile2D::clID
const CLID & clID() const override
Retrieve reference to class defininition identifier.
Definition: P2D.h:51
Utils.h
Gaudi::Profile2D::Profile2D
Profile2D()
Default Constructor.
Definition: P2D.h:32
ProduceConsume.j
j
Definition: ProduceConsume.py:101
AlgSequencer.h
h
Definition: AlgSequencer.py:32
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
Gaudi::Profile2D::m_fillSerialization
std::mutex m_fillSerialization
Definition: P2D.h:55
Gaudi::Generic2D::m_rep
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition: Generic2D.h:162
DataObject.h
Generic2D.h
DataObject
Definition: DataObject.h:40
std::mutex
STL class.
Gaudi::Generic2D
Definition: Generic2D.h:46
Gaudi::Profile2D::reset
friend void reset(Profile2D &h)
Definition: P2D.h:47
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81