// $Id$ // // Class AliMpSectorPainter // ------------------------ // Class for drawing a sector into canvas // Included in AliRoot: 2003/05/02 // Authors: David Guez, IPN Orsay #include #include #include #include "AliMpSectorPainter.h" #include "AliMpGraphContext.h" #include "AliMpSector.h" #include "AliMpZone.h" #include "AliMpSubZone.h" #include "AliMpRow.h" #include "AliMpVRowSegment.h" ClassImp(AliMpSectorPainter) //_______________________________________________________________________ AliMpSectorPainter::AliMpSectorPainter() :AliMpVPainter(), fSector(0) { // default dummy constructor } //_______________________________________________________________________ AliMpSectorPainter::AliMpSectorPainter(AliMpSector *sector) :AliMpVPainter(), fSector(sector) { // normal constructor } //_____________________________________________________________________________ AliMpSectorPainter::AliMpSectorPainter(const AliMpSectorPainter& right) : AliMpVPainter(right) { // copy constructor (not implemented) Fatal("AliMpSectorPainter", "Copy constructor not provided."); } //_______________________________________________________________________ AliMpSectorPainter::~AliMpSectorPainter() { // destructor } //_____________________________________________________________________________ AliMpSectorPainter& AliMpSectorPainter::operator=(const AliMpSectorPainter& right) { // assignement operator (not implemented) // check assignement to self if (this == &right) return *this; Fatal("operator =", "Assignement operator not provided."); return *this; } //_______________________________________________________________________ void AliMpSectorPainter::DumpObject() { // Draw the owned object fSector->Dump(); } //_______________________________________________________________________ TVector2 AliMpSectorPainter::GetPosition() const { // Get the owned object's position if (fSector->GetNofRows()<1) return TVector2(0.,0.); AliMpRow* row = fSector->GetRow(0); // bl = bottom left position; TVector2 bl = row->Position()-row->Dimensions(); // ur = upper right position TVector2 ur = row->Position()+row->Dimensions();; for (Int_t irow=1;irowGetNofRows();++irow){ row = fSector->GetRow(irow); // update the bottom-left corner if (bl.X()>row->Position().X()-row->Dimensions().X()) bl.Set(row->Position().X()-row->Position().X(),bl.Y()); if (bl.Y()>row->Position().Y()-row->Dimensions().Y()) bl.Set(bl.X(),row->Position().Y()-row->Dimensions().Y()); // update the upper-right corner if (ur.X()Position().X()+row->Dimensions().X()) ur.Set(row->Position().X()+row->Dimensions().X(),ur.Y()); if (ur.Y()Position().Y()+row->Dimensions().Y()) ur.Set(ur.X(),row->Position().Y()+row->Dimensions().Y()); } return (ur+bl)/2.; } //_______________________________________________________________________ TVector2 AliMpSectorPainter::GetDimensions() const { // Get the owned object's dimensions if (fSector->GetNofRows()<1) return TVector2(0.,0.); AliMpRow* row = fSector->GetRow(0); // bl = bottom left position TVector2 bl = row->Position()-row->Dimensions(); // ur = upper right position TVector2 ur = row->Position()+row->Dimensions(); for (Int_t irow=1;irowGetNofRows();++irow){ row = fSector->GetRow(irow); // update the bottom-left corner if (bl.X()>row->Position().X()-row->Dimensions().X()) bl.Set(row->Position().X()-row->Dimensions().X(),bl.Y()); if (bl.Y()>row->Position().Y()-row->Dimensions().Y()) bl.Set(bl.X(),row->Position().Y()-row->Dimensions().Y()); // update the upper-right corner if (ur.X()Position().X()+row->Dimensions().X()) ur.Set(row->Position().X()+row->Dimensions().X(),ur.Y()); if (ur.Y()Position().Y()+row->Dimensions().Y()) ur.Set(ur.X(),row->Position().Y()+row->Dimensions().Y()); } return (ur-bl)/2.; } //_______________________________________________________________________ void AliMpSectorPainter::Draw(Option_t *option) { // Draw the sector on the current pad // The first letter of