4 #pragma warning(disable:2259)
10 #pragma warning(disable:4996)
18 (
const std::string& title ,
19 int nBins ,
double xlow,
double xup,
20 double ylow,
double yup,
const std::string&
opt )
22 TProfile* _p =
new TProfile(title.c_str(),title.c_str(),nBins,xlow,xup,ylow,yup,opt.c_str() ) ;
23 Profile1D* p =
new Profile1D(_p);
24 return std::pair<DataObject*,AIDA::IProfile1D*>(p,p);
28 (
const std::string& title,
29 const Edges& e,
double ylow,
double yup ,
30 const std::string& opt )
32 Profile1D* p =
new Profile1D(
new TProfile(title.c_str(),title.c_str(),e.size()-1,&e.front(),ylow,yup,opt.c_str()));
33 return std::pair<DataObject*,AIDA::IProfile1D*>(p,p);
36 std::pair<DataObject*,AIDA::IProfile1D*>
Gaudi::createProf1D(
const AIDA::IProfile1D& hist) {
37 TProfile *h = getRepresentation<AIDA::IProfile1D,TProfile>(hist);
38 Profile1D *
n = h ?
new Profile1D(
new TProfile(*h)) : 0;
39 return std::pair<DataObject*,AIDA::IProfile1D*>(
n,
n);
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);
62 if ( m_rep )
delete m_rep;
64 m_axis.initialize(m_rep->GetXaxis(),
true);
65 const TArrayD* a = m_rep->GetSumw2();
66 if ( 0 == a || (a && a->GetSize()==0) ) m_rep->Sumw2();
67 setTitle(m_rep->GetTitle());
70 throw std::runtime_error(
"Cannot adopt native histogram representation.");
75 m_rep =
new TProfile();
81 init(m_rep->GetTitle());
85 m_classType =
"IProfile1D";
88 if ( initialize_axis ) {
89 axis().initialize(m_rep->GetXaxis(),
false);
92 m_rep->SetDirectory(0);
97 m_rep->SetBinEntries(rIndex(i), entries );
99 m_rep->SetBinContent(rIndex(i), height*entries );
101 double sumwy2Bin = ( spread*spread + height*height )*entries;
102 m_rep->SetBinError(rIndex(i), sqrt(sumwy2Bin) );
103 m_sumEntries += entries;
105 m_rep->SetEntries(m_sumEntries);
112 #pragma warning(disable:1572)
115 (weight == 1.) ? m_rep->Fill(x,y) : m_rep->Fill(x,y,weight);
119 typedef Gaudi::Profile1D
P1D;