Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:36:00

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 "Generic1D.h"
0014 #include <AIDA/IProfile1D.h>
0015 #include <Gaudi/Histograming/Sink/Utils.h>
0016 #include <GaudiKernel/DataObject.h>
0017 #include <TProfile.h>
0018 
0019 #include <nlohmann/json.hpp>
0020 
0021 /*
0022  *    Gaudi namespace
0023  */
0024 namespace Gaudi {
0025 
0026   /**@class Profile1D
0027    *
0028    * AIDA implementation for 1 D profiles using ROOT TProfile
0029    *
0030    * @author  M.Frank
0031    */
0032   class GAUDI_API Profile1D : public DataObject, public Generic1D<AIDA::IProfile1D, TProfile> {
0033     typedef AIDA::IAnnotation IAnnotation;
0034 
0035   private:
0036     void init( const std::string& title, bool initialize_axis = true );
0037 
0038   public:
0039     /// Default Constructor
0040     Profile1D();
0041     /// Standard constructor with initialization. The histogram representation will be adopted
0042     Profile1D( TProfile* rep );
0043 
0044     /// Fill the Profile1D with a value and the corresponding weight.
0045     bool         fill( double x, double y, double weight = 1. ) override;
0046     virtual bool setBinContents( int i, int entries, double height, double error, double spread, double centre );
0047     friend void  reset( Profile1D& h ) { h.reset(); }
0048     /// conversion to json via nlohmann library
0049     friend void to_json( nlohmann::json& j, Profile1D const& p ) { j = *p.m_rep.get(); }
0050     /// Retrieve reference to class defininition identifier
0051     const CLID&        clID() const override { return classID(); }
0052     static const CLID& classID() { return CLID_ProfileH; }
0053 
0054   private:
0055     std::mutex m_fillSerialization;
0056 
0057   }; // end class IProfile1D
0058 } // end namespace Gaudi