7#include "BesVisLib/Emc2DCrystal.h"
8#include "BesVisLib/BesView.h"
9#include "BesVisLib/BesCursor.h"
38 fZRSectionTolerance[1] = 0.1;
39 fZRSectionTolerance[2] = fZRSectionTolerance[0] = 1.2;
45 Int_t iXYSeq[4] = {0,2,6,4};
46 for (Int_t i = 0; i < 4; i++) {
48 for (Int_t j = 0; j < 3; j++) {
49 Pxy[3*i+j] = (
P[3*iXYSeq[i]+j] +
P[3*(iXYSeq[i]+1)+j] )/2.0;
57 SetXYPoint(&
P[3*i], &
P[3*(i+4)], &Pxy[3*i], -ecXYPointZ);
65 fCrystalXYFired =
new BesPolygon2D(name, title, 4, &Pxy[0]);
68 Int_t iXYSeq[5] = {8,9,1,2,3};
69 for (Int_t i = 0; i < 5; i++) {
71 SetXYPoint(&
P[3*iXYSeq[i]], &
P[3*(iXYSeq[i]+4)], &Pxy[3*i], ecXYPointZ);
74 SetXYPoint(&
P[3*iXYSeq[i]], &
P[3*(iXYSeq[i]+4)], &Pxy[3*i], -ecXYPointZ);
80 fCrystalXYFired =
new BesPolygon2D(name, title, 5, &Pxy[0]);
86 Int_t iSeq[8] = {0,3,1,2,5,6,4,7};
87 for (Int_t i = 0; i < 4; i++) {
88 for (Int_t j = 0; j < 3; j++) {
89 Pzr[3*i+j] = (
P[3*iSeq[2*i]+j] +
P[3*iSeq[2*i+1]+j])/2.0;
95 fCrystalZR =
new BesPolygon2D(TString(name)+TString(
"zr"), title, 4, &Pzr[0]);
96 fCrystalZRFired =
new BesPolygon2D(TString(name)+TString(
"zr"), title, 4, &Pzr[0]);
114 if (fPhiMin > fPhiMax && fPhiMin - fPhiMax < 180.0)
116 Double_t phiTemp = fPhiMin;
121 if (fPhiMax > fPhiMin && fPhiMax - fPhiMin > 180.0)
123 Double_t phiTemp = fPhiMin;
134 for (Int_t i = 0; i < 4; i++) {
136 SetZRPoint(&
P[3*i], &
P[3*(i+4)], &Pside[3*i], brZRPointR);
143 fCrystalSide =
new BesPolygon2D(name, title, 4, &Pside[0]);
144 fCrystalSideFired =
new BesPolygon2D(name, title, 4, &Pside[0]);
147 for (Int_t i = 0; i < 5; i++) {
151 fCrystalSide =
new BesPolygon2D(name, title, 5, &Pside[0]);
152 fCrystalSideFired =
new BesPolygon2D(name, title, 5, &Pside[0]);
169 delete fCrystalXYFired;
170 delete fCrystalZRFired;
179 fsCrystalTrans = 4000;
181 lcCrystalFired = kRed;
183 fcCrystalFired = kRed;
184 fsCrystalFired = 1001;
186 lcCrystalHL = lcCrystal;
191 lcCrystalFiredHL = kRed;
192 lwCrystalFiredHL = 2;
193 fcCrystalFiredHL = kWhite;
194 fsCrystalFiredHL = 4000;
208 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
212 cout <<
"Emc2DCrystal::CloseInfo, not initialized" << endl;
251 if (gPad) gPad->SetCursor(kPointer);
297 TString opt = option;
307 TString opt = option;
314 fCrystalXY->SetLineColor(lcCrystal);
315 fCrystalXY->SetLineWidth(lwCrystal);
316 fCrystalXY->SetFillColor(fcCrystal);
317 fCrystalXY->SetFillStyle(fsCrystal);
322 fCrystalXY->SetFillStyle(fsCrystalTrans);
324 if (fCrystalXYFired) {
325 fCrystalXYFired->SetLineColor(lcCrystalFired);
326 fCrystalXYFired->SetLineWidth(lwCrystalFired);
327 fCrystalXYFired->SetFillColor(fcCrystalFired);
328 fCrystalXYFired->SetFillStyle(fsCrystalFired);
334 fCrystalXY->SetLineColor(lcCrystalHL);
335 fCrystalXY->SetLineWidth(lwCrystalHL);
336 fCrystalXY->SetFillColor(fcCrystalHL);
337 fCrystalXY->SetFillStyle(fsCrystalHL);
339 if (fCrystalXYFired) {
340 fCrystalXYFired->SetLineColor(lcCrystalFiredHL);
341 fCrystalXYFired->SetLineWidth(lwCrystalFiredHL);
342 fCrystalXYFired->SetFillColor(fcCrystalFiredHL);
343 fCrystalXYFired->SetFillStyle(fsCrystalFiredHL);
353 if (fCrystalXYFired) {
358 fCrystalXYFired->
SetSize(fCharge/fChargeMax);
359 fCrystalXYFired->
Paint();
368 if (fCrystalZRFired) {
369 fCrystalZRFired->SetLineColor(lcCrystalFired);
370 fCrystalZRFired->SetLineWidth(lwCrystalFired);
371 fCrystalZRFired->SetFillColor(fcCrystalFired);
372 fCrystalZRFired->SetFillStyle(fsCrystalFired);
377 fCrystalZR->SetLineColor(lcCrystal);
378 fCrystalZR->SetLineWidth(lwCrystal);
379 fCrystalZR->SetFillColor(fcCrystal);
380 fCrystalZR->SetFillStyle(fsCrystal);
385 fCrystalZR->SetLineColor(lcCrystalHL);
386 fCrystalZR->SetLineWidth(lwCrystalHL);
387 fCrystalZR->SetFillColor(fcCrystalHL);
388 fCrystalZR->SetFillStyle(fsCrystalHL);
390 if (fCrystalZRFired) {
391 fCrystalZRFired->SetLineColor(lcCrystalFiredHL);
392 fCrystalZRFired->SetLineWidth(lwCrystalFiredHL);
393 fCrystalZRFired->SetFillColor(fcCrystalFiredHL);
394 fCrystalZRFired->SetFillStyle(fsCrystalFiredHL);
398 if ( fCrystalZR ) fCrystalZR->
Paint();
404 if (fCrystalZRFired) {
407 fCrystalZRFired->
SetSize(fCharge/fChargeMax);
408 fCrystalZRFired->
Paint();
416 if (fCrystalSideFired) {
417 fCrystalSideFired->SetLineColor(lcCrystalFired);
418 fCrystalSideFired->SetLineWidth(lwCrystalFired);
419 fCrystalSideFired->SetFillColor(fcCrystalFired);
420 fCrystalSideFired->SetFillStyle(fsCrystalFired);
425 fCrystalSide->SetLineColor(lcCrystal);
426 fCrystalSide->SetLineWidth(lwCrystal);
427 fCrystalSide->SetFillColor(fcCrystal);
428 fCrystalSide->SetFillStyle(fsCrystal);
433 fCrystalSide->SetLineColor(lcCrystalHL);
434 fCrystalSide->SetLineWidth(lwCrystalHL);
435 fCrystalSide->SetFillColor(fcCrystalHL);
436 fCrystalSide->SetFillStyle(fsCrystalHL);
438 if (fCrystalSideFired) {
439 fCrystalSideFired->SetLineColor(lcCrystalFiredHL);
440 fCrystalSideFired->SetLineWidth(lwCrystalFiredHL);
441 fCrystalSideFired->SetFillColor(fcCrystalFiredHL);
442 fCrystalSideFired->SetFillStyle(fsCrystalFiredHL);
450 if (fCrystalSideFired) {
453 fCrystalSideFired->
SetSize(fCharge/fChargeMax);
454 fCrystalSideFired->
Paint();
468 else return TObject::GetObjectInfo(px, py);
481 Double_t zrPhi = viewPhi-90.0;
485 for (Int_t i = 0; i < 2; i++) {
491 if (zrPhi >= fPhiMin-fZRSectionTolerance[
GetPart()] &&
492 zrPhi <= fPhiMax+fZRSectionTolerance[
GetPart()]) {
496 else if (fPhiMin > fPhiMax) {
498 if (zrPhi >= fPhiMin-fZRSectionTolerance[
GetPart()] ||
499 zrPhi <= fPhiMax+fZRSectionTolerance[
GetPart()]) {
513 Double_t angle = TMath::ACos(
x/TMath::Sqrt(
x*
x+y*y) ) * TMath::RadToDeg();
514 if ( y<0.0 ) angle *= -1;
524 if (input >= 360.0) {
528 while (input >= 360.0);
530 else if (input < 0.0) {
552 Double_t viewPhiMin = viewPhi - sideDeltaPhi;
553 Double_t viewPhiMax = viewPhi + sideDeltaPhi;
560 if (viewPhiMin < viewPhiMax) {
561 if (fPhiMax > viewPhiMin && fPhiMax < viewPhiMax)
return true;
564 if (fPhiMax > viewPhiMin || fPhiMax < viewPhiMax)
return true;
574 Double_t ratio = fabs( (z-p1[2]) / (p2[2]-p1[2]) );
575 for (Int_t i = 0; i < 3; i++) {
576 newP[i] = p1[i] * (1.0-ratio) + p2[i] * ratio;
584 Double_t r1 = sqrt(p1[0]*p1[0] + p1[1]*p1[1]);
585 Double_t r2 = sqrt(p2[0]*p2[0] + p2[1]*p2[1]);
587 Double_t ratio = fabs( (r-r1) / (r2-r1) );
588 for (Int_t i = 0; i < 3; i++) {
589 newP[i] = p1[i] * (1.0-ratio) + p2[i] * ratio;
599 Double_t r1 = sqrt(p1[0]*p1[0] + p1[1]*p1[1]);
600 newP[0] = p1[0] * (brZRPointR/r1);
601 newP[1] = p1[1] * (brZRPointR/r1);
603 Double_t drToR = brZRPointR - r1;
604 newP[2] = fabs(ecXYPointZ + drToR) * (p1[2]/fabs(p1[2]));
double P(RecMdcKalTrack *trk)
gr SetTitle("BbLum_000XXXX")
ClassImp(Emc2DCrystal) Emc2DCrystal
R__EXTERN BesCursor * gBesCursor
virtual void SetText(std::vector< TString > infoCon)
virtual void SetPos(Int_t px, Int_t py)
virtual void SetSize(Double_t size)
virtual void Paint(Option_t *option="")
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Bool_t GetVisEmcHitsBarrel()
Bool_t GetVisEmcHitsGlobal()
virtual void UpdateView(Bool_t resetview=kFALSE)
Bool_t GetVisEmcHitsSide()
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Bool_t GetVisEmcHitsWest()
EBESViewType GetViewType()
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Bool_t GetVisEmcHitsEast()
virtual void ProjectECToSide(Double_t *p1, Double_t *newP)
virtual void SetZRPoint(Double_t *p1, Double_t *p2, Double_t *newP, Double_t r)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual bool IsSideVisible()
Double_t GetAngle(Double_t x, Double_t y)
virtual char * GetObjectInfo(Int_t px, Int_t py) const
virtual void Draw(Option_t *option="")
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
virtual bool HasZRSection()
Double_t Range360(Double_t input)
virtual void SetHighlighted(bool status=true)
virtual bool IsXYVisible()
virtual void Paint(Option_t *option="")
virtual bool IsHighlighted()
virtual void SetXYPoint(Double_t *p1, Double_t *p2, Double_t *newP, Double_t z)