4 #pragma warning(disable:2259)
10 #pragma warning(disable:4996)
19 int nBins ,
double xlow,
double xup,
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);
29 const Edges& e,
double ylow,
double yup ,
32 auto p =
new Profile1D(
new TProfile(title.
c_str(),title.
c_str(),e.size()-1,&e.front(),ylow,yup,opt.
c_str()));
37 TProfile *
h = getRepresentation<AIDA::IProfile1D,TProfile>(hist);
38 auto n = ( h ?
new Profile1D(
new TProfile(*h)) : nullptr );
45 return int(m_rep->GetBinEntries( rIndex(index) )+0.5);
49 if (className ==
"AIDA::IProfile1D")
50 return const_cast<AIDA::IProfile1D*
>((AIDA::IProfile1D*)
this);
51 else if (className ==
"AIDA::IProfile")
52 return const_cast<AIDA::IProfile*
>((AIDA::IProfile*)
this);
53 else if (className ==
"AIDA::IBaseHistogram")
54 return const_cast<AIDA::IBaseHistogram*
>((AIDA::IBaseHistogram*)
this);
60 TProfile* imp =
dynamic_cast<TProfile*
>(rep);
63 m_axis.initialize(m_rep->GetXaxis(),
true);
64 const TArrayD* a = m_rep->GetSumw2();
65 if ( !a || (a && a->GetSize()==0) ) m_rep->Sumw2();
66 setTitle(m_rep->GetTitle());
71 :
Base( new TProfile() )
83 m_classType =
"IProfile1D";
86 if ( initialize_axis ) {
87 axis().initialize(m_rep->GetXaxis(),
false);
90 m_rep->SetDirectory(
nullptr);
95 m_rep->SetBinEntries(rIndex(i), entries );
97 m_rep->SetBinContent(rIndex(i), height*entries );
99 double sumwy2Bin = ( spread*spread + height*height )*entries;
100 m_rep->SetBinError(rIndex(i), sqrt(sumwy2Bin) );
101 m_sumEntries += entries;
103 m_rep->SetEntries(m_sumEntries);
110 #pragma warning(disable:1572)
113 (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.
AIDA implementation for 1 D profiles using ROOT TProfile.
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.
string opt
print 'Summary: %32s [s] d d steps'%(summary.protocol,summary.type,summary.nevt,len(summary.data),)
Profile1D()
Default Constructor.
#define DECLARE_DATAOBJECT_FACTORY(x)
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.
std::pair< DataObject *, AIDA::IProfile1D * > createProf1D(const AIDA::IProfile1D &hist)
Copy constructor.
void init(const std::string &title, bool initialize_axis=true)
Helper functions to set/get the application return code.
Common AIDA implementation stuff for histograms and profiles using ROOT implementations.