6#include "BesVisLib/Mdc2DWire.h"
7#include "BesVisLib/BesView.h"
8#include "BesVisLib/BesCursor.h"
38 fColorfulWire =
false;
42 Double_t r = 0.25*(rmax-rmin);
45 Double_t dx = fabs(r*
cos(phi));
46 Double_t dy = fabs(r*
sin(phi));
47 Double_t
P[12] = { center[0] - dx, center[1] - dy, center[2] - dz,
48 center[0] + dx, center[1] + dy, center[2] - dz,
49 center[0] - dx, center[1] - dy, center[2] + dz,
50 center[0] + dx, center[1] + dy, center[2] + dz
67 fColorfulWire =
false;
70 Double_t *tubeP = &
P[3*N/2];
75 for (Int_t i = 0; i < 3; i++) {
76 fWestHole[i] = (
P[i] +
P[3+i] +
P[6+i] +
P[9+i] )/4.0;
77 fEastHole[i] = (
P[12+i] +
P[15+i] +
P[18+i] +
P[21+i])/4.0;
79 TVector3 westVec(fWestHole[0], fWestHole[1], fWestHole[2]);
80 TVector3 eastVec(fEastHole[0], fEastHole[1], fEastHole[2]);
81 fWestPhi = westVec.Phi() * TMath::RadToDeg();
82 fEastPhi = eastVec.Phi() * TMath::RadToDeg();
83 if (fWestPhi < 0.0) fWestPhi += 360.0;
84 if (fEastPhi < 0.0) fEastPhi += 360.0;
87 Double_t rMax = sqrt( (
P[4*3] -
P[7*3]) * (
P[4*3]-
P[7*3]) +
88 (
P[4*3+1]-
P[7*3+1]) * (
P[4*3+1]-
P[7*3+1]) +
89 (
P[4*3+2]-
P[7*3+2]) * (
P[4*3+2]-
P[7*3+2]) ) / 2.0;
91 Double_t rMinRatio = 0.0001;
92 Double_t rMaxRatio = 0.8;
95 Double_t edge = rMaxRatio*0.0001;
96 for (Int_t i = 0; i < 3; i++) {
97 newP[i] = (0.5+edge*rMinRatio)*(
P[i]+
P[3+i])*0.5
98 + (0.5-edge*rMinRatio)*(
P[6+i]+
P[9+i])*0.5;
99 newP[3+i] = (0.5-edge*rMinRatio)*(
P[i]+
P[3+i])*0.5
100 + (0.5+edge*rMinRatio)*(
P[6+i]+
P[9+i])*0.5;
101 newP[6+i] = (0.5+edge*rMaxRatio)*(
P[12+i]+
P[15+i])*0.5
102 + (0.5-edge*rMaxRatio)*(
P[18+i]+
P[21+i])*0.5;
103 newP[9+i] = (0.5-edge*rMaxRatio)*(
P[12+i]+
P[15+i])*0.5
104 + (0.5+edge*rMaxRatio)*(
P[18+i]+
P[21+i])*0.5;
106 fWireCone =
new BesPolygon2D(
"WireCone",
"WireCone", 4, &newP[0]);
109 new BesCircle2D(
"WireBubble",
"WireBubble", 0.0, rMaxRatio*rMax, &fEastHole[0]);
113 new BesMarker2D(
"MdcZRPos",
"MdcZRPos", fEastHole[0], fEastHole[1], fEastHole[2]);
122 if (fTube)
delete fTube;
123 if (fWireCircle)
delete fWireCircle;
124 if (fWireCone)
delete fWireCone;
125 if (fZRPosMarker2D)
delete fZRPosMarker2D;
127 if (fTip)
delete fTip;
150 if (fWireType == 1) lcWire = kGreen;
151 if (fWireType == 2) lcWire = kBlue;
162 fcCircleFired = 1004;
163 fcConeFired = kBlack;
164 fsCircleFired = 1001;
170 fcCircleHL = kMagenta;
195 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
199 cout <<
"Mdc2DWire::CloseInfo, not initialized" << endl;
210 if (fZRPosMarker2D) {
211 fZRPosMarker2D->DistancetoPrimitive(px, py);
212 return fZRPosMarker2D->DistancetoPrimitive(px, py);
230 if (gPad) gPad->SetCursor(kPointer);
238 if ( fWireCircle ) origColor = fWireCircle->GetFillColor();
239 if ( fZRPosMarker2D ) origColor = fZRPosMarker2D->GetMarkerColor();
248 fTip->Draw(
"BR,SAME");
275 TString opt = option;
285 TString opt = option;
293 Double_t wcCenter[3], ncCenter[3];
295 view->
WCtoNDC(wcCenter, &ncCenter[0]);
296 Double_t x1, y1, x2, y2;
298 gPad->GetRange(x1, y1, x2, y2);
301 if (ncCenter[0] > x1-d && ncCenter[0] < x2+d &&
302 ncCenter[1] > y1-d && ncCenter[1] < y2+d) {
303 if (opt.Contains(
"TUBE") && fTube ) {
304 fTube->SetLineColor(lcTube);
305 fTube->SetLineWidth(lwTube);
306 fTube->SetFillColor(fcTube);
307 fTube->SetFillStyle(fsTube);
314 fWireCircle->SetLineColor(lcWireFired);
315 fWireCircle->SetLineWidth(lwCircleFired);
316 fWireCircle->SetFillColor(fcCircleFired);
317 fWireCircle->SetFillStyle(fsCircleFired);
320 fWireCone->SetLineColor(lcWireFired);
321 fWireCone->SetLineWidth(lwConeFired);
322 fWireCone->SetFillColor(fcConeFired);
323 fWireCone->SetFillStyle(fsConeFired);
328 fWireCone->SetLineColor(lcWire);
329 fWireCone->SetLineWidth(lwCone);
330 fWireCone->SetFillColor(fcCone);
331 fWireCone->SetFillStyle(fsCone);
334 fWireCircle->SetLineColor(lcWire);
335 fWireCircle->SetLineWidth(lwCircle);
336 fWireCircle->SetFillColor(fcCircle);
337 fWireCircle->SetFillStyle(fsCircle);
343 fWireCircle->SetLineColor(lcWireHL);
344 fWireCircle->SetLineWidth(lwCircleHL);
345 fWireCircle->SetFillColor(fcCircleHL);
346 fWireCircle->SetFillStyle(fsCircleHL);
349 fWireCone->SetLineColor(lcWireHL);
350 fWireCone->SetLineWidth(lwConeHL);
351 fWireCone->SetFillColor(fcConeHL);
352 fWireCone->SetFillStyle(fsConeHL);
355 if (opt.Contains(
"WIRE")) {
356 if (!fColorfulWire) fWireCone->
Paint();
357 if (fWireCircle) fWireCircle->
Paint();
364 fZRPosMarker2D->
SetWCX(fZRSectionPos[0]);
365 fZRPosMarker2D->
SetWCY(fZRSectionPos[1]);
366 fZRPosMarker2D->
SetWCZ(fZRSectionPos[2]);
367 fZRPosMarker2D->SetMarkerColor(cMarker);
368 fZRPosMarker2D->SetMarkerStyle(sMarker);
372 if (fZRPosMarker2D) {
373 fZRPosMarker2D->SetMarkerColor(cMarkerFired);
374 fZRPosMarker2D->SetMarkerStyle(sMarkerFired);
378 if (fZRPosMarker2D) {
379 fZRPosMarker2D->SetMarkerColor(cMarker);
380 fZRPosMarker2D->SetMarkerStyle(sMarker);
385 if (fZRPosMarker2D) {
386 fZRPosMarker2D->SetMarkerColor(cMarkerHL);
387 fZRPosMarker2D->SetMarkerStyle(sMarkerHL);
391 if (opt.Contains(
"WIRE")) {
392 if (fZRPosMarker2D) fZRPosMarker2D->
Paint();
404 else return TObject::GetObjectInfo(px, py);
411 if (fWireType != 2)
return false;
419 Double_t zrPhi = viewPhi-90.0;
423 for (Int_t i = 0; i < 2; i++) {
429 if ( fabs(fEastPhi-fWestPhi) < 180.0 ) {
430 if ( (fEastPhi-zrPhi)*(fWestPhi-zrPhi) > 0.0 )
flag =
false;
432 Double_t factor = fabs( (fEastPhi-zrPhi)/(fEastPhi-fWestPhi) );
433 for (Int_t i = 0; i < 3; i++) {
434 fZRSectionPos[i] = factor*fWestHole[i] + (1.0-factor)*fEastHole[i];
441 if ( (fEastPhi-zrPhi)*(fWestPhi-zrPhi) < 0.0 )
flag =
false;
443 Double_t tempEastPhi = fEastPhi;
444 if (tempEastPhi >= 180.0) tempEastPhi -= 360.0;
445 Double_t tempWestPhi = fWestPhi;
446 if (tempWestPhi >= 180.0) tempWestPhi -= 360.0;
447 Double_t tempZRPhi = zrPhi;
448 if (tempZRPhi >= 180.0) tempZRPhi -= 360.0;
450 Double_t factor = fabs( (tempEastPhi-tempZRPhi)/(tempEastPhi-tempWestPhi) );
451 for (Int_t i = 0; i < 3; i++) {
452 fZRSectionPos[i] = factor*fWestHole[i] + (1.0-factor)*fEastHole[i];
467 if (input >= 360.0) {
471 while (input >= 360.0);
473 else if (input < 0.0) {
515 fColorfulWire = colorfulWire;
525 double tempMdcTime = mdcTime - evTime;
526 if(fabs(evTime)>0.0001) tempMdcTime += 230;
527 if(tempMdcTime>10000) {
529 }
else if(tempMdcTime>2000&&tempMdcTime<=10000){
531 }
else if(tempMdcTime<-10){
534 tempColor = 51 + (int) (tempMdcTime/40);
540 }
else if(mdcTime>2000&&mdcTime<=10000){
543 tempColor = 51 + (int) (mdcTime/40);
546 lcWireFired = tempColor;
556 }
else if(mdcCharge>2000&&mdcCharge<=30000){
559 tempColor = 51 + (int) (mdcCharge/40);
561 if(qOverflow) { tempColor = kBlack; }
562 fcCircleFired = tempColor;
566 fcCircleFired = 1004;
double P(RecMdcKalTrack *trk)
gr SetTitle("BbLum_000XXXX")
R__EXTERN BesCursor * gBesCursor
double sin(const BesAngle a)
double cos(const BesAngle a)
ClassImp(Mdc2DWire) Mdc2DWire
virtual void Paint(Option_t *option="")
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
virtual void GetCenter(Double_t *center)
virtual void SetWCY(Float_t input)
virtual void SetMarkerSizeMultiple(Int_t input)
virtual void Paint(Option_t *option="")
virtual void SetWCZ(Float_t input)
virtual void SetWCX(Float_t input)
virtual void SetText(std::vector< TString > infoCon)
virtual void SetPos(Int_t px, Int_t py)
virtual void Paint(Option_t *option="")
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)
virtual void UpdateView(Bool_t resetview=kFALSE)
virtual char * GetObjectInfo(Int_t px, Int_t py) const
EBESViewType GetViewType()
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
void SetQOverflow(Bool_t qOvfl)
virtual void SetHighlighted(bool status=true)
virtual char * GetObjectInfo(Int_t px, Int_t py) const
virtual bool IsHighlighted()
virtual bool HasZRSection()
void SetTime(Double_t time)
void SetColorfulWire(Bool_t colorfulWire, Bool_t subEvTime)
Double_t Range360(Double_t input)
void SetEvTime(Double_t time)
virtual void Paint(Option_t *option="")
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
virtual void Draw(Option_t *option="")
void SetCharge(Double_t charge)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)