4 #pragma warning( disable : 2259 ) 10 #pragma warning( disable : 4996 ) 20 double xup,
double ylow,
double yup,
23 auto _p =
new TProfile( title.
c_str(), title.
c_str(), nBins, xlow, xup, ylow, yup, opt.
c_str() );
24 auto p =
new Profile1D( _p );
32 new Profile1D(
new TProfile( title.
c_str(), title.
c_str(), e.size() - 1, &e.front(), ylow, yup, opt.
c_str() ) );
38 TProfile* h = getRepresentation<AIDA::IProfile1D, TProfile>( hist );
39 auto n = ( h ?
new Profile1D(
new TProfile( *h ) ) : nullptr );
48 return int( m_rep->GetBinEntries( rIndex( index ) ) + 0.5 );
54 if ( className ==
"AIDA::IProfile1D" )
55 return const_cast<AIDA::IProfile1D*
>( (AIDA::IProfile1D*)
this );
56 else if ( className ==
"AIDA::IProfile" )
57 return const_cast<AIDA::IProfile*
>( (AIDA::IProfile*)
this );
58 else if ( className ==
"AIDA::IBaseHistogram" )
59 return const_cast<AIDA::IBaseHistogram*
>( (AIDA::IBaseHistogram*)
this );
66 TProfile* imp =
dynamic_cast<TProfile*
>( rep );
67 if ( !imp )
throw std::runtime_error(
"Cannot adopt native histogram representation." );
69 m_axis.initialize( m_rep->GetXaxis(), true );
70 const TArrayD* a = m_rep->GetSumw2();
71 if ( !a || ( a && a->GetSize() == 0 ) ) m_rep->Sumw2();
72 setTitle( m_rep->GetTitle() );
85 if ( initialize_axis ) {
89 m_rep->SetDirectory(
nullptr );
98 m_rep->SetBinContent(
rIndex( i ), height * entries );
100 double sumwy2Bin = ( spread * spread + height * height ) * entries;
101 m_rep->SetBinError(
rIndex( i ), sqrt( sumwy2Bin ) );
111 #pragma warning( disable : 1572 ) 115 ( 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.
int entries() const override
Get the number or all the entries.
std::vector< double > Edges
virtual bool setBinContents(int i, int entries, double height, double error, double spread, double centre)
void adoptRepresentation(TObject *rep) override
Adopt ROOT histogram representation.
Axis & axis()
Access to axis object.
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
bool setTitle(const std::string &title) override
Set the title of the object.
int binEntries(int index) const override
Number of entries in the corresponding bin (ie the number of times fill was called for this bin)...
Profile1D()
Default Constructor.
void initialize(TAxis *itaxi, bool)
bool fill(double x, double y, double weight=1.) override
Fill the Profile1D with a value and the corresponding weight.
virtual int rIndex(int index) const
operator methods
void init(const std::string &title, bool initialize_axis=true)
Helper functions to set/get the application return code.
std::pair< DataObject *, AIDA::IProfile1D * > createProf1D(const AIDA::IProfile1D &hist)
Copy constructor.
bool setName(const std::string &newName)
Set the name of the object.
Common AIDA implementation stuff for histograms and profiles using ROOT implementations.