6#include "BesVisLib/Mdc2DWire.h"
7#include "BesVisLib/BesView.h"
8#include "BesVisLib/BesCursor.h"
39 fColorfulWire =
false;
47 Double_t r = 0.25*(rmax-rmin);
48 fWireCircle =
new BesCircle2D(name, title, 0.0, r, ¢er[0]);
50 Double_t dx = fabs(r*
cos(phi));
51 Double_t dy = fabs(r*
sin(phi));
52 Double_t
P[12] = { center[0] - dx, center[1] - dy, center[2] - dz,
53 center[0] + dx, center[1] + dy, center[2] - dz,
54 center[0] - dx, center[1] - dy, center[2] + dz,
55 center[0] + dx, center[1] + dy, center[2] + dz
72 fColorfulWire =
false;
75 Double_t *tubeP = &
P[3*N/2];
80 for (Int_t i = 0; i < 3; i++) {
81 fWestHole[i] = (
P[i] +
P[3+i] +
P[6+i] +
P[9+i] )/4.0;
82 fEastHole[i] = (
P[12+i] +
P[15+i] +
P[18+i] +
P[21+i])/4.0;
84 TVector3 westVec(fWestHole[0], fWestHole[1], fWestHole[2]);
85 TVector3 eastVec(fEastHole[0], fEastHole[1], fEastHole[2]);
86 fWestPhi = westVec.Phi() * TMath::RadToDeg();
87 fEastPhi = eastVec.Phi() * TMath::RadToDeg();
88 if (fWestPhi < 0.0) fWestPhi += 360.0;
89 if (fEastPhi < 0.0) fEastPhi += 360.0;
92 Double_t rMax = sqrt( (
P[4*3] -
P[7*3]) * (
P[4*3]-
P[7*3]) +
93 (
P[4*3+1]-
P[7*3+1]) * (
P[4*3+1]-
P[7*3+1]) +
94 (
P[4*3+2]-
P[7*3+2]) * (
P[4*3+2]-
P[7*3+2]) ) / 2.0;
96 Double_t rMinRatio = 0.0001;
97 Double_t rMaxRatio = 0.8;
100 Double_t edge = rMaxRatio*0.0001;
101 for (Int_t i = 0; i < 3; i++) {
102 newP[i] = (0.5+edge*rMinRatio)*(
P[i]+
P[3+i])*0.5
103 + (0.5-edge*rMinRatio)*(
P[6+i]+
P[9+i])*0.5;
104 newP[3+i] = (0.5-edge*rMinRatio)*(
P[i]+
P[3+i])*0.5
105 + (0.5+edge*rMinRatio)*(
P[6+i]+
P[9+i])*0.5;
106 newP[6+i] = (0.5+edge*rMaxRatio)*(
P[12+i]+
P[15+i])*0.5
107 + (0.5-edge*rMaxRatio)*(
P[18+i]+
P[21+i])*0.5;
108 newP[9+i] = (0.5-edge*rMaxRatio)*(
P[12+i]+
P[15+i])*0.5
109 + (0.5+edge*rMaxRatio)*(
P[18+i]+
P[21+i])*0.5;
111 fWireCone =
new BesPolygon2D(
"WireCone",
"WireCone", 4, &newP[0]);
114 new BesCircle2D(
"WireBubble",
"WireBubble", 0.0, rMaxRatio*rMax, &fEastHole[0]);
118 new BesMarker2D(
"MdcZRPos",
"MdcZRPos", fEastHole[0], fEastHole[1], fEastHole[2]);
131 delete fZRPosMarker2D;
155 if (fWireType == 1) lcWire = kGreen;
156 if (fWireType == 2) lcWire = kBlue;
167 fcCircleFired = 1004;
168 fcConeFired = kBlack;
169 fsCircleFired = 1001;
175 fcCircleHL = kMagenta;
200 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
204 cout <<
"Mdc2DWire::CloseInfo, not initialized" << endl;
215 if (fZRPosMarker2D) {
224 return fZRPosMarker2D->DistancetoPrimitive(px, py);
242 if (gPad) gPad->SetCursor(kPointer);
250 if ( fWireCircle ) origColor = fWireCircle->GetFillColor();
251 if ( fZRPosMarker2D ) origColor = fZRPosMarker2D->GetMarkerColor();
288 TString opt = option;
298 TString opt = option;
306 Double_t wcCenter[3], ncCenter[3];
308 view->
WCtoNDC(wcCenter, &ncCenter[0]);
309 Double_t x1, y1, x2, y2;
311 gPad->GetRange(x1, y1, x2, y2);
314 if (ncCenter[0] > x1-d && ncCenter[0] < x2+d &&
315 ncCenter[1] > y1-d && ncCenter[1] < y2+d) {
316 if (opt.Contains(
"TUBE") && fTube ) {
317 fTube->SetLineColor(lcTube);
318 fTube->SetLineWidth(lwTube);
319 fTube->SetFillColor(fcTube);
320 fTube->SetFillStyle(fsTube);
327 fWireCircle->SetLineColor(lcWireFired);
328 fWireCircle->SetLineWidth(lwCircleFired);
329 fWireCircle->SetFillColor(fcCircleFired);
330 fWireCircle->SetFillStyle(fsCircleFired);
333 fWireCone->SetLineColor(lcWireFired);
334 fWireCone->SetLineWidth(lwConeFired);
335 fWireCone->SetFillColor(fcConeFired);
336 fWireCone->SetFillStyle(fsConeFired);
341 fWireCone->SetLineColor(lcWire);
342 fWireCone->SetLineWidth(lwCone);
343 fWireCone->SetFillColor(fcCone);
344 fWireCone->SetFillStyle(fsCone);
347 fWireCircle->SetLineColor(lcWire);
348 fWireCircle->SetLineWidth(lwCircle);
349 fWireCircle->SetFillColor(fcCircle);
350 fWireCircle->SetFillStyle(fsCircle);
356 fWireCircle->SetLineColor(lcWireHL);
357 fWireCircle->SetLineWidth(lwCircleHL);
358 fWireCircle->SetFillColor(fcCircleHL);
359 fWireCircle->SetFillStyle(fsCircleHL);
362 fWireCone->SetLineColor(lcWireHL);
363 fWireCone->SetLineWidth(lwConeHL);
364 fWireCone->SetFillColor(fcConeHL);
365 fWireCone->SetFillStyle(fsConeHL);
368 if (opt.Contains(
"WIRE")) {
371 if (fWireCircle) fWireCircle->
Paint();
378 fZRPosMarker2D->
SetWCX(fZRSectionPos[0]);
379 fZRPosMarker2D->
SetWCY(fZRSectionPos[1]);
380 fZRPosMarker2D->
SetWCZ(fZRSectionPos[2]);
381 fZRPosMarker2D->SetMarkerColor(cMarker);
382 fZRPosMarker2D->SetMarkerStyle(sMarker);
386 if (fZRPosMarker2D) {
387 fZRPosMarker2D->SetMarkerColor(cMarkerFired);
388 fZRPosMarker2D->SetMarkerStyle(sMarkerFired);
392 if (fZRPosMarker2D) {
393 fZRPosMarker2D->SetMarkerColor(cMarker);
394 fZRPosMarker2D->SetMarkerStyle(sMarker);
399 if (fZRPosMarker2D) {
400 fZRPosMarker2D->SetMarkerColor(cMarkerHL);
401 fZRPosMarker2D->SetMarkerStyle(sMarkerHL);
405 if (opt.Contains(
"WIRE")) {
406 if (fZRPosMarker2D) fZRPosMarker2D->
Paint();
418 else return TObject::GetObjectInfo(px, py);
425 if (fWireType != 2)
return false;
433 Double_t zrPhi = viewPhi-90.0;
437 for (Int_t i = 0; i < 2; i++) {
443 if ( fabs(fEastPhi-fWestPhi) < 180.0 ) {
444 if ( (fEastPhi-zrPhi)*(fWestPhi-zrPhi) > 0.0 ) flag =
false;
446 Double_t factor = fabs( (fEastPhi-zrPhi)/(fEastPhi-fWestPhi) );
447 for (Int_t i = 0; i < 3; i++) {
448 fZRSectionPos[i] = factor*fWestHole[i] + (1.0-factor)*fEastHole[i];
455 if ( (fEastPhi-zrPhi)*(fWestPhi-zrPhi) < 0.0 ) flag =
false;
457 Double_t tempEastPhi = fEastPhi;
458 if (tempEastPhi >= 180.0) tempEastPhi -= 360.0;
459 Double_t tempWestPhi = fWestPhi;
460 if (tempWestPhi >= 180.0) tempWestPhi -= 360.0;
461 Double_t tempZRPhi = zrPhi;
462 if (tempZRPhi >= 180.0) tempZRPhi -= 360.0;
464 Double_t factor = fabs( (tempEastPhi-tempZRPhi)/(tempEastPhi-tempWestPhi) );
465 for (Int_t i = 0; i < 3; i++) {
466 fZRSectionPos[i] = factor*fWestHole[i] + (1.0-factor)*fEastHole[i];
481 if (input >= 360.0) {
485 while (input >= 360.0);
487 else if (input < 0.0) {
540 fColorfulWire = colorfulWire;
550 double tempMdcTime = mdcTime - evTime;
551 if(fabs(evTime)>0.0001) tempMdcTime += 230;
552 if(tempMdcTime>10000) {
554 }
else if(tempMdcTime>2000&&tempMdcTime<=10000){
556 }
else if(tempMdcTime<-10){
559 tempColor = 51 + (int) (tempMdcTime/40);
565 }
else if(mdcTime>2000&&mdcTime<=10000){
568 tempColor = 51 + (int) (mdcTime/40);
571 lcWireFired = tempColor;
581 }
else if(mdcCharge>2000&&mdcCharge<=30000){
584 tempColor = 51 + (int) (mdcCharge/40);
586 if(qOverflow) { tempColor = kBlack; }
587 fcCircleFired = tempColor;
591 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 SetChargeChannel(UInt_t cc)
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="")
void SetTimeChannel(UInt_t tc)
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)