#include "RooFit.h"
#include "RooEllipse.h"
#include "RooEllipse.h"
#include "TMath.h"
#include "RooMsgService.h"
#include "Riostream.h"
#include <math.h>
#include <assert.h>
ClassImp(RooEllipse)
RooEllipse::RooEllipse() { }
RooEllipse::~RooEllipse()
{
}
RooEllipse::RooEllipse(const char *name, Double_t x1, Double_t x2, Double_t s1, Double_t s2, Double_t rho, Int_t points) {
SetName(name);
SetTitle(name);
if(s1 <= 0 || s2 <= 0) {
coutE(InputArguments) << "RooEllipse::RooEllipse: bad parameter s1 or s2 < 0" << endl;
return;
}
Double_t tmp= 1-rho*rho;
if(tmp < 0) {
coutE(InputArguments) << "RooEllipse::RooEllipse: bad parameter |rho| > 1" << endl;
return;
}
if(tmp == 0) {
SetPoint(0,x1-s1,x2-s2);
SetPoint(1,x1+s1,x2+s2);
setYAxisLimits(x2-s2,x2+s2);
}
else {
Double_t r,psi,phi,u1,u2,xx1,xx2,dphi(2*TMath::Pi()/points);
for(Int_t index= 0; index < points; index++) {
phi= index*dphi;
psi= atan2(s2*sin(phi),s1*cos(phi));
u1= cos(psi)/s1;
u2= sin(psi)/s2;
r= sqrt(tmp/(u1*u1 - 2*rho*u1*u2 + u2*u2));
xx1= x1 + r*u1*s1;
xx2= x2 + r*u2*s2;
SetPoint(index, xx1, xx2);
if(index == 0) {
setYAxisLimits(xx2,xx2);
SetPoint(points, xx1, xx2);
}
else {
updateYAxisLimits(xx2);
}
}
}
}
void RooEllipse::printToStream(ostream& os, PrintOption opt, TString indent) const {
oneLinePrint(os,*this);
RooPlotable::printToStream(os,opt,indent);
if(opt == Verbose) {
for(Int_t index=0; index < fNpoints; index++) {
os << "Point [" << index << "] is at (" << fX[index] << "," << fY[index] << ")" << endl;
}
}
}
Last update: Thu Jan 17 08:44:34 2008
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.