// ------------------------------------------------------------------------- // ----- CbmVisSector source file ----- // ----- Created 14/03/07 by E. Kryshen ----- // ------------------------------------------------------------------------- #include "CbmVisSector.h" #include "TMath.h" // ------------------------------------------------------------------------- CbmVisSector::CbmVisSector(Double_t x0, Double_t y0, Double_t lx, Double_t ly, Double_t phi){ fX0=x0; fY0=y0; fLx=lx; fLy=ly; fPhi=phi; Double_t x[5] ,y[5]; // sector corners in the sector system Double_t xRot[5],yRot[5]; // sector corners in the global system Double_t cosphi = TMath::Cos(fPhi); Double_t sinphi = TMath::Sin(fPhi); x[1]=-lx/2; y[1]=+ly/2; x[2]=+lx/2; y[2]=+ly/2; x[0]=-lx/2; y[0]=-ly/2; x[3]=+lx/2; y[3]=-ly/2; for (Int_t i=0;i<4;i++) { xRot[i] = x0 + x[i]*cosphi - y[i]*sinphi; yRot[i] = y0 + x[i]*sinphi + y[i]*cosphi; } xRot[4]=xRot[0]; yRot[4]=yRot[0]; SetPolyLine(5,xRot,yRot); SetLineWidth(1); SetLineColor(34); SetFillColor(kYellow); } // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- TString CbmVisSector::GetInfo(){ return Form("Sector:(x0, y0)=(%.2f,%.2f), (lx,ly)=(%.1f, %.1f), Rot=%.0f", fX0,fY0,fLx,fLy,fPhi*TMath::RadToDeg()); } // ------------------------------------------------------------------------- ClassImp(CbmVisSector)