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]);
113 if (fPhiMin > fPhiMax && fabs(fPhiMax-fPhiMin) < 180.0) {
114 Double_t phiTemp = fPhiMin;
125 for (Int_t i = 0; i < 4; i++) {
127 SetZRPoint(&
P[3*i], &
P[3*(i+4)], &Pside[3*i], brZRPointR);
134 fCrystalSide =
new BesPolygon2D(name, title, 4, &Pside[0]);
135 fCrystalSideFired =
new BesPolygon2D(name, title, 4, &Pside[0]);
138 for (Int_t i = 0; i < 5; i++) {
142 fCrystalSide =
new BesPolygon2D(name, title, 5, &Pside[0]);
143 fCrystalSideFired =
new BesPolygon2D(name, title, 5, &Pside[0]);
158 if (fCrystalXY)
delete fCrystalXY;
159 if (fCrystalZR)
delete fCrystalZR;
160 if (fCrystalXYFired)
delete fCrystalXYFired;
161 if (fCrystalZRFired)
delete fCrystalZRFired;
170 fsCrystalTrans = 4000;
172 lcCrystalFired = kRed;
174 fcCrystalFired = kRed;
175 fsCrystalFired = 1001;
177 lcCrystalHL = lcCrystal;
182 lcCrystalFiredHL = kRed;
183 lwCrystalFiredHL = 2;
184 fcCrystalFiredHL = kWhite;
185 fsCrystalFiredHL = 4000;
199 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
203 cout <<
"Emc2DCrystal::CloseInfo, not initialized" << endl;
242 if (gPad) gPad->SetCursor(kPointer);
255 fTip->Draw(
"BR,SAME");
287 TString opt = option;
297 TString opt = option;
304 fCrystalXY->SetLineColor(lcCrystal);
305 fCrystalXY->SetLineWidth(lwCrystal);
306 fCrystalXY->SetFillColor(fcCrystal);
307 fCrystalXY->SetFillStyle(fsCrystal);
312 fCrystalXY->SetFillStyle(fsCrystalTrans);
314 if (fCrystalXYFired) {
315 fCrystalXYFired->SetLineColor(lcCrystalFired);
316 fCrystalXYFired->SetLineWidth(lwCrystalFired);
317 fCrystalXYFired->SetFillColor(fcCrystalFired);
318 fCrystalXYFired->SetFillStyle(fsCrystalFired);
324 fCrystalXY->SetLineColor(lcCrystalHL);
325 fCrystalXY->SetLineWidth(lwCrystalHL);
326 fCrystalXY->SetFillColor(fcCrystalHL);
327 fCrystalXY->SetFillStyle(fsCrystalHL);
329 if (fCrystalXYFired) {
330 fCrystalXYFired->SetLineColor(lcCrystalFiredHL);
331 fCrystalXYFired->SetLineWidth(lwCrystalFiredHL);
332 fCrystalXYFired->SetFillColor(fcCrystalFiredHL);
333 fCrystalXYFired->SetFillStyle(fsCrystalFiredHL);
343 if (fCrystalXYFired) {
348 fCrystalXYFired->
SetSize(fCharge/fChargeMax);
349 fCrystalXYFired->
Paint();
358 if (fCrystalZRFired) {
359 fCrystalZRFired->SetLineColor(lcCrystalFired);
360 fCrystalZRFired->SetLineWidth(lwCrystalFired);
361 fCrystalZRFired->SetFillColor(fcCrystalFired);
362 fCrystalZRFired->SetFillStyle(fsCrystalFired);
367 fCrystalZR->SetLineColor(lcCrystal);
368 fCrystalZR->SetLineWidth(lwCrystal);
369 fCrystalZR->SetFillColor(fcCrystal);
370 fCrystalZR->SetFillStyle(fsCrystal);
375 fCrystalZR->SetLineColor(lcCrystalHL);
376 fCrystalZR->SetLineWidth(lwCrystalHL);
377 fCrystalZR->SetFillColor(fcCrystalHL);
378 fCrystalZR->SetFillStyle(fsCrystalHL);
380 if (fCrystalZRFired) {
381 fCrystalZRFired->SetLineColor(lcCrystalFiredHL);
382 fCrystalZRFired->SetLineWidth(lwCrystalFiredHL);
383 fCrystalZRFired->SetFillColor(fcCrystalFiredHL);
384 fCrystalZRFired->SetFillStyle(fsCrystalFiredHL);
388 if ( fCrystalZR ) fCrystalZR->
Paint();
394 if (fCrystalZRFired) {
397 fCrystalZRFired->
SetSize(fCharge/fChargeMax);
398 fCrystalZRFired->
Paint();
406 if (fCrystalSideFired) {
407 fCrystalSideFired->SetLineColor(lcCrystalFired);
408 fCrystalSideFired->SetLineWidth(lwCrystalFired);
409 fCrystalSideFired->SetFillColor(fcCrystalFired);
410 fCrystalSideFired->SetFillStyle(fsCrystalFired);
415 fCrystalSide->SetLineColor(lcCrystal);
416 fCrystalSide->SetLineWidth(lwCrystal);
417 fCrystalSide->SetFillColor(fcCrystal);
418 fCrystalSide->SetFillStyle(fsCrystal);
423 fCrystalSide->SetLineColor(lcCrystalHL);
424 fCrystalSide->SetLineWidth(lwCrystalHL);
425 fCrystalSide->SetFillColor(fcCrystalHL);
426 fCrystalSide->SetFillStyle(fsCrystalHL);
428 if (fCrystalSideFired) {
429 fCrystalSideFired->SetLineColor(lcCrystalFiredHL);
430 fCrystalSideFired->SetLineWidth(lwCrystalFiredHL);
431 fCrystalSideFired->SetFillColor(fcCrystalFiredHL);
432 fCrystalSideFired->SetFillStyle(fsCrystalFiredHL);
440 if (fCrystalSideFired) {
443 fCrystalSideFired->
SetSize(fCharge/fChargeMax);
444 fCrystalSideFired->
Paint();
458 else return TObject::GetObjectInfo(px, py);
471 Double_t zrPhi = viewPhi-90.0;
475 for (Int_t i = 0; i < 2; i++) {
481 if (zrPhi >= fPhiMin-fZRSectionTolerance[
GetPart()] &&
482 zrPhi <= fPhiMax+fZRSectionTolerance[
GetPart()]) {
486 else if (fPhiMin > fPhiMax) {
488 if (zrPhi >= fPhiMin-fZRSectionTolerance[
GetPart()] ||
489 zrPhi <= fPhiMax+fZRSectionTolerance[
GetPart()]) {
503 Double_t angle = TMath::ACos(
x/TMath::Sqrt(
x*
x+y*y) ) * TMath::RadToDeg();
504 if ( y<0.0 ) angle *= -1;
514 if (input >= 360.0) {
518 while (input >= 360.0);
520 else if (input < 0.0) {
542 Double_t viewPhiMin = viewPhi - sideDeltaPhi;
543 Double_t viewPhiMax = viewPhi + sideDeltaPhi;
550 if (viewPhiMin < viewPhiMax) {
551 if (fPhiMax > viewPhiMin && fPhiMax < viewPhiMax)
return true;
554 if (fPhiMax > viewPhiMin || fPhiMax < viewPhiMax)
return true;
564 Double_t ratio = fabs( (z-p1[2]) / (p2[2]-p1[2]) );
565 for (Int_t i = 0; i < 3; i++) {
566 newP[i] = p1[i] * (1.0-ratio) + p2[i] * ratio;
574 Double_t r1 = sqrt(p1[0]*p1[0] + p1[1]*p1[1]);
575 Double_t r2 = sqrt(p2[0]*p2[0] + p2[1]*p2[1]);
577 Double_t ratio = fabs( (r-r1) / (r2-r1) );
578 for (Int_t i = 0; i < 3; i++) {
579 newP[i] = p1[i] * (1.0-ratio) + p2[i] * ratio;
589 Double_t r1 = sqrt(p1[0]*p1[0] + p1[1]*p1[1]);
590 newP[0] = p1[0] * (brZRPointR/r1);
591 newP[1] = p1[1] * (brZRPointR/r1);
593 Double_t drToR = brZRPointR - r1;
594 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)