4 # pragma warning( disable : 2259 ) 10 # pragma warning( disable : 4996 ) 20 double xup,
double ylow,
double yup,
22 auto _p =
new TProfile( title.
c_str(), title.
c_str(), nBins, xlow, xup, ylow, yup, opt.
c_str() );
23 auto p =
new Profile1D( _p );
30 new Profile1D(
new TProfile( title.
c_str(), title.
c_str(), e.size() - 1, &e.front(), ylow, yup, opt.
c_str() ) );
35 TProfile* h = getRepresentation<AIDA::IProfile1D, TProfile>( hist );
36 auto n = ( h ?
new Profile1D(
new TProfile( *h ) ) : nullptr );
43 return int( m_rep->GetBinEntries( rIndex( index ) ) + 0.5 );
48 return className ==
"AIDA::IProfile1D" 49 ? const_cast<AIDA::IProfile1D*>( static_cast<const AIDA::IProfile1D*>(
this ) )
50 : className ==
"AIDA::IProfile" 51 ? const_cast<AIDA::IProfile*>( static_cast<const AIDA::IProfile*>(
this ) )
52 : className ==
"AIDA::IBaseHistogram" 53 ? const_cast<AIDA::IBaseHistogram*>( static_cast<const AIDA::IBaseHistogram*>(
this ) )
59 TProfile* imp = dynamic_cast<TProfile*>( rep );
60 if ( !imp )
throw std::runtime_error(
"Cannot adopt native histogram representation." );
62 m_axis.initialize( m_rep->GetXaxis(), true );
63 const TArrayD* a = m_rep->GetSumw2();
64 if ( !a || ( a && a->GetSize() == 0 ) ) m_rep->Sumw2();
65 setTitle( m_rep->GetTitle() );
74 m_classType =
"IProfile1D";
77 if ( initialize_axis ) { axis().initialize( m_rep->GetXaxis(), false ); }
79 m_rep->SetDirectory(
nullptr );
85 m_rep->SetBinEntries( rIndex( i ), entries );
87 m_rep->SetBinContent( rIndex( i ), height * entries );
89 double sumwy2Bin = ( spread * spread + height * height ) * entries;
90 m_rep->SetBinError( rIndex( i ),
sqrt( sumwy2Bin ) );
91 m_sumEntries += entries;
93 m_rep->SetEntries( m_sumEntries );
100 # pragma warning( disable : 1572 ) 105 ( weight == 1. ) ? m_rep->Fill( x, y ) : m_rep->Fill( x, y, weight );
void * cast(const std::string &cl) const override
Manual cast by class name.
virtual bool setBinContents(int i, int entries, double height, double error, double spread, double centre)
void adoptRepresentation(TObject *rep) override
Adopt ROOT histogram representation.
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
auto sqrt(std::chrono::duration< Rep, Period > d)
sqrt for std::chrono::duration
Profile1D()
Default Constructor.
int binEntries(int index) const override
Number of entries in the corresponding bin (ie the number of times fill was called for this bin).
bool fill(double x, double y, double weight=1.) override
Fill the Profile1D with a value and the corresponding weight.
void init(const std::string &title, bool initialize_axis=true)
Header file for std:chrono::duration-based Counters.
std::pair< DataObject *, AIDA::IProfile1D * > createProf1D(const AIDA::IProfile1D &hist)
Copy constructor.
Common AIDA implementation stuff for histograms and profiles using ROOT implementations.