1 #ifndef FRANKS1HISTO__HH
2 #define FRANKS1HISTO__HH
18 #ifdef ST_NO_TEMPLATE_DEF_ARGS
21 template<
class T =
double>
39 int bins, T xmin, T xmax);
43 #ifndef ST_NO_MEMBER_TEMPLATES
46 template<
class X>
void Fill( X value);
47 template<
class X,
class Y>
void Fill( X value, Y weight);
48 template<
class X>
int GetBin(X value);
49 template<
class X>
void Scale(X scale);
52 void Draw(
const char* c=
"");
53 void SetDirectory(
int dummy) { };
55 int GetNbinsX() {
return mBins; }
56 T GetBinContent(
int bin) {
return vec[bin]; }
57 T GetBinCenter(
int bin);
64 void Reset(
const char* c=
"");
79 mStep = (xmax-xmin)/bins;
93 #ifndef ST_NO_MEMBER_TEMPLATES
96 template<
class X,
class Y>
98 for (
int i=0; i < mBins; i++) {
99 vec[i] = h1->vec[i]*w1 + h2->vec[i]*w2;
104 template<
class X,
class Y>
106 for (
int i=0; i < mBins; i++) {
107 if (h2->vec[i]*w2 !=0 )
108 vec[i] = h1->vec[i]*w1 / h2->vec[i]*w2;
116 cout << c <<
" " << mC1 <<
" " << endl;
119 T step = (max-min)/50.;
120 cout <<
" minimum=" << min <<
" maximum=" << max <<
" step=" << step << endl;
121 for (
int i=0; i < mBins; i++) {
122 printf(
" (%3i) %+e %+e ",i, GetBinCenter(i), vec[i]);
123 for (
int j=0; j < floor( (vec[i]-min)/step ); j++) {
133 mPos = (int) abs( (value-mXmin)/mStep );
134 if ( mPos>=0 && mPos < mBins)
140 template<
class X,
class Y>
142 mPos = (int) abs( (value-mXmin)/mStep );
143 if ( mPos>=0 && mPos < mBins)
144 vec[mPos] = vec[mPos] + weight;
151 int bin = (int) floor( (value-mXmin)/mStep );
152 if( !(bin >=0 && bin < mBins) ) bin=-1;
159 if ( bin >=0 && bin < mBins)
160 center= mXmin + (0.5+bin)*mStep;
167 for (
int i=0; i< mBins; i++)
168 mean+=vec[i]*GetBinCenter(i);
176 for (
int i=0; i< mBins; i++) {
186 for (
int i=0; i< mBins; i++) {
196 for (
int i=0; i< mBins; i++)
197 mean+=vec[i]*GetBinCenter(i);
204 for (
int i=0; i < mBins; i++)
211 for (
int i=0; i < mBins; i++)
218 for (
int i=0; i < mBins; i++) {
228 #endif // FRANKS2DHISTO_HH