Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

GfxStrip Class Reference

A graphical hit strip. More...

#include <GfxStrip.h>

List of all members.

Public Member Functions

 GfxStrip (const CandStripHandle &csh, GfxStripList &parent)
 GfxStrip (const GfxStrip &rhs)
GfxStripoperator= (const GfxStrip &rhs)
virtual ~GfxStrip ()
void Clear (Option_t *="")
void Configure ()
void ExecuteEvent (int event, int px, int py)
void Paint (Option_t *option="")
int DistancetoPrimitive (int px, int py)
const CandStripHandleGetStrip ()
void ConfigGui ()
Int_t GetColor ()
 GfxStrip (const CandStripHandle &csh, GfxStripList &parent)
 GfxStrip (const GfxStrip &rhs)
GfxStripoperator= (const GfxStrip &rhs)
 ~GfxStrip ()
void Clear (const Option_t *="")
void Configure ()
void ExecuteEvent (int event, int px, int py)
void Paint (Option_t *option="")
int DistancetoPrimitive (int px, int py)
const CandStripHandleGetStrip ()
void ConfigGui ()

Private Member Functions

bool GetRealCoords (double &x1, double &y1, double &x2, double &y2)
bool GetDiscreteCoords (double &x1, double &y1, double &x2, double &y2)
float GetRelativeValue (GfxStripListCfg::MeasureScale_t ms)
void ModifyCoords (double &cx, double &cy, double &dx, double &dy)
bool SetColor ()
void RelToAbs (double &dx, double &dy)
bool GetRealCoords (double &x1, double &y1, double &x2, double &y2)
bool GetDiscreteCoords (double &x1, double &y1, double &x2, double &y2)
float GetRelativeValue (GfxStripListCfg::MeasureScale_t ms)
void ModifyCoords (double &cx, double &cy, double &dx, double &dy)
bool SetColor ()
void RelToAbs (double &dx, double &dy)

Private Attributes

const CandStripHandlefStrip
GfxStripListfParent
TObject * fImp
Int_t fColor
double fCx
double fCy
double fDx
double fDy
const CandStripHandlefStrip
GfxStripListfParent
TObject * fImp


Detailed Description

A graphical hit strip.

Id
GfxStrip.h,v 1.5 2003/11/07 17:47:47 musser Exp

EVD

Contact: bv@bnl.gov

Created on: Wed Aug 21 17:17:10 2002

Definition at line 30 of file EventDisplay/GfxStrip.h.


Constructor & Destructor Documentation

GfxStrip::GfxStrip const CandStripHandle csh,
GfxStripList parent
 

Definition at line 30 of file EventDisplay/GfxStrip.cxx.

00031     : fStrip(&csh)
00032       ,fParent(&parent)
00033       ,fImp(0)
00034 {
00035 }

GfxStrip::GfxStrip const GfxStrip rhs  ) 
 

Definition at line 36 of file EventDisplay/GfxStrip.cxx.

00037     : TObject(),
00038       fStrip(rhs.fStrip), fParent(rhs.fParent), fImp(0)
00039 {
00040 }

GfxStrip::~GfxStrip  )  [virtual]
 

Definition at line 50 of file EventDisplay/GfxStrip.cxx.

References Clear().

00051 {
00052     this->Clear();
00053 }

GfxStrip::GfxStrip const CandStripHandle csh,
GfxStripList parent
 

GfxStrip::GfxStrip const GfxStrip rhs  ) 
 

GfxStrip::~GfxStrip  ) 
 


Member Function Documentation

void GfxStrip::Clear const Option_t *  = ""  ) 
 

Definition at line 55 of file EventDisplay/GfxStrip.cxx.

References fImp.

00056 {
00057   if (fImp) delete fImp; fImp=0;
00058 }

void GfxStrip::Clear Option_t *  = ""  ) 
 

Referenced by ~GfxStrip().

void GfxStrip::ConfigGui  ) 
 

void GfxStrip::ConfigGui  ) 
 

Definition at line 318 of file EventDisplay/GfxStrip.cxx.

References fParent, GfxStripList::GetCfg(), and GfxCfg::GuiConfig().

00319 {
00320     if (!fParent) return;
00321     GfxStripListCfg& cfg = fParent->GetCfg();
00322     cfg.GuiConfig();
00323 
00324 }

void GfxStrip::Configure  ) 
 

void GfxStrip::Configure  ) 
 

Definition at line 217 of file EventDisplay/GfxStrip.cxx.

References fCx, fCy, fDx, fDy, fImp, fParent, GfxStripList::GetCfg(), GetDiscreteCoords(), GetRealCoords(), GfxStripListCfg::GetScaleIs(), GfxStripListCfg::GetShapeIs(), ViewState::GetSpatialMetric(), GfxBase::GetViewState(), ModifyCoords(), and RelToAbs().

00218 {
00219 
00220     // here we make our imp.
00221     if (fImp) { delete fImp; fImp = 0; }
00222 
00223     GfxStripListCfg& cfg = fParent->GetCfg();
00224 
00225     fCx = fCy = fDx = fDy = 0.0;
00226 
00227 
00228     switch (fParent->GetViewState()->GetSpatialMetric()) {
00229     case ViewState::metric_is_continuous:
00230         this->GetRealCoords(fCx,fCy,fDx,fDy);
00231         break;
00232     case ViewState::metric_is_discreet: default:
00233         this->GetDiscreteCoords(fCx,fCy,fDx,fDy);
00234         break;
00235     }
00236 
00237 
00238     double dx = fDx, dy = fDy;
00239     if (cfg.GetScaleIs() == GfxStripListCfg::kAbsolute) {
00240         fDx = 1.5;
00241         fDy = 6.0;
00242         this->ModifyCoords(fCx,fCy,fDx,fDy);
00243         this->RelToAbs(dx,dy);
00244     }
00245     else {
00246         this->ModifyCoords(fCx,fCy,fDx,fDy);
00247     }
00248     switch (cfg.GetShapeIs()) {
00249     case GfxStripListCfg::kEllipse: 
00250         fImp = new TEllipse(fCx,fCy,dx,dy);
00251         break;
00252     default:
00253         fImp = new TBox(fCx+dx,fCy+dy,fCx-dx,fCy-dy);
00254         break;
00255     }
00256 
00257     TAttFill* att_fill = dynamic_cast<TAttFill*>(fImp);
00258     if (att_fill) {
00259       att_fill->SetFillStyle(1001);
00260     } 
00261 
00262 //    cerr << "GfxStrip::Configure (" << cx << "," << cy << ")\n";
00263 
00264 }

int GfxStrip::DistancetoPrimitive int  px,
int  py
 

int GfxStrip::DistancetoPrimitive int  px,
int  py
 

Definition at line 305 of file EventDisplay/GfxStrip.cxx.

References fImp.

00306 {
00307     if (fImp) return fImp->DistancetoPrimitive(px,py);
00308     return 0xdead;
00309 }

void GfxStrip::ExecuteEvent int  event,
int  px,
int  py
 

void GfxStrip::ExecuteEvent int  event,
int  px,
int  py
 

Definition at line 267 of file EventDisplay/GfxStrip.cxx.

References GfxStripList::ExecuteEvent(), and fParent.

00268 {
00269     fParent->ExecuteEvent(event,px,py,this);
00270 }

Int_t GfxStrip::GetColor  )  [inline]
 

Definition at line 50 of file EventDisplay/GfxStrip.h.

00050 {return fColor;}

bool GfxStrip::GetDiscreteCoords double &  x1,
double &  y1,
double &  x2,
double &  y2
[private]
 

bool GfxStrip::GetDiscreteCoords double &  x1,
double &  y1,
double &  x2,
double &  y2
[private]
 

Definition at line 71 of file EventDisplay/GfxStrip.cxx.

References fStrip, PlexPlaneId::GetPlane(), PlexStripEndId::GetStrip(), and CandStripHandle::GetStripEndId().

Referenced by Configure().

00072 {
00073     PlexStripEndId seid = fStrip->GetStripEndId();
00074     cx = seid.GetPlane();
00075     cy = seid.GetStrip();
00076     dx = 1.5;
00077     dy = 1.5;
00078     return true;
00079 }

bool GfxStrip::GetRealCoords double &  x1,
double &  y1,
double &  x2,
double &  y2
[private]
 

bool GfxStrip::GetRealCoords double &  x1,
double &  y1,
double &  x2,
double &  y2
[private]
 

Definition at line 59 of file EventDisplay/GfxStrip.cxx.

References fStrip, UgliStripHandle::GetHalfThickness(), UgliStripHandle::GetHalfWidth(), CandStripHandle::GetStripEndId(), UgliStripHandle::GetTPos(), CandHandle::GetVldContext(), UgliStripHandle::GlobalPos(), and UgliStripHandle::IsValid().

Referenced by Configure().

00060 {
00061     UgliGeomHandle ugh(*fStrip->GetVldContext());
00062     UgliStripHandle ush = ugh.GetStripHandle(fStrip->GetStripEndId());
00063     if (!ush.IsValid()) return false;
00064 
00065     cx = ush.GlobalPos(0).Z();
00066     cy = ush.GetTPos();
00067     dx = 1.5*ush.GetHalfThickness();
00068     dy = 1.5*ush.GetHalfWidth();
00069     return true;
00070 }

float GfxStrip::GetRelativeValue GfxStripListCfg::MeasureScale_t  ms  )  [private]
 

float GfxStrip::GetRelativeValue GfxStripListCfg::MeasureScale_t  ms  )  [private]
 

Definition at line 81 of file EventDisplay/GfxStrip.cxx.

References fParent, fStrip, CandStripHandle::GetCharge(), Mint::GetChargeRange(), GfxStripList::GetMint(), CandStripHandle::GetTime(), Mint::GetTimeRange(), Range< TYPE >::Max(), Range< TYPE >::Min(), and RangeDouble.

Referenced by ModifyCoords().

00082 {
00083     if (ms == GfxStripListCfg::kCharge) {
00084         RangeDouble& qrange = fParent->GetMint().GetChargeRange();
00085         double den = qrange.Min() - qrange.Max();
00086         if (den > 0)
00087             return (fStrip->GetCharge() - qrange.Min()) / den;
00088     }
00089     else {                      // time
00090         RangeDouble& trange = fParent->GetMint().GetTimeRange();
00091         double den = trange.Max() - trange.Min();
00092         if (den > 0)
00093             return (fStrip->GetTime() - trange.Min()) / den;
00094     }
00095     return 1.0;
00096 }

const CandStripHandle& GfxStrip::GetStrip  )  [inline]
 

Definition at line 46 of file Midad/MultiPage/GfxStrip.h.

00046 { return *fStrip; }

const CandStripHandle& GfxStrip::GetStrip  )  [inline]
 

Definition at line 47 of file EventDisplay/GfxStrip.h.

Referenced by GfxStripList::ExecuteEvent(), and GfxStripList::ExecuteEventStrip().

00047 { return *fStrip; }

void GfxStrip::ModifyCoords double &  cx,
double &  cy,
double &  dx,
double &  dy
[private]
 

void GfxStrip::ModifyCoords double &  cx,
double &  cy,
double &  dx,
double &  dy
[private]
 

Definition at line 98 of file EventDisplay/GfxStrip.cxx.

References fParent, fStrip, GfxStripList::GetCfg(), PlexStripEndId::GetEnd(), GetRelativeValue(), GfxStripListCfg::GetSizeBy(), GfxStripListCfg::GetSizeFactor(), GfxStripListCfg::GetSizeIs(), GfxStripListCfg::GetStripEnd(), CandStripHandle::GetStripEndId(), and logify_relative().

Referenced by Configure().

00099 {
00100     int strip_sign = 0;
00101     StripEnd::StripEnd_t end = fStrip->GetStripEndId().GetEnd();
00102     if (end == StripEnd::kNegative) strip_sign = -1;
00103     if (end == StripEnd::kPositive) strip_sign = +1;
00104 
00105     GfxStripListCfg& cfg = fParent->GetCfg();
00106     
00107     // Scale down size of strip
00108     GfxStripListCfg::SizeBy_t sb = cfg.GetSizeBy();
00109     double size_scale = this->GetRelativeValue(cfg.GetSizeIs());
00110 
00111     size_scale *= cfg.GetSizeFactor();
00112 
00113     switch (sb) {
00114     case GfxStripListCfg::kFixed:
00115         // nothing
00116         break;
00117     case GfxStripListCfg::kLinear:
00118         dx *= size_scale;
00119         dy *= size_scale;
00120         break;
00121     case GfxStripListCfg::kLogLinear:
00122         dx *= logify_relative(size_scale);
00123         dy *= logify_relative(size_scale);
00124         break;
00125     case GfxStripListCfg::kLogArea:
00126         dx *= logify_relative(sqrt(size_scale));
00127         dy *= logify_relative(sqrt(size_scale));
00128         break;
00129     case GfxStripListCfg::kArea: default:
00130         dx *= sqrt(size_scale);
00131         dy *= sqrt(size_scale);
00132         break;
00133     }
00134 
00135     // modify for any odd shape
00136     GfxStripListCfg::StripEnd_t si = cfg.GetStripEnd();
00137     switch (si) {
00138     case GfxStripListCfg::kHalf:
00139         dy *= strip_sign * 0.5;
00140         cy += dy;
00141         break;
00142     case GfxStripListCfg::kBowTie:
00143         dx *= strip_sign * 0.5;
00144         dy *= strip_sign * 0.5;
00145         cx += dx;
00146         cy += dy;
00147         break;
00148     case GfxStripListCfg::kFull: 
00149         // fall through
00150     case GfxStripListCfg::kBit:
00151         // fall through
00152     default:
00153         // do nothing
00154         break;
00155     }    
00156 }

GfxStrip& GfxStrip::operator= const GfxStrip rhs  ) 
 

GfxStrip & GfxStrip::operator= const GfxStrip rhs  ) 
 

Definition at line 41 of file EventDisplay/GfxStrip.cxx.

References fImp, fParent, and fStrip.

00042 {
00043     if (this == &rhs) return *this;
00044     fStrip = rhs.fStrip;
00045     fParent = rhs.fParent;
00046     fImp = 0;
00047     return *this;
00048 }

void GfxStrip::Paint Option_t *  option = ""  ) 
 

void GfxStrip::Paint Option_t *  option = ""  ) 
 

Definition at line 271 of file EventDisplay/GfxStrip.cxx.

References fCx, fCy, fImp, fParent, GfxStripList::GetCfg(), GfxStripListCfg::GetScaleIs(), GfxStripListCfg::GetShapeIs(), option, RelToAbs(), and SetColor().

00272 {
00273     if (!fImp) return;
00274 
00275     if (!this->SetColor()) return;
00276 
00277 
00278     GfxStripListCfg& cfg = fParent->GetCfg();
00279     if (cfg.GetScaleIs() == GfxStripListCfg::kAbsolute) {
00280         double dx, dy;
00281         this->RelToAbs(dx,dy);
00282 
00283         switch (cfg.GetShapeIs()) {
00284         case GfxStripListCfg::kEllipse: {
00285             TEllipse* el= dynamic_cast<TEllipse*>(fImp);
00286             el->SetR1(dx);
00287             el->SetR2(dy);
00288             el->Paint(option);
00289             break;
00290         }
00291         default:
00292             TBox* box = dynamic_cast<TBox*>(fImp);
00293             box->SetX1(fCx+dx);
00294             box->SetY1(fCy+dy);
00295             box->SetX2(fCx-dx);
00296             box->SetY2(fCy-dy);
00297             box->Paint();
00298             break;
00299         }
00300     }
00301     else {
00302         fImp->Paint(option);
00303     }
00304 }

void GfxStrip::RelToAbs double &  dx,
double &  dy
[private]
 

void GfxStrip::RelToAbs double &  dx,
double &  dy
[private]
 

Definition at line 311 of file EventDisplay/GfxStrip.cxx.

References fDx, and fDy.

Referenced by Configure(), and Paint().

00312 {
00313     dx = gPad->AbsPixeltoX((int)fDx) - gPad->AbsPixeltoX(0);
00314     dy = gPad->AbsPixeltoY((int)fDy) - gPad->AbsPixeltoY(0);
00315 //    cerr << Form("dx=%f(%f)  dy=%f(%f)",fDx,dx,fDy,dy) << endl;
00316 }

bool GfxStrip::SetColor  )  [private]
 

bool GfxStrip::SetColor  )  [private]
 

Definition at line 158 of file EventDisplay/GfxStrip.cxx.

References fColor, fParent, fStrip, EVD::GetCandEvent(), EVD::GetCandSlice(), CandStripHandle::GetCharge(), CandHandle::GetDaughterIterator(), GfxStripList::GetEVD(), EVD::GetGhostColor(), GfxStripList::GetStripColor(), and CandHandle::IsCloneOf().

Referenced by Paint().

00159 {
00160   int fColor=fParent->GetStripColor(*fStrip);
00161   Bool_t ghost=false;
00162 
00163   if(fParent->GetEVD()->GetCandSlice()){
00164     TIter stripItr(fParent->GetEVD()->GetCandSlice()->GetDaughterIterator());
00165     while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>
00166            (stripItr())){
00167       if(strip){
00168         CandStripHandle csh1 = *strip;
00169         CandStripHandle csh2 = *fStrip;
00170         if(csh1==csh2 ||  csh1.IsCloneOf(csh2)){
00171           ghost=true;
00172           break;
00173         }
00174       }
00175       
00176     } 
00177   }
00178   else if (fParent->GetEVD()->GetCandEvent()){
00179  
00180     ghost=true;
00181     TIter stripItr(fParent->GetEVD()->GetCandEvent()->GetDaughterIterator());
00182     while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>
00183            (stripItr())){
00184       if(strip){
00185         CandStripHandle csh = *strip;
00186         if(*strip==*fStrip ||  fStrip->IsCloneOf(csh)){
00187           ghost=true;
00188           break;
00189         }
00190       }
00191     }
00192   }
00193   if(!ghost){
00194     fColor = fParent->GetStripColor(*fStrip);
00195     if(fStrip->GetCharge(CalDigitType::kPE)<5)fColor=10;
00196     if(fStrip->GetCharge(CalDigitType::kPE)<2)fColor=20;
00197 
00198   }
00199   else{
00200     fColor=fParent->GetEVD()->GetGhostColor();
00201   }
00202   if (!fColor) {
00203     return false;
00204   }
00205 
00206 
00207     TAttFill* att_fill = dynamic_cast<TAttFill*>(fImp);
00208     if (!att_fill) return false;
00209     att_fill->SetFillColor(fColor);
00210     TAttLine* att_line = dynamic_cast<TAttLine*>(fImp);
00211     if (!att_line) return false;
00212     att_line->SetLineColor(fColor);
00213     att_line->SetLineWidth(1);
00214     return true;
00215 }


Member Data Documentation

Int_t GfxStrip::fColor [private]
 

Definition at line 67 of file EventDisplay/GfxStrip.h.

Referenced by SetColor().

double GfxStrip::fCx [private]
 

Definition at line 65 of file Midad/MultiPage/GfxStrip.h.

Referenced by Configure(), and Paint().

double GfxStrip::fCy [private]
 

Definition at line 65 of file Midad/MultiPage/GfxStrip.h.

Referenced by Configure(), and Paint().

double GfxStrip::fDx [private]
 

Definition at line 65 of file Midad/MultiPage/GfxStrip.h.

Referenced by Configure(), and RelToAbs().

double GfxStrip::fDy [private]
 

Definition at line 65 of file Midad/MultiPage/GfxStrip.h.

Referenced by Configure(), and RelToAbs().

TObject* GfxStrip::fImp [private]
 

Definition at line 63 of file Midad/MultiPage/GfxStrip.h.

TObject* GfxStrip::fImp [private]
 

Definition at line 66 of file EventDisplay/GfxStrip.h.

Referenced by Clear(), Configure(), DistancetoPrimitive(), operator=(), and Paint().

GfxStripList* GfxStrip::fParent [private]
 

Definition at line 62 of file Midad/MultiPage/GfxStrip.h.

GfxStripList* GfxStrip::fParent [private]
 

Definition at line 65 of file EventDisplay/GfxStrip.h.

Referenced by ConfigGui(), Configure(), ExecuteEvent(), GetRelativeValue(), ModifyCoords(), operator=(), Paint(), and SetColor().

const CandStripHandle* GfxStrip::fStrip [private]
 

Definition at line 61 of file Midad/MultiPage/GfxStrip.h.

const CandStripHandle* GfxStrip::fStrip [private]
 

Definition at line 64 of file EventDisplay/GfxStrip.h.

Referenced by GetDiscreteCoords(), GetRealCoords(), GetRelativeValue(), ModifyCoords(), operator=(), and SetColor().


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 11:58:24 2007 for loon by  doxygen 1.3.9.1