#include <Mdc2DWire.h>
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) |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
virtual bool | HasZRSection () |
virtual bool | HasZRSection () |
virtual void | Init () |
virtual void | Init () |
virtual bool | IsFired () |
virtual bool | IsFired () |
virtual bool | IsHighlighted () |
virtual bool | IsHighlighted () |
Mdc2DWire (const char *name, const char *title, Int_t N, Double_t *P) | |
Mdc2DWire (const char *name, const char *title, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi, Double_t *center) | |
Mdc2DWire () | |
Mdc2DWire (const char *name, const char *title, Int_t N, Double_t *P) | |
Mdc2DWire (const char *name, const char *title, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi, Double_t *center) | |
Mdc2DWire () | |
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 () |
~Mdc2DWire () | |
~Mdc2DWire () | |
Private Attributes | |
Int_t | cMarker |
Int_t | cMarkerFired |
Int_t | cMarkerHL |
Int_t | fcCircle |
Int_t | fcCircleFired |
Int_t | fcCircleHL |
Int_t | fcCone |
Int_t | fcConeFired |
Int_t | fcConeHL |
Int_t | fcTube |
Double_t | fEastHole [3] |
Double_t | fEastPhi |
bool | fFired |
bool | fHighlighted |
std::vector< TString > | fInfoCon |
std::vector< TString > | fInfoCon |
Int_t | fsCircle |
Int_t | fsCircleFired |
Int_t | fsCircleHL |
Int_t | fsCone |
Int_t | fsConeFired |
Int_t | fsConeHL |
Int_t | fsTube |
BesPaveText * | fTip |
BesPaveText * | fTip |
BesPolygon2D * | fTube |
BesPolygon2D * | fTube |
Double_t | fWestHole [3] |
Double_t | fWestPhi |
BesCircle2D * | fWireCircle |
BesCircle2D * | fWireCircle |
BesPolygon2D * | fWireCone |
BesPolygon2D * | fWireCone |
Int_t | fWireType |
BesMarker2D * | fZRPosMarker2D |
BesMarker2D * | fZRPosMarker2D |
bool | fZRSectionFlag |
Double_t | fZRSectionPos [3] |
Int_t | lcTube |
Int_t | lcWire |
Int_t | lcWireFired |
Int_t | lcWireHL |
Int_t | lwCircle |
Int_t | lwCircleFired |
Int_t | lwCircleHL |
Int_t | lwCone |
Int_t | lwConeFired |
Int_t | lwConeHL |
Int_t | lwTube |
Int_t | sizeMarker |
Int_t | sMarker |
Int_t | sMarkerFired |
Int_t | sMarkerHL |
|
|
|
00030 { 00031 00032 SetName(name); 00033 SetTitle(title); 00034 fTip = 0; 00035 fHighlighted = false; 00036 fFired = false; 00037 fWireType = 1; // axial wire 00038 00039 Double_t r = 0.25*(rmax-rmin); 00040 fWireCircle = new BesCircle2D(name, title, 0.0, r, ¢er[0]); 00041 00042 Double_t dx = fabs(r*cos(phi)); 00043 Double_t dy = fabs(r*sin(phi)); 00044 Double_t P[12] = { center[0] - dx, center[1] - dy, center[2] - dz, 00045 center[0] + dx, center[1] + dy, center[2] - dz, 00046 center[0] - dx, center[1] - dy, center[2] + dz, 00047 center[0] + dx, center[1] + dy, center[2] + dz 00048 }; 00049 00050 fWireCone = new BesPolygon2D(name, title, 4, P); 00051 00052 Init(); 00053 }
|
|
00058 { 00059 SetName(name); 00060 SetTitle(title); 00061 fTip = 0; 00062 fHighlighted = false; 00063 fFired = false; 00064 fWireType = 2; // stereo wire 00065 00066 Double_t *tubeP = &P[3*N/2]; // east four points, P4~P7 00067 fTube = new BesPolygon2D(name, title, N/2, tubeP); 00068 fWireCircle = 0; 00069 fWireCone = 0; 00070 00071 for (Int_t i = 0; i < 3; i++) { 00072 fWestHole[i] = (P[i] + P[3+i] + P[6+i] + P[9+i] )/4.0; // (P0+P1+P2+P3)/4 00073 fEastHole[i] = (P[12+i] + P[15+i] + P[18+i] + P[21+i])/4.0; // (P4+P5+P6+P7)/4 00074 } 00075 TVector3 westVec(fWestHole[0], fWestHole[1], fWestHole[2]); 00076 TVector3 eastVec(fEastHole[0], fEastHole[1], fEastHole[2]); 00077 fWestPhi = westVec.Phi() * TMath::RadToDeg(); 00078 fEastPhi = eastVec.Phi() * TMath::RadToDeg(); 00079 if (fWestPhi < 0.0) fWestPhi += 360.0; 00080 if (fEastPhi < 0.0) fEastPhi += 360.0; 00081 00082 // ------XY------ 00083 Double_t rMax = sqrt( (P[4*3] -P[7*3]) * (P[4*3]-P[7*3]) + 00084 (P[4*3+1]-P[7*3+1]) * (P[4*3+1]-P[7*3+1]) + 00085 (P[4*3+2]-P[7*3+2]) * (P[4*3+2]-P[7*3+2]) ) / 2.0; 00086 00087 Double_t rMinRatio = 0.0001; // min bubble radius = rMinRatio * rMax; 00088 Double_t rMaxRatio = 0.6; // 0.4 00089 00090 Double_t newP[12]; 00091 Double_t edge = rMaxRatio*0.0001; //*0.85 00092 for (Int_t i = 0; i < 3; i++) { 00093 newP[i] = (0.5+edge*rMinRatio)*(P[i]+P[3+i])*0.5 00094 + (0.5-edge*rMinRatio)*(P[6+i]+P[9+i])*0.5; // near center of P0+P1 00095 newP[3+i] = (0.5-edge*rMinRatio)*(P[i]+P[3+i])*0.5 00096 + (0.5+edge*rMinRatio)*(P[6+i]+P[9+i])*0.5; // near center of P2+P3 00097 newP[6+i] = (0.5+edge*rMaxRatio)*(P[12+i]+P[15+i])*0.5 00098 + (0.5-edge*rMaxRatio)*(P[18+i]+P[21+i])*0.5; // near center of P4+P5 00099 newP[9+i] = (0.5-edge*rMaxRatio)*(P[12+i]+P[15+i])*0.5 00100 + (0.5+edge*rMaxRatio)*(P[18+i]+P[21+i])*0.5; // near center of P6+P7 00101 } 00102 fWireCone = new BesPolygon2D("WireCone", "WireCone", 4, &newP[0]); 00103 00104 fWireCircle = 00105 new BesCircle2D("WireBubble", "WireBubble", 0.0, rMaxRatio*rMax, &fEastHole[0]); 00106 00107 // ------ZR------ 00108 fZRPosMarker2D = 00109 new BesMarker2D("MdcZRPos", "MdcZRPos", fEastHole[0], fEastHole[1], fEastHole[2]); 00110 00111 Init(); 00112 }
|
|
00116 { 00117 00118 if (fTube) delete fTube; 00119 if (fWireCircle) delete fWireCircle; 00120 if (fWireCone) delete fWireCone; 00121 if (fZRPosMarker2D) delete fZRPosMarker2D; 00122 00123 if (fTip) delete fTip; 00124 }
|
|
|
|
|
|
|
|
|
|
00037 { fInfoCon.push_back(info); }
|
|
00037 { fInfoCon.push_back(info); }
|
|
|
|
|
|
|
|
00187 { 00188 if (fTip) { 00189 fTip->Clear(); 00190 00191 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle()); 00192 fTip->SetText(fInfoCon); 00193 } 00194 else 00195 cout << "Mdc2DWire::CloseInfo, not initialized" << endl; 00196 }
|
|
|
|
00200 { 00201 BesView *view = (BesView*)gPad->GetView(); 00202 if (view->GetViewType() & kXYView) { 00203 return fWireCircle->DistancetoPrimitive(px, py); 00204 } 00205 else if (view->GetViewType() & kZRView) { 00206 if (fZRPosMarker2D) { 00207 fZRPosMarker2D->DistancetoPrimitive(px, py); 00208 return fZRPosMarker2D->DistancetoPrimitive(px, py); 00209 } 00210 } 00211 00212 return 999; 00213 }
|
|
|
|
00268 { 00269 // 00270 // Mdc2DWire draw function 00271 TString opt = option; 00272 opt.ToUpper(); 00273 00274 AppendPad(option); 00275 }
|
|
|
|
00217 { 00218 00219 BesView *view = (BesView*)gPad->GetView(); 00220 00221 if (gBesCursor->GetType() == kBesHand) { 00222 if (view) view->ExecuteEvent(event, px, py); 00223 } 00224 else if (gBesCursor->GetType() == kBesPick){ 00225 00226 if (gPad) gPad->SetCursor(kPointer); 00227 00228 Int_t origColor = 1; 00229 00230 switch (event) { 00231 00232 case kMouseEnter : 00233 00234 if ( fWireCircle ) origColor = fWireCircle->GetFillColor(); 00235 if ( fZRPosMarker2D ) origColor = fZRPosMarker2D->GetMarkerColor(); 00236 this->SetHighlighted(true); 00237 00238 if (this->IsFired() || view->GetVisMdcWires()) { 00239 Draw("WIRE,SAME"); 00240 00241 fTip->SetPos(px, py); 00242 view->UpdateView(0); 00243 00244 fTip->Draw("BR,SAME"); // "BR,ARC,SAME" 00245 gPad->Modified(); 00246 gPad->Update(); 00247 } 00248 break; 00249 00250 case kMouseLeave: 00251 00252 if (this->IsHighlighted()) { 00253 this->SetHighlighted(false); 00254 if (view->GetVisMdcWires()) Draw("WIRE,SAME"); 00255 00256 view->UpdateView(0); 00257 gPad->Modified(); 00258 gPad->Update(); 00259 } 00260 break; 00261 } 00262 00263 } 00264 }
|
|
|
|
00395 { 00396 00397 BesView *view = (BesView*)gPad->GetView(); 00398 if (view) return view->GetObjectInfo(px, py); 00399 else return TObject::GetObjectInfo(px, py); 00400 }
|
|
|
|
00405 { 00406 if (fWireType != 2) return false; 00407 00408 bool flag = false; 00409 BesView *view = (BesView*)gPad->GetView(); 00410 Double_t viewPhi = view->GetLongitude(); 00411 viewPhi = Range360(viewPhi); 00412 //if (GetName() == TString("Layer0Wire0")) cout << "view " << viewPhi << endl; 00413 00414 Double_t zrPhi = viewPhi-90.0; 00415 zrPhi = Range360(zrPhi); 00416 //if (GetName() == TString("Layer0Wire0")) cout << zrPhi << endl; 00417 00418 for (Int_t i = 0; i < 2; i++) { 00419 if (i==1) { 00420 zrPhi += 180.0; 00421 zrPhi = Range360(zrPhi); 00422 } 00423 00424 if ( fabs(fEastPhi-fWestPhi) < 180.0 ) { // no cross phi=0.0 00425 if ( (fEastPhi-zrPhi)*(fWestPhi-zrPhi) > 0.0 ) flag = false; 00426 else { 00427 Double_t factor = fabs( (fEastPhi-zrPhi)/(fEastPhi-fWestPhi) ); 00428 for (Int_t i = 0; i < 3; i++) { 00429 fZRSectionPos[i] = factor*fWestHole[i] + (1.0-factor)*fEastHole[i]; 00430 } 00431 flag = true; 00432 break; 00433 } 00434 } 00435 else { // cross phi=0.0 00436 if ( (fEastPhi-zrPhi)*(fWestPhi-zrPhi) < 0.0 ) flag = false; 00437 else { // range 0~360 -> -180~180 00438 Double_t tempEastPhi = fEastPhi; 00439 if (tempEastPhi >= 180.0) tempEastPhi -= 360.0; 00440 Double_t tempWestPhi = fWestPhi; 00441 if (tempWestPhi >= 180.0) tempWestPhi -= 360.0; 00442 Double_t tempZRPhi = zrPhi; 00443 if (tempZRPhi >= 180.0) tempZRPhi -= 360.0; 00444 00445 Double_t factor = fabs( (tempEastPhi-tempZRPhi)/(tempEastPhi-tempWestPhi) ); 00446 for (Int_t i = 0; i < 3; i++) { 00447 fZRSectionPos[i] = factor*fWestHole[i] + (1.0-factor)*fEastHole[i]; 00448 } 00449 flag = true; 00450 break; 00451 } 00452 } 00453 } 00454 00455 return flag; 00456 }
|
|
|
|
00128 { 00129 00130 SetStyle(); 00131 00132 fTip = new BesPaveText(0, 0, 0.1, 0.1); 00133 CloseInfo(); 00134 }
|
|
00035 { return fFired; }
|
|
00035 { return fFired; }
|
|
00034 { return fHighlighted; }
|
|
00034 { return fHighlighted; }
|
|
|
|
00279 { 00280 00281 TString opt = option; 00282 opt.ToUpper(); 00283 00284 BesView *view = (BesView*)gPad->GetView(); 00285 00286 if (view->GetViewType() & kXYView) { 00287 00288 Double_t wcCenter[3], ncCenter[3]; 00289 fWireCircle->GetCenter(&wcCenter[0]); 00290 view->WCtoNDC(wcCenter, &ncCenter[0]); 00291 Double_t x1, y1, x2, y2; 00292 Double_t d = 0.05; 00293 gPad->GetRange(x1, y1, x2, y2); 00294 00295 // Only draw wire in pad range 00296 if (ncCenter[0] > x1-d && ncCenter[0] < x2+d && 00297 ncCenter[1] > y1-d && ncCenter[1] < y2+d) { 00298 if (opt.Contains("TUBE") && fTube ) { 00299 fTube->SetLineColor(lcTube); 00300 fTube->SetLineWidth(lwTube); 00301 fTube->SetFillColor(fcTube); 00302 fTube->SetFillStyle(fsTube); 00303 00304 fTube->Paint(); 00305 } 00306 00307 if (this->IsFired()) { 00308 if (fWireCircle) { 00309 fWireCircle->SetLineColor(lcWireFired); 00310 fWireCircle->SetLineWidth(lwCircleFired); 00311 fWireCircle->SetFillColor(fcCircleFired); 00312 fWireCircle->SetFillStyle(fsCircleFired); 00313 } 00314 if (fWireCone) { 00315 fWireCone->SetLineColor(lcWireFired); 00316 fWireCone->SetLineWidth(lwConeFired); 00317 fWireCone->SetFillColor(fcConeFired); 00318 fWireCone->SetFillStyle(fsConeFired); 00319 } 00320 } 00321 else { 00322 if (fWireCone) { 00323 fWireCone->SetLineColor(lcWire); 00324 fWireCone->SetLineWidth(lwCone); 00325 fWireCone->SetFillColor(fcCone); 00326 fWireCone->SetFillStyle(fsCone); 00327 } 00328 if (fWireCircle) { 00329 fWireCircle->SetLineColor(lcWire); 00330 fWireCircle->SetLineWidth(lwCircle); 00331 fWireCircle->SetFillColor(fcCircle); 00332 fWireCircle->SetFillStyle(fsCircle); 00333 } 00334 } 00335 00336 if (this->IsHighlighted()) { 00337 if (fWireCircle) { 00338 fWireCircle->SetLineColor(lcWireHL); 00339 fWireCircle->SetLineWidth(lwCircleHL); 00340 fWireCircle->SetFillColor(fcCircleHL); 00341 fWireCircle->SetFillStyle(fsCircleHL); 00342 } 00343 if (fWireCone) { 00344 fWireCone->SetLineColor(lcWireHL); 00345 fWireCone->SetLineWidth(lwConeHL); 00346 fWireCone->SetFillColor(fcConeHL); 00347 fWireCone->SetFillStyle(fsConeHL); 00348 } 00349 } 00350 if (opt.Contains("WIRE")) { 00351 if (fWireCone) fWireCone->Paint(); 00352 if (fWireCircle) fWireCircle->Paint(); 00353 } 00354 } 00355 } 00356 00357 if (view->GetViewType() & kZRView) { 00358 if (HasZRSection()) { 00359 fZRPosMarker2D->SetWCX(fZRSectionPos[0]); 00360 fZRPosMarker2D->SetWCY(fZRSectionPos[1]); 00361 fZRPosMarker2D->SetWCZ(fZRSectionPos[2]); 00362 fZRPosMarker2D->SetMarkerColor(cMarker); 00363 fZRPosMarker2D->SetMarkerStyle(sMarker); 00364 fZRPosMarker2D->SetMarkerSizeMultiple(sizeMarker); 00365 00366 if (this->IsFired()) { 00367 if (fZRPosMarker2D) { 00368 fZRPosMarker2D->SetMarkerColor(cMarkerFired); 00369 fZRPosMarker2D->SetMarkerStyle(sMarkerFired); 00370 } 00371 } 00372 else { 00373 if (fZRPosMarker2D) { 00374 fZRPosMarker2D->SetMarkerColor(cMarker); 00375 fZRPosMarker2D->SetMarkerStyle(sMarker); 00376 } 00377 } 00378 00379 if (this->IsHighlighted()) { 00380 if (fZRPosMarker2D) { 00381 fZRPosMarker2D->SetMarkerColor(cMarkerHL); 00382 fZRPosMarker2D->SetMarkerStyle(sMarkerHL); 00383 } 00384 } 00385 00386 if (opt.Contains("WIRE")) { 00387 if (fZRPosMarker2D) fZRPosMarker2D->Paint(); 00388 } 00389 } 00390 } 00391 }
|
|
|
|
00461 { 00462 if (input >= 360.0) { 00463 do { 00464 input -= 360.0; 00465 } 00466 while (input >= 360.0); 00467 } 00468 else if (input < 0.0) { 00469 do { 00470 input += 360.0; 00471 } 00472 while (input < 0.0); 00473 } 00474 00475 return input; 00476 }
|
|
00033 { fFired = status; }
|
|
00033 { fFired = status; }
|
|
00032 { fHighlighted = status; }
|
|
00032 { fHighlighted = status; }
|
|
|
|
00139 { 00140 lcTube = kBlack; // grey; 00141 lwTube = 1; 00142 fcTube = kBlack; // grey 15; 00143 fsTube = 4000; 00144 00145 lcWire = 15; 00146 if (fWireType == 1) lcWire = kGreen; 00147 if (fWireType == 2) lcWire = kBlue; 00148 lwCircle = 1; 00149 lwCone = 1; 00150 fcCircle = kWhite; 00151 fcCone = 0; 00152 fsCircle = 1001; 00153 fsCone = 0; 00154 00155 lcWireFired = kRed; 00156 lwCircleFired = 2; 00157 lwConeFired = 2; 00158 fcCircleFired = 1004; //kBlack; 00159 fcConeFired = kBlack; 00160 fsCircleFired = 1001; 00161 fsConeFired = 3001; 00162 00163 lcWireHL = lcWire; 00164 lwCircleHL = 2; 00165 lwConeHL = 2; 00166 fcCircleHL = kBlack; 00167 fcConeHL = kRed; 00168 fsCircleHL = 1001; 00169 fsConeHL = 4000; 00170 00171 sizeMarker = 4; 00172 cMarker = kBlue; 00173 cMarkerFired = kRed; // color of fired marker 00174 cMarkerHL = cMarker; // cMarkerFired; 00175 sMarker = 24; 00176 sMarkerFired = 20; // style of fired marker 00177 sMarkerHL = 25; // style of highlighted marker 00178 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|