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

Muc2DStrip Class Reference

#include <Muc2DStrip.h>

List of all members.

Public Member Functions

virtual void AddInfo (TString info)
virtual void AddInfo (TString info)
virtual void ClearInfo ()
virtual void ClearInfo ()
virtual void CloseInfo ()
virtual void CloseInfo ()
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
virtual void Draw (Option_t *option="")
virtual void Draw (Option_t *option="")
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
Double_t GetAngle (Double_t x, Double_t y)
Double_t GetAngle (Double_t x, Double_t y)
virtual Int_t GetGap ()
virtual Int_t GetGap ()
virtual char * GetObjectInfo (Int_t px, Int_t py) const
virtual char * GetObjectInfo (Int_t px, Int_t py) const
virtual Int_t GetPart ()
virtual Int_t GetPart ()
virtual Int_t GetSeg ()
virtual Int_t GetSeg ()
virtual Int_t GetStrip ()
virtual Int_t GetStrip ()
virtual bool IsFired ()
virtual bool IsFired ()
virtual bool IsHighlighted ()
virtual bool IsHighlighted ()
virtual bool IsZRVisible ()
virtual bool IsZRVisible ()
 Muc2DStrip (const char *name, const char *title, Int_t N, Double_t *P, Int_t part, Int_t seg, Int_t gap, Int_t strip)
 Muc2DStrip ()
 Muc2DStrip (const char *name, const char *title, Int_t N, Double_t *P, Int_t part, Int_t seg, Int_t gap, Int_t strip)
 Muc2DStrip ()
virtual void Paint (Option_t *option="")
virtual void Paint (Option_t *option="")
Double_t Range360 (Double_t input)
Double_t Range360 (Double_t input)
virtual void SetFired (bool status=true)
virtual void SetFired (bool status=true)
virtual void SetHighlighted (bool status=true)
virtual void SetHighlighted (bool status=true)
virtual void SetStyle ()
virtual void SetStyle ()
 ~Muc2DStrip ()
 ~Muc2DStrip ()

Private Attributes

Int_t fcStrip
Int_t fcStripFired
Int_t fcStripHL
bool fFired
Int_t fGap
bool fHighlighted
std::vector< TString > fInfoCon
std::vector< TString > fInfoCon
Int_t fPart
Int_t fSeg
Int_t fsStrip
Int_t fsStripFired
Int_t fsStripHL
Int_t fStrip
BesPolygon2DfStripXY
BesPolygon2DfStripXY
BesPolygon2DfStripZR
BesPolygon2DfStripZR
BesPaveTextfTip
BesPaveTextfTip
Int_t lcStrip
Int_t lcStripFired
Int_t lcStripHL
Int_t lsStrip
Int_t lsStripFired
Int_t lsStripHL
Int_t lwStrip
Int_t lwStripFired
Int_t lwStripHL

Static Private Attributes

const Int_t m_kDrawLineRange = 2000


Constructor & Destructor Documentation

Muc2DStrip::Muc2DStrip  ) 
 

Muc2DStrip::Muc2DStrip const char *  name,
const char *  title,
Int_t  N,
Double_t *  P,
Int_t  part,
Int_t  seg,
Int_t  gap,
Int_t  strip
 

00024 {
00025     SetName(name);
00026     SetTitle(title);
00027     fTip = 0;
00028     fHighlighted = false;
00029     fFired = false;
00030     fPart  = part;
00031     fSeg   = seg;
00032     fGap   = gap;
00033     fStrip = strip;
00034 
00035     // ------XY------
00036 
00037     Double_t Pxy[3*4];
00038     for (Int_t i = 0; i < 4; i++) {
00039         if (part == 1) {
00040             Int_t iXYSeq[8] = {1,0,4,5, 2,3,7,6}; // center of 1+2, 0+3, 4+7, 5+6
00041             for (Int_t j = 0; j < 3; j++) {
00042                 Pxy[3*i+j] = ( P[3*iXYSeq[i]+j] + P[3*(iXYSeq[i+4])+j] )/2.0;
00043             }
00044         }
00045         else {
00046             Int_t iXYSeq[8] = {0,1,2,3, 4,5,6,7}; // center of 0+4, 1+5, 2+6, 3+7
00047             for (Int_t j = 0; j < 3; j++) {
00048                 Pxy[3*i+j] = ( P[3*iXYSeq[i]+j] + P[3*(iXYSeq[i+4])+j] )/2.0;
00049             }
00050         }
00051     }
00052 
00053     fStripXY      = new BesPolygon2D(name, title, 4, &Pxy[0]);
00054 
00055     // ------ZR------
00056 
00057     Double_t Pzr[3*6];
00058     Int_t nzrPoints = 6;
00059     if (part == 1) {
00060         Int_t iZRSeq[6] = {4,5,1,2,6,7}; //{1,2,6,5, 0,3,7,4}; // center of 0+4, 1+5, 2+6, 3+7
00061         for (Int_t i = 0; i < nzrPoints; i++) {
00062             for (Int_t j = 0; j < 3; j++) {
00063                 Pzr[3*i+j] = P[3*iZRSeq[i]+j]; // ( P[3*iZRSeq[i]+j] + P[3*(iZRSeq[i+4])+j] )/2.0;
00064             }
00065         }
00066     }
00067     else {
00068         nzrPoints = 6;
00069         Int_t iZRSeq[6] = {1,2,3,7,6,5};
00070         for (Int_t i = 0; i < nzrPoints; i++) {
00071             for (Int_t j = 0; j < 3; j++) {
00072                 Pzr[3*i+j] = P[3*iZRSeq[i]+j];
00073             }
00074         }
00075     }
00076 
00077     fStripZR      = new BesPolygon2D(name, title, nzrPoints, &Pzr[0]);
00078 
00079     // Init
00080 
00081     SetStyle();
00082 
00083     fTip = new BesPaveText(0, 0, 0.1, 0.1);
00084     CloseInfo();
00085 }

Muc2DStrip::~Muc2DStrip  ) 
 

00089                         {
00090 
00091     if (fStripXY)  delete fStripXY;
00092     if (fStripZR)  delete fStripZR;
00093 }

Muc2DStrip::Muc2DStrip  ) 
 

Muc2DStrip::Muc2DStrip const char *  name,
const char *  title,
Int_t  N,
Double_t *  P,
Int_t  part,
Int_t  seg,
Int_t  gap,
Int_t  strip
 

Muc2DStrip::~Muc2DStrip  ) 
 


Member Function Documentation

virtual void Muc2DStrip::AddInfo TString  info  )  [inline, virtual]
 

00035 { fInfoCon.push_back(info); }

virtual void Muc2DStrip::AddInfo TString  info  )  [inline, virtual]
 

00035 { fInfoCon.push_back(info); }

virtual void Muc2DStrip::ClearInfo  )  [virtual]
 

void Muc2DStrip::ClearInfo  )  [virtual]
 

00118 {
00119     fInfoCon.clear();
00120     fTip->DeleteText();
00121 }

virtual void Muc2DStrip::CloseInfo  )  [virtual]
 

void Muc2DStrip::CloseInfo  )  [virtual]
 

00124 {
00125     if (fTip) {
00126         fTip->Clear();
00127 
00128         if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
00129         fTip->SetText(fInfoCon);
00130     }
00131     else
00132         cout << "Muc2DStrip::CloseInfo, not initialized" << endl;
00133 }

virtual Int_t Muc2DStrip::DistancetoPrimitive Int_t  px,
Int_t  py
[virtual]
 

Int_t Muc2DStrip::DistancetoPrimitive Int_t  px,
Int_t  py
[virtual]
 

00137                                                         {
00138 
00139     BesView *view = (BesView*)gPad->GetView();
00140     if ( view->GetViewType() & kXYView && fStripXY &&
00141             ( view->GetVisMucStrips()  || (view->GetVisMucHitsGlobal() && this->IsFired()) )  ) {
00142         return fStripXY->DistancetoPrimitive(px, py);
00143     }
00144     else if ( view->GetViewType() & kZRView && fStripZR &&
00145               ( (view->GetVisMucStrips() && this->IsZRVisible()) ||
00146                 (view->GetVisMucHitsGlobal() && this->IsFired() && this->IsZRVisible()) )  ) {
00147         return fStripZR->DistancetoPrimitive(px, py);
00148     }
00149 
00150     return 9999;
00151 }

virtual void Muc2DStrip::Draw Option_t *  option = ""  )  [virtual]
 

void Muc2DStrip::Draw Option_t *  option = ""  )  [virtual]
 

00202                                       {
00203     //
00204     // Muc2DStrip draw function
00205     TString opt = option;
00206     opt.ToUpper();
00207 
00208     AppendPad(option);
00209 }

virtual void Muc2DStrip::ExecuteEvent Int_t  event,
Int_t  px,
Int_t  py
[virtual]
 

void Muc2DStrip::ExecuteEvent Int_t  event,
Int_t  px,
Int_t  py
[virtual]
 

00155                                                              {
00156 
00157     //cout << GetName() << endl;
00158     BesView *view = (BesView*)gPad->GetView();
00159 
00160     if (gBesCursor->GetType() == kBesHand) {
00161         if (view) view->ExecuteEvent(event, px, py);
00162     }
00163     else if (gBesCursor->GetType() == kBesPick){
00164 
00165         if (gPad) gPad->SetCursor(kPointer);
00166 
00167         switch (event) {
00168 
00169         case kMouseEnter :
00170             this->SetHighlighted(true);
00171 
00172             Draw();
00173 
00174             fTip->SetPos(px, py);
00175             view->UpdateView(0);
00176 
00177             fTip->Draw("BR,SAME"); // "BR,ARC,SAME"
00178             gPad->Modified();
00179             gPad->Update();
00180 
00181             break;
00182 
00183         case kMouseLeave:
00184             if (this->IsHighlighted()) {
00185                 this->SetHighlighted(false);
00186                 //if (view->GetVisMucHitsGlobal())
00187                 Draw();
00188 
00189                 view->UpdateView(0);
00190                 gPad->Modified();
00191                 gPad->Update();
00192                 break;
00193             }
00194         }
00195 
00196         //if (view) view->ExecuteEvent(event, px, py);
00197     }
00198 }

Double_t Muc2DStrip::GetAngle Double_t  x,
Double_t  y
 

Double_t Muc2DStrip::GetAngle Double_t  x,
Double_t  y
 

00361 {
00362     Double_t angle = TMath::ACos( x/TMath::Sqrt(x*x+y*y) ) * TMath::RadToDeg();
00363     if ( y<0.0 ) angle *= -1;
00364     angle = Range360(angle);
00365 
00366     return angle;
00367 }

virtual Int_t Muc2DStrip::GetGap  )  [inline, virtual]
 

00045 { return fGap; }

virtual Int_t Muc2DStrip::GetGap  )  [inline, virtual]
 

00045 { return fGap; }

virtual char* Muc2DStrip::GetObjectInfo Int_t  px,
Int_t  py
const [virtual]
 

char * Muc2DStrip::GetObjectInfo Int_t  px,
Int_t  py
const [virtual]
 

00321                                                         {
00322 
00323     BesView *view = (BesView*)gPad->GetView();
00324     if (view) return view->GetObjectInfo(px, py);
00325     else return TObject::GetObjectInfo(px, py);
00326 }

virtual Int_t Muc2DStrip::GetPart  )  [inline, virtual]
 

00043 { return fPart; }

virtual Int_t Muc2DStrip::GetPart  )  [inline, virtual]
 

00043 { return fPart; }

virtual Int_t Muc2DStrip::GetSeg  )  [inline, virtual]
 

00044 { return fSeg; }

virtual Int_t Muc2DStrip::GetSeg  )  [inline, virtual]
 

00044 { return fSeg; }

virtual Int_t Muc2DStrip::GetStrip  )  [inline, virtual]
 

00046 { return fStrip; }

virtual Int_t Muc2DStrip::GetStrip  )  [inline, virtual]
 

00046 { return fStrip; }

virtual bool Muc2DStrip::IsFired  )  [inline, virtual]
 

00033 { return fFired; }

virtual bool Muc2DStrip::IsFired  )  [inline, virtual]
 

00033 { return fFired; }

virtual bool Muc2DStrip::IsHighlighted  )  [inline, virtual]
 

00032 { return fHighlighted; }

virtual bool Muc2DStrip::IsHighlighted  )  [inline, virtual]
 

00032 { return fHighlighted; }

virtual bool Muc2DStrip::IsZRVisible  )  [virtual]
 

Bool_t Muc2DStrip::IsZRVisible  )  [virtual]
 

00331 {
00332     BesView *view = (BesView*)gPad->GetView();
00333     Double_t viewPhi = view->GetLongitude();
00334     viewPhi = Range360(viewPhi);
00335 
00336     if (fPart != 1) {
00337         if ( (Int_t)viewPhi % 90 == 0 ) return true;
00338         else return false;
00339     }
00340     else {
00341         Int_t viewSeg = Int_t(viewPhi/45.0+0.5);
00342         //cout << "viewSeg " << viewSeg << endl;
00343         Int_t upSeg   = viewSeg-2;
00344         Int_t downSeg = viewSeg+2;
00345         if (upSeg   < 0) upSeg   += 8;
00346         else if (upSeg   >= 8) upSeg   -= 8;
00347         if (downSeg < 0) downSeg += 8;
00348         else if (downSeg >= 8) downSeg -= 8;
00349         //if (fStrip == 0) cout << GetName() << " upSeg " << upSeg << " downSeg " << downSeg << endl;
00350 
00351         if ( (Int_t)viewPhi % 45 == 0 && (fSeg == upSeg || fSeg == downSeg) ) return true;
00352         else return false;
00353     }
00354 
00355     return false;
00356 }

virtual void Muc2DStrip::Paint Option_t *  option = ""  )  [virtual]
 

void Muc2DStrip::Paint Option_t *  option = ""  )  [virtual]
 

00213                                        {
00214 
00215     TString opt = option;
00216     opt.ToUpper();
00217 
00218     BesView *view = (BesView*)gPad->GetView();
00219     Double_t min[3], max[3];
00220     view->GetRange(&min[0], &max[0]);
00221     Double_t maxRange = 0.0;
00222     Double_t range[3];
00223     for (Int_t i = 0; i < 3; i++) {
00224         range[i] = fabs(max[i] - min[i]);
00225         if (range[i] > maxRange) maxRange = range[i];
00226     }
00227 
00228     if (view->GetViewType() & kXYView) {
00229 
00230         if (fStripXY) {
00231             fStripXY->SetLineColor(lcStrip);
00232             fStripXY->SetLineWidth(lwStrip);
00233             fStripXY->SetLineStyle(lsStrip);
00234             fStripXY->SetFillColor(fcStrip);
00235             fStripXY->SetFillStyle(fsStrip);
00236         }
00237 
00238         if (this->IsFired()) {
00239             if (fStripXY) {
00240                 fStripXY->SetLineColor(lcStripFired);
00241                 if (maxRange > m_kDrawLineRange && fPart == 1)
00242                     fStripXY->SetLineColor(fcStripFired); // too small makes it hard to see
00243                 fStripXY->SetLineWidth(lwStripFired);
00244                 fStripXY->SetLineStyle(lsStripFired);
00245                 fStripXY->SetFillColor(fcStripFired);
00246                 fStripXY->SetFillStyle(fsStripFired);
00247             }
00248         }
00249 
00250         if (this->IsHighlighted()) {
00251             if (fStripXY) {
00252                 fStripXY->SetLineColor(lcStripHL);
00253                 if (maxRange > m_kDrawLineRange && fPart == 1)
00254                     fStripXY->SetLineColor(fcStripHL); // too small makes it hard to see
00255                 fStripXY->SetLineWidth(lwStripHL);
00256                 fStripXY->SetLineStyle(lsStripHL);
00257                 fStripXY->SetFillColor(fcStripHL);
00258                 fStripXY->SetFillStyle(fsStripHL);
00259             }
00260         }
00261 
00262         if ( fStripXY && view->GetVisMucStrips() ) fStripXY->Paint();
00263         if (this->IsFired()) {
00264             if (view->GetVisMucHitsGlobal() &&
00265                     ( (fPart == 0 && view->GetVisMucHitsEast())   ||
00266                       (fPart == 1 && view->GetVisMucHitsBarrel()) ||
00267                       (fPart == 2 && view->GetVisMucHitsWest()) )) {
00268                 fStripXY->Paint();
00269             }
00270         }
00271     }
00272 
00273     if (view->GetViewType() & kZRView) {
00274 
00275         if (fStripZR) {
00276             fStripZR->SetLineColor(lcStrip);
00277             fStripZR->SetLineWidth(lwStrip);
00278             fStripZR->SetLineStyle(lsStrip);
00279             fStripZR->SetFillColor(fcStrip);
00280             fStripZR->SetFillStyle(fsStrip);
00281         }
00282 
00283         if (this->IsFired()) {
00284             if (fStripZR) {
00285                 fStripZR->SetLineColor(lcStripFired);
00286                 if (maxRange > m_kDrawLineRange)
00287                     fStripZR->SetLineColor(fcStripFired); // too small makes it hard to see
00288                 fStripZR->SetLineWidth(lwStripFired);
00289                 fStripZR->SetLineStyle(lsStripFired);
00290                 fStripZR->SetFillColor(fcStripFired);
00291                 fStripZR->SetFillStyle(fsStripFired);
00292             }
00293         }
00294 
00295         if (this->IsHighlighted()) {
00296             if (fStripZR) {
00297                 fStripZR->SetLineColor(lcStripHL);
00298                 if (maxRange > m_kDrawLineRange)
00299                     fStripZR->SetLineColor(fcStripHL); // too small makes it hard to see
00300                 fStripZR->SetLineWidth(lwStripHL);
00301                 fStripZR->SetLineStyle(lsStripHL);
00302                 fStripZR->SetFillColor(fcStripHL);
00303                 fStripZR->SetFillStyle(fsStripHL);
00304             }
00305         }
00306 
00307         if ( fStripZR && view->GetVisMucStrips() && IsZRVisible() ) fStripZR->Paint();
00308         if (this->IsFired() && IsZRVisible() ) {
00309             if (view->GetVisMucHitsGlobal() &&
00310                     ( (fPart == 0 && view->GetVisMucHitsEast())   ||
00311                       (fPart == 1 && view->GetVisMucHitsBarrel()) ||
00312                       (fPart == 2 && view->GetVisMucHitsWest()) )) {
00313                 fStripZR->Paint();
00314             }
00315         }
00316     }
00317 }

Double_t Muc2DStrip::Range360 Double_t  input  ) 
 

Double_t Muc2DStrip::Range360 Double_t  input  ) 
 

00372 {
00373     if (input >= 360.0) {
00374         do {
00375             input -= 360.0;
00376         }
00377         while (input >= 360.0);
00378     }
00379     else if (input < 0.0) {
00380         do {
00381             input += 360.0;
00382         }
00383         while (input < 0.0);
00384     }
00385 
00386     return input;
00387 }

virtual void Muc2DStrip::SetFired bool  status = true  )  [inline, virtual]
 

00031 { fFired = status; }

virtual void Muc2DStrip::SetFired bool  status = true  )  [inline, virtual]
 

00031 { fFired = status; }

virtual void Muc2DStrip::SetHighlighted bool  status = true  )  [inline, virtual]
 

00030 { fHighlighted = status; }

virtual void Muc2DStrip::SetHighlighted bool  status = true  )  [inline, virtual]
 

00030 { fHighlighted = status; }

virtual void Muc2DStrip::SetStyle  )  [virtual]
 

void Muc2DStrip::SetStyle  )  [virtual]
 

00096 {
00097     lcStrip = 15;
00098     lwStrip = 1;
00099     lsStrip = 1;
00100     fcStrip = 1007; // lightBrown // 1005;  // lightBlue
00101     fsStrip = 1001;
00102 
00103     lcStripFired = 15; //kRed; //15
00104     lwStripFired = 1;
00105     lsStripFired = 1;
00106     fcStripFired = kRed;
00107     fsStripFired = 1001;
00108 
00109     lcStripHL = lcStrip;
00110     lwStripHL = 1;
00111     lsStripHL = 1;
00112     fcStripHL = kBlue;
00113     fsStripHL = 1001;
00114 
00115 }


Member Data Documentation

Int_t Muc2DStrip::fcStrip [private]
 

Int_t Muc2DStrip::fcStripFired [private]
 

Int_t Muc2DStrip::fcStripHL [private]
 

bool Muc2DStrip::fFired [private]
 

Int_t Muc2DStrip::fGap [private]
 

bool Muc2DStrip::fHighlighted [private]
 

std::vector<TString> Muc2DStrip::fInfoCon [private]
 

std::vector<TString> Muc2DStrip::fInfoCon [private]
 

Int_t Muc2DStrip::fPart [private]
 

Int_t Muc2DStrip::fSeg [private]
 

Int_t Muc2DStrip::fsStrip [private]
 

Int_t Muc2DStrip::fsStripFired [private]
 

Int_t Muc2DStrip::fsStripHL [private]
 

Int_t Muc2DStrip::fStrip [private]
 

BesPolygon2D* Muc2DStrip::fStripXY [private]
 

BesPolygon2D* Muc2DStrip::fStripXY [private]
 

BesPolygon2D* Muc2DStrip::fStripZR [private]
 

BesPolygon2D* Muc2DStrip::fStripZR [private]
 

BesPaveText* Muc2DStrip::fTip [private]
 

BesPaveText* Muc2DStrip::fTip [private]
 

Int_t Muc2DStrip::lcStrip [private]
 

Int_t Muc2DStrip::lcStripFired [private]
 

Int_t Muc2DStrip::lcStripHL [private]
 

Int_t Muc2DStrip::lsStrip [private]
 

Int_t Muc2DStrip::lsStripFired [private]
 

Int_t Muc2DStrip::lsStripHL [private]
 

Int_t Muc2DStrip::lwStrip [private]
 

Int_t Muc2DStrip::lwStripFired [private]
 

Int_t Muc2DStrip::lwStripHL [private]
 

const Int_t Muc2DStrip::m_kDrawLineRange = 2000 [static, private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:32:27 2011 for BOSS6.5.5 by  doxygen 1.3.9.1