#include <Muc2DStrip.h>
Public Member Functions | |
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 | SetStyle () |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
virtual void | SetHighlighted (bool status=true) |
virtual void | SetFired (bool status=true) |
virtual bool | IsHighlighted () |
virtual bool | IsFired () |
virtual void | AddInfo (TString info) |
virtual void | CloseInfo () |
virtual void | ClearInfo () |
virtual void | Draw (Option_t *option="") |
virtual void | Paint (Option_t *option="") |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
virtual Int_t | GetPart () |
virtual Int_t | GetSeg () |
virtual Int_t | GetGap () |
virtual Int_t | GetStrip () |
virtual bool | IsZRVisible () |
Double_t | GetAngle (Double_t x, Double_t y) |
Double_t | Range360 (Double_t input) |
Private Attributes | |
Int_t | fPart |
Int_t | fSeg |
Int_t | fGap |
Int_t | fStrip |
BesPolygon2D * | fStripXY |
BesPolygon2D * | fStripZR |
std::vector< TString > | fInfoCon |
BesPaveText * | fTip |
bool | fHighlighted |
bool | fFired |
Int_t | lcStrip |
Int_t | lwStrip |
Int_t | lsStrip |
Int_t | fcStrip |
Int_t | fsStrip |
Int_t | lcStripFired |
Int_t | lwStripFired |
Int_t | lsStripFired |
Int_t | fcStripFired |
Int_t | fsStripFired |
Int_t | lcStripHL |
Int_t | lwStripHL |
Int_t | lsStripHL |
Int_t | fcStripHL |
Int_t | fsStripHL |
Static Private Attributes | |
static const Int_t | m_kDrawLineRange = 2000 |
Definition at line 18 of file Muc2DStrip.h.
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 | |||
) |
Definition at line 25 of file Muc2DStrip.cxx.
References CloseInfo(), fFired, fGap, fHighlighted, fPart, fSeg, fStrip, fStripXY, fStripZR, fTip, genRecEmupikp::i, ganga-rec::j, and SetStyle().
00026 { 00027 SetName(name); 00028 SetTitle(title); 00029 fTip = 0; 00030 fHighlighted = false; 00031 fFired = false; 00032 fPart = part; 00033 fSeg = seg; 00034 fGap = gap; 00035 fStrip = strip; 00036 00037 // ------XY------ 00038 00039 Double_t Pxy[3*4]; 00040 for (Int_t i = 0; i < 4; i++) { 00041 if (part == 1) { 00042 Int_t iXYSeq[8] = {1,0,4,5, 2,3,7,6}; // center of 1+2, 0+3, 4+7, 5+6 00043 for (Int_t j = 0; j < 3; j++) { 00044 Pxy[3*i+j] = ( P[3*iXYSeq[i]+j] + P[3*(iXYSeq[i+4])+j] )/2.0; 00045 } 00046 } 00047 else { 00048 Int_t iXYSeq[8] = {0,1,2,3, 4,5,6,7}; // center of 0+4, 1+5, 2+6, 3+7 00049 for (Int_t j = 0; j < 3; j++) { 00050 Pxy[3*i+j] = ( P[3*iXYSeq[i]+j] + P[3*(iXYSeq[i+4])+j] )/2.0; 00051 } 00052 } 00053 } 00054 00055 fStripXY = new BesPolygon2D(name, title, 4, &Pxy[0]); 00056 00057 // ------ZR------ 00058 00059 Double_t Pzr[3*6]; 00060 Int_t nzrPoints = 6; 00061 if (part == 1) { 00062 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 00063 for (Int_t i = 0; i < nzrPoints; i++) { 00064 for (Int_t j = 0; j < 3; j++) { 00065 Pzr[3*i+j] = P[3*iZRSeq[i]+j]; // ( P[3*iZRSeq[i]+j] + P[3*(iZRSeq[i+4])+j] )/2.0; 00066 } 00067 } 00068 } 00069 else { 00070 nzrPoints = 6; 00071 Int_t iZRSeq[6] = {1,2,3,7,6,5}; 00072 for (Int_t i = 0; i < nzrPoints; i++) { 00073 for (Int_t j = 0; j < 3; j++) { 00074 Pzr[3*i+j] = P[3*iZRSeq[i]+j]; 00075 } 00076 } 00077 } 00078 00079 fStripZR = new BesPolygon2D(name, title, nzrPoints, &Pzr[0]); 00080 00081 // Init 00082 00083 SetStyle(); 00084 00085 fTip = new BesPaveText(0, 0, 0.1, 0.1); 00086 CloseInfo(); 00087 }
Muc2DStrip::~Muc2DStrip | ( | ) |
virtual void Muc2DStrip::AddInfo | ( | TString | info | ) | [inline, virtual] |
Definition at line 35 of file Muc2DStrip.h.
References fInfoCon.
Referenced by MucROOTGeo::SetHits().
00035 { fInfoCon.push_back(info); }
void Muc2DStrip::ClearInfo | ( | ) | [virtual] |
Definition at line 119 of file Muc2DStrip.cxx.
References fInfoCon, and fTip.
Referenced by MucROOTGeo::SetHits().
void Muc2DStrip::CloseInfo | ( | ) | [virtual] |
Definition at line 125 of file Muc2DStrip.cxx.
References fInfoCon, fTip, and BesPaveText::SetText().
Referenced by Muc2DStrip(), and MucROOTGeo::SetHits().
00126 { 00127 if (fTip) { 00128 fTip->Clear(); 00129 00130 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle()); 00131 fTip->SetText(fInfoCon); 00132 } 00133 else 00134 cout << "Muc2DStrip::CloseInfo, not initialized" << endl; 00135 }
Int_t Muc2DStrip::DistancetoPrimitive | ( | Int_t | px, | |
Int_t | py | |||
) | [virtual] |
Definition at line 139 of file Muc2DStrip.cxx.
References BesPolygon2D::DistancetoPrimitive(), fStripXY, fStripZR, BesView::GetViewType(), BesView::GetVisMucHitsGlobal(), BesView::GetVisMucStrips(), IsFired(), IsZRVisible(), kXYView, and kZRView.
00139 { 00140 00141 BesView *view = (BesView*)gPad->GetView(); 00142 if ( view->GetViewType() & kXYView && fStripXY && 00143 ( view->GetVisMucStrips() || (view->GetVisMucHitsGlobal() && this->IsFired()) ) ) { 00144 return fStripXY->DistancetoPrimitive(px, py); 00145 } 00146 else if ( view->GetViewType() & kZRView && fStripZR && 00147 ( (view->GetVisMucStrips() && this->IsZRVisible()) || 00148 (view->GetVisMucHitsGlobal() && this->IsFired() && this->IsZRVisible()) ) ) { 00149 return fStripZR->DistancetoPrimitive(px, py); 00150 } 00151 00152 return 9999; 00153 }
void Muc2DStrip::Draw | ( | Option_t * | option = "" |
) | [virtual] |
Definition at line 204 of file Muc2DStrip.cxx.
Referenced by MucROOTGeo::Draw(), MucROOTGeo::DrawHits(), and ExecuteEvent().
00204 { 00205 // 00206 // Muc2DStrip draw function 00207 TString opt = option; 00208 opt.ToUpper(); 00209 00210 AppendPad(option); 00211 }
void Muc2DStrip::ExecuteEvent | ( | Int_t | event, | |
Int_t | px, | |||
Int_t | py | |||
) | [virtual] |
Definition at line 157 of file Muc2DStrip.cxx.
References Draw(), fTip, gBesCursor, BesCursor::GetType(), kBesHand, kBesPick, SetHighlighted(), BesPaveText::SetPos(), and BesView::UpdateView().
00157 { 00158 00159 //cout << GetName() << endl; 00160 BesView *view = (BesView*)gPad->GetView(); 00161 00162 if (gBesCursor->GetType() == kBesHand) { 00163 if (view) view->ExecuteEvent(event, px, py); 00164 } 00165 else if (gBesCursor->GetType() == kBesPick){ 00166 00167 if (gPad) gPad->SetCursor(kPointer); 00168 00169 switch (event) { 00170 00171 case kMouseEnter : 00172 this->SetHighlighted(true); 00173 00174 Draw(); 00175 00176 fTip->SetPos(px, py); 00177 view->UpdateView(0); 00178 00179 fTip->Draw("BR,SAME"); // "BR,ARC,SAME" 00180 gPad->Modified(); 00181 gPad->Update(); 00182 00183 break; 00184 00185 case kMouseLeave: 00186 if (this->IsHighlighted()) { 00187 this->SetHighlighted(false); 00188 //if (view->GetVisMucHitsGlobal()) 00189 Draw(); 00190 00191 view->UpdateView(0); 00192 gPad->Modified(); 00193 gPad->Update(); 00194 break; 00195 } 00196 } 00197 00198 //if (view) view->ExecuteEvent(event, px, py); 00199 } 00200 }
Double_t Muc2DStrip::GetAngle | ( | Double_t | x, | |
Double_t | y | |||
) |
Definition at line 362 of file Muc2DStrip.cxx.
References Range360().
00363 { 00364 Double_t angle = TMath::ACos( x/TMath::Sqrt(x*x+y*y) ) * TMath::RadToDeg(); 00365 if ( y<0.0 ) angle *= -1; 00366 angle = Range360(angle); 00367 00368 return angle; 00369 }
virtual Int_t Muc2DStrip::GetGap | ( | ) | [inline, virtual] |
char * Muc2DStrip::GetObjectInfo | ( | Int_t | px, | |
Int_t | py | |||
) | const [virtual] |
Definition at line 323 of file Muc2DStrip.cxx.
References BesView::GetObjectInfo().
00323 { 00324 00325 BesView *view = (BesView*)gPad->GetView(); 00326 if (view) return view->GetObjectInfo(px, py); 00327 else return TObject::GetObjectInfo(px, py); 00328 }
virtual Int_t Muc2DStrip::GetPart | ( | ) | [inline, virtual] |
virtual Int_t Muc2DStrip::GetSeg | ( | ) | [inline, virtual] |
virtual Int_t Muc2DStrip::GetStrip | ( | ) | [inline, virtual] |
virtual bool Muc2DStrip::IsFired | ( | ) | [inline, virtual] |
Definition at line 33 of file Muc2DStrip.h.
References fFired.
Referenced by DistancetoPrimitive().
00033 { return fFired; }
virtual bool Muc2DStrip::IsHighlighted | ( | ) | [inline, virtual] |
Bool_t Muc2DStrip::IsZRVisible | ( | ) | [virtual] |
Definition at line 332 of file Muc2DStrip.cxx.
References fPart, fSeg, BesTView::GetLongitude(), and Range360().
Referenced by DistancetoPrimitive(), and Paint().
00333 { 00334 BesView *view = (BesView*)gPad->GetView(); 00335 Double_t viewPhi = view->GetLongitude(); 00336 viewPhi = Range360(viewPhi); 00337 00338 if (fPart != 1) { 00339 if ( (Int_t)viewPhi % 90 == 0 ) return true; 00340 else return false; 00341 } 00342 else { 00343 Int_t viewSeg = Int_t(viewPhi/45.0+0.5); 00344 //cout << "viewSeg " << viewSeg << endl; 00345 Int_t upSeg = viewSeg-2; 00346 Int_t downSeg = viewSeg+2; 00347 if (upSeg < 0) upSeg += 8; 00348 else if (upSeg >= 8) upSeg -= 8; 00349 if (downSeg < 0) downSeg += 8; 00350 else if (downSeg >= 8) downSeg -= 8; 00351 //if (fStrip == 0) cout << GetName() << " upSeg " << upSeg << " downSeg " << downSeg << endl; 00352 00353 if ( (Int_t)viewPhi % 45 == 0 && (fSeg == upSeg || fSeg == downSeg) ) return true; 00354 else return false; 00355 } 00356 00357 return false; 00358 }
void Muc2DStrip::Paint | ( | Option_t * | option = "" |
) | [virtual] |
Definition at line 215 of file Muc2DStrip.cxx.
References fcStrip, fcStripFired, fcStripHL, fPart, fsStrip, fsStripFired, fsStripHL, fStripXY, fStripZR, BesTView::GetRange(), BesView::GetViewType(), BesView::GetVisMucHitsBarrel(), BesView::GetVisMucHitsEast(), BesView::GetVisMucHitsGlobal(), BesView::GetVisMucHitsWest(), BesView::GetVisMucStrips(), genRecEmupikp::i, IsZRVisible(), kXYView, kZRView, lcStrip, lcStripFired, lcStripHL, lsStrip, lsStripFired, lsStripHL, lwStrip, lwStripFired, lwStripHL, m_kDrawLineRange, max, min, and genRecEmupikp::range.
00215 { 00216 00217 TString opt = option; 00218 opt.ToUpper(); 00219 00220 BesView *view = (BesView*)gPad->GetView(); 00221 Double_t min[3], max[3]; 00222 view->GetRange(&min[0], &max[0]); 00223 Double_t maxRange = 0.0; 00224 Double_t range[3]; 00225 for (Int_t i = 0; i < 3; i++) { 00226 range[i] = fabs(max[i] - min[i]); 00227 if (range[i] > maxRange) maxRange = range[i]; 00228 } 00229 00230 if (view->GetViewType() & kXYView) { 00231 00232 if (fStripXY) { 00233 fStripXY->SetLineColor(lcStrip); 00234 fStripXY->SetLineWidth(lwStrip); 00235 fStripXY->SetLineStyle(lsStrip); 00236 fStripXY->SetFillColor(fcStrip); 00237 fStripXY->SetFillStyle(fsStrip); 00238 } 00239 00240 if (this->IsFired()) { 00241 if (fStripXY) { 00242 fStripXY->SetLineColor(lcStripFired); 00243 if (maxRange > m_kDrawLineRange && fPart == 1) 00244 fStripXY->SetLineColor(fcStripFired); // too small makes it hard to see 00245 fStripXY->SetLineWidth(lwStripFired); 00246 fStripXY->SetLineStyle(lsStripFired); 00247 fStripXY->SetFillColor(fcStripFired); 00248 fStripXY->SetFillStyle(fsStripFired); 00249 } 00250 } 00251 00252 if (this->IsHighlighted()) { 00253 if (fStripXY) { 00254 fStripXY->SetLineColor(lcStripHL); 00255 if (maxRange > m_kDrawLineRange && fPart == 1) 00256 fStripXY->SetLineColor(fcStripHL); // too small makes it hard to see 00257 fStripXY->SetLineWidth(lwStripHL); 00258 fStripXY->SetLineStyle(lsStripHL); 00259 fStripXY->SetFillColor(fcStripHL); 00260 fStripXY->SetFillStyle(fsStripHL); 00261 } 00262 } 00263 00264 if ( fStripXY && view->GetVisMucStrips() ) fStripXY->Paint(); 00265 if (this->IsFired()) { 00266 if (view->GetVisMucHitsGlobal() && 00267 ( (fPart == 0 && view->GetVisMucHitsEast()) || 00268 (fPart == 1 && view->GetVisMucHitsBarrel()) || 00269 (fPart == 2 && view->GetVisMucHitsWest()) )) { 00270 fStripXY->Paint(); 00271 } 00272 } 00273 } 00274 00275 if (view->GetViewType() & kZRView) { 00276 00277 if (fStripZR) { 00278 fStripZR->SetLineColor(lcStrip); 00279 fStripZR->SetLineWidth(lwStrip); 00280 fStripZR->SetLineStyle(lsStrip); 00281 fStripZR->SetFillColor(fcStrip); 00282 fStripZR->SetFillStyle(fsStrip); 00283 } 00284 00285 if (this->IsFired()) { 00286 if (fStripZR) { 00287 fStripZR->SetLineColor(lcStripFired); 00288 if (maxRange > m_kDrawLineRange) 00289 fStripZR->SetLineColor(fcStripFired); // too small makes it hard to see 00290 fStripZR->SetLineWidth(lwStripFired); 00291 fStripZR->SetLineStyle(lsStripFired); 00292 fStripZR->SetFillColor(fcStripFired); 00293 fStripZR->SetFillStyle(fsStripFired); 00294 } 00295 } 00296 00297 if (this->IsHighlighted()) { 00298 if (fStripZR) { 00299 fStripZR->SetLineColor(lcStripHL); 00300 if (maxRange > m_kDrawLineRange) 00301 fStripZR->SetLineColor(fcStripHL); // too small makes it hard to see 00302 fStripZR->SetLineWidth(lwStripHL); 00303 fStripZR->SetLineStyle(lsStripHL); 00304 fStripZR->SetFillColor(fcStripHL); 00305 fStripZR->SetFillStyle(fsStripHL); 00306 } 00307 } 00308 00309 if ( fStripZR && view->GetVisMucStrips() && IsZRVisible() ) fStripZR->Paint(); 00310 if (this->IsFired() && IsZRVisible() ) { 00311 if (view->GetVisMucHitsGlobal() && 00312 ( (fPart == 0 && view->GetVisMucHitsEast()) || 00313 (fPart == 1 && view->GetVisMucHitsBarrel()) || 00314 (fPart == 2 && view->GetVisMucHitsWest()) )) { 00315 fStripZR->Paint(); 00316 } 00317 } 00318 } 00319 }
Double_t Muc2DStrip::Range360 | ( | Double_t | input | ) |
Definition at line 373 of file Muc2DStrip.cxx.
Referenced by GetAngle(), and IsZRVisible().
00374 { 00375 if (input >= 360.0) { 00376 do { 00377 input -= 360.0; 00378 } 00379 while (input >= 360.0); 00380 } 00381 else if (input < 0.0) { 00382 do { 00383 input += 360.0; 00384 } 00385 while (input < 0.0); 00386 } 00387 00388 return input; 00389 }
virtual void Muc2DStrip::SetFired | ( | bool | status = true |
) | [inline, virtual] |
Definition at line 31 of file Muc2DStrip.h.
References fFired.
Referenced by MucROOTGeo::Draw(), and MucROOTGeo::DrawHits().
00031 { fFired = status; }
virtual void Muc2DStrip::SetHighlighted | ( | bool | status = true |
) | [inline, virtual] |
Definition at line 30 of file Muc2DStrip.h.
References fHighlighted.
Referenced by ExecuteEvent().
00030 { fHighlighted = status; }
void Muc2DStrip::SetStyle | ( | ) | [virtual] |
Definition at line 97 of file Muc2DStrip.cxx.
References fcStrip, fcStripFired, fcStripHL, fsStrip, fsStripFired, fsStripHL, lcStrip, lcStripFired, lcStripHL, lsStrip, lsStripFired, lsStripHL, lwStrip, lwStripFired, and lwStripHL.
Referenced by Muc2DStrip().
00098 { 00099 lcStrip = 15; 00100 lwStrip = 1; 00101 lsStrip = 1; 00102 fcStrip = 1007; // lightBrown // 1005; // lightBlue 00103 fsStrip = 1001; 00104 00105 lcStripFired = 15; //kRed; //15 00106 lwStripFired = 1; 00107 lsStripFired = 1; 00108 fcStripFired = kRed; 00109 fsStripFired = 1001; 00110 00111 lcStripHL = lcStrip; 00112 lwStripHL = 1; 00113 lsStripHL = 1; 00114 fcStripHL = kBlue; 00115 fsStripHL = 1001; 00116 00117 }
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] |
Definition at line 64 of file Muc2DStrip.h.
Referenced by IsHighlighted(), Muc2DStrip(), and SetHighlighted().
std::vector<TString> Muc2DStrip::fInfoCon [private] |
Int_t Muc2DStrip::fPart [private] |
Definition at line 54 of file Muc2DStrip.h.
Referenced by GetPart(), IsZRVisible(), Muc2DStrip(), and Paint().
Int_t Muc2DStrip::fSeg [private] |
Definition at line 55 of file Muc2DStrip.h.
Referenced by GetSeg(), IsZRVisible(), and Muc2DStrip().
Int_t Muc2DStrip::fsStrip [private] |
Int_t Muc2DStrip::fsStripFired [private] |
Int_t Muc2DStrip::fsStripHL [private] |
Int_t Muc2DStrip::fStrip [private] |
BesPolygon2D* Muc2DStrip::fStripXY [private] |
Definition at line 59 of file Muc2DStrip.h.
Referenced by DistancetoPrimitive(), Muc2DStrip(), Paint(), and ~Muc2DStrip().
BesPolygon2D* Muc2DStrip::fStripZR [private] |
Definition at line 60 of file Muc2DStrip.h.
Referenced by DistancetoPrimitive(), Muc2DStrip(), Paint(), and ~Muc2DStrip().
BesPaveText* Muc2DStrip::fTip [private] |
Definition at line 63 of file Muc2DStrip.h.
Referenced by ClearInfo(), CloseInfo(), ExecuteEvent(), and Muc2DStrip().
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] |