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() );
30 auto p =
new Profile1D( _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() ) );
45 const AIDA::IProfile1D& hist ) {
46 TProfile*
h = getRepresentation<AIDA::IProfile1D, TProfile>( hist );
47 auto n = (
h ?
new Profile1D(
new TProfile( *
h ) ) :
nullptr );
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." );
73 m_axis.initialize( m_rep->GetXaxis(),
true );
74 const TArrayD* a = m_rep->GetSumw2();
75 if ( !a || ( a && a->GetSize() == 0 ) ) m_rep->Sumw2();
76 setTitle( m_rep->GetTitle() );
85 m_classType =
"IProfile1D";
88 if ( initialize_axis ) { axis().initialize( m_rep->GetXaxis(),
false ); }
90 m_rep->SetDirectory(
nullptr );
96 m_rep->SetBinEntries( rIndex( i ), entries );
98 m_rep->SetBinContent( rIndex( i ), height * entries );
100 double sumwy2Bin = ( spread * spread + height * height ) * entries;
101 m_rep->SetBinError( rIndex( i ),
sqrt( sumwy2Bin ) );
102 m_sumEntries += entries;
104 m_rep->SetEntries( m_sumEntries );
110 auto guard = std::scoped_lock{ m_fillSerialization };
111 m_rep->Fill( x, y, weight );