14# pragma warning( disable : 2259 )
26 const std::string& title,
int nBins,
double xlow,
27 double xup,
double ylow,
double yup,
28 const std::string& opt ) {
29 auto _p =
new TProfile( title.c_str(), title.c_str(), nBins, xlow, xup, ylow, yup, opt.c_str() );
31 svcLocator->monitoringHub().registerEntity(
"", path,
"histogram:ProfileHistogram:double", *p );
36 const std::string& title,
const Edges& e,
double ylow,
37 double yup,
const std::string& opt ) {
39 new Profile1D(
new TProfile( title.c_str(), title.c_str(), e.size() - 1, &e.front(), ylow, yup, opt.c_str() ) );
40 svcLocator->monitoringHub().registerEntity(
"", path,
"histogram:ProfileHistogram:double", *p );
45 const AIDA::IProfile1D& hist ) {
48 if ( n ) {
svcLocator->monitoringHub().registerEntity(
"", path,
"histogram:ProfileHistogram:double", *n ); }
55 return int(
m_rep->GetBinEntries(
rIndex( index ) ) + 0.5 );
60 return className ==
"AIDA::IProfile1D"
61 ?
const_cast<AIDA::IProfile1D*
>(
static_cast<const AIDA::IProfile1D*
>( this ) )
62 : className ==
"AIDA::IProfile" ?
const_cast<AIDA::IProfile*
>(
static_cast<const AIDA::IProfile*
>( this ) )
63 : className ==
"AIDA::IBaseHistogram"
64 ?
const_cast<AIDA::IBaseHistogram*
>(
static_cast<const AIDA::IBaseHistogram*
>( this ) )
70 TProfile* imp =
dynamic_cast<TProfile*
>( rep );
71 if ( !imp )
throw std::runtime_error(
"Cannot adopt native histogram representation." );
74 const TArrayD* a =
m_rep->GetSumw2();
75 if ( !a || ( a && a->GetSize() == 0 ) )
m_rep->Sumw2();
88 if ( initialize_axis ) {
axis().initialize(
m_rep->GetXaxis(),
false ); }
90 m_rep->SetDirectory(
nullptr );
100 double sumwy2Bin = ( spread * spread + height * height ) *
entries;
101 m_rep->SetBinError(
rIndex( i ), sqrt( sumwy2Bin ) );
111 m_rep->Fill( x, y, weight );
int binEntries(int index) const override
Number of entries in the corresponding bin (ie the number of times fill was called for this bin).
std::string title() const override
void adoptRepresentation(TObject *rep) override
Adopt ROOT histogram representation.
void * cast(const std::string &cl) const override
Manual cast by class name.
bool setTitle(const std::string &title) override
Generic1D< AIDA::IProfile1D, TProfile > Base
virtual int rIndex(int index) const
std::unique_ptr< TH1D > m_rep
int entries() const override
bool setName(const std::string &newName)
AIDA implementation for 1 D profiles using ROOT TProfile.
Profile1D()
Default Constructor.
bool fill(double x, double y, double weight=1.) override
Fill the Profile1D with a value and the corresponding weight.
std::mutex m_fillSerialization
virtual bool setBinContents(int i, int entries, double height, double error, double spread, double centre)
void init(const std::string &title, bool initialize_axis=true)
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
GAUDI_API ISvcLocator * svcLocator()
std::pair< DataObject *, AIDA::IProfile1D * > createProf1D(ISvcLocator *svcLocator, const std::string &path, const AIDA::IProfile1D &hist)
Copy constructor.
T * getRepresentation(const Q &hist)