28 using std::istringstream;
35 const string myname =
"test_shiftHistFit: ";
36 cout << myname <<
"Starting test" <<
endl;
37 cout << myname <<
"Shift is " << xshift <<
endl;
39 cout << myname <<
"NDEBUG must be off." <<
endl;
42 string line =
"-----------------------------";
45 cout << myname << line <<
endl;
46 cout <<
"Testing shifHistFit." <<
endl;
48 cout << myname << line <<
endl;
49 cout <<
"Build histogram" <<
endl;
54 double hx1 = x0 + xshift - 50.0;
55 double hx2 = x0 + xshift + 50.0;
57 double fx1 = x0 + xshift - 25.0;
58 double fx2 = x0 + xshift + 25.0;
60 TH1* ph =
new TH1F(
"hgau",
"My gaus", 100, hx1, hx2);
61 for (
int ient=0; ient<1000; ++ient ) {
62 ph->Fill(gRandom->Gaus(x0 + xshift, sig0));
65 cout << myname << line <<
endl;
66 cout <<
"Build function." <<
endl;
67 TF1* pf =
gausTF1(10.0, x0 + xshift + 0.3*sig0, 0.8*sig0,
"mygaus");
68 pf->SetRange(fx1, fx2);
79 string fnout =
"test_shiftHistFit.png";
80 cout << myname <<
"Printing " << fnout <<
endl;
88 int main(
int narg,
const char* argc[]) {
89 double xshift = 1000.0;
91 istringstream ssin(argc[1]);
int test_shiftHistFit(double xshift)
int add(unsigned int ipad, TObject *pobj, std::string sopt="", bool replace=false)
int shiftHistFit(TH1 *ph, TF1 *pf, std::string fopt, int ipar, double xshift)
TF1 * gausTF1(double heightIn, double meanIn, double sigmaIn, std::string fname)
int addAxis(bool flag=true)
Q_EXPORT QTSManip setw(int w)
void line(double t, double *p, double &x, double &y, double &z)
int main(int narg, const char *argc[])
int print(std::string fname, std::string spat="{,}")
QTextStream & endl(QTextStream &s)