![]() |
|
|||
File indexing completed on 2025-02-21 10:00:27
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 #pragma once 0012 0013 #include "AIDA/IHistogram2D.h" 0014 #include "Generic2D.h" 0015 #include <Gaudi/Histograming/Sink/Utils.h> 0016 #include <GaudiKernel/DataObject.h> 0017 #include <TH2D.h> 0018 0019 #include <nlohmann/json.hpp> 0020 0021 namespace Gaudi { 0022 class Histogram1D; 0023 0024 /**@class Histogram2D 0025 * 0026 * AIDA implementation for 2 D histograms using ROOT THD2 0027 * 0028 * @author M.Frank 0029 */ 0030 class GAUDI_API Histogram2D : public DataObject, public Generic2D<AIDA::IHistogram2D, TH2D> { 0031 public: 0032 /// Standard Constructor 0033 Histogram2D(); 0034 /// Standard initializing Constructor with TH2D representation to be adopted 0035 Histogram2D( TH2D* rep ); 0036 0037 /// Fill the Histogram2D with a value and the 0038 bool fill( double x, double y, double weight = 1. ) override; 0039 /// Fast filling method for a given bin. It can be also the over/underflow bin 0040 virtual bool setBinContents( int binIndexX, int binIndexY, int entries, double height, double error, double centreX, 0041 double centreY ); 0042 /// Sets the rms of the histogram. 0043 bool setRms( double rmsX, double rmsY ); 0044 // overwrite reset 0045 bool reset() override; 0046 // free function reset 0047 friend void reset( Histogram2D& h ) { h.reset(); } 0048 /// conversion to json via nlohmann library 0049 friend void to_json( nlohmann::json& j, Histogram2D const& h ) { j = *h.m_rep.get(); } 0050 /// Create new histogram from any AIDA based histogram 0051 void copyFromAida( const AIDA::IHistogram2D& h ); 0052 /// Retrieve reference to class defininition identifier 0053 const CLID& clID() const override { return classID(); } 0054 static const CLID& classID() { return CLID_H2D; } 0055 0056 protected: 0057 // cache sumwx and sumwy when setting contents since I don't have bin mean 0058 double m_sumwx = 0; 0059 double m_sumwy = 0; 0060 0061 private: 0062 std::mutex m_fillSerialization; 0063 }; 0064 } // namespace Gaudi
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |