BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
Emc2DCrystal Class Reference

#include <Emc2DCrystal.h>

+ Inheritance diagram for Emc2DCrystal:

Public Member Functions

 Emc2DCrystal ()
 
 Emc2DCrystal (const char *name, const char *title, Int_t N, Double_t *P, Int_t part, Int_t theta)
 
 ~Emc2DCrystal ()
 
virtual void SetStyle ()
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 
virtual void SetHighlighted (bool status=true)
 
virtual void SetFired (bool status=true)
 
virtual bool IsHighlighted ()
 
virtual bool IsFired ()
 
virtual void AddInfo (TString info)
 
virtual void CloseInfo ()
 
virtual void ClearInfo ()
 
virtual void SetTime (Double_t time)
 
virtual void SetCharge (Double_t charge)
 
virtual Double_t GetTime ()
 
virtual Double_t GetCharge ()
 
virtual void ResetTimeCharge ()
 
virtual void Draw (Option_t *option="")
 
virtual void Paint (Option_t *option="")
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 
virtual Int_t GetPart ()
 
virtual Int_t GetTheta ()
 
virtual bool HasZRSection ()
 
Double_t GetAngle (Double_t x, Double_t y)
 
Double_t Range360 (Double_t input)
 
virtual bool IsXYVisible ()
 
virtual bool IsSideVisible ()
 
virtual void SetXYPoint (Double_t *p1, Double_t *p2, Double_t *newP, Double_t z)
 
virtual void SetZRPoint (Double_t *p1, Double_t *p2, Double_t *newP, Double_t r)
 
virtual void ProjectECToSide (Double_t *p1, Double_t *newP)
 

Detailed Description

Definition at line 18 of file Emc2DCrystal.h.

Constructor & Destructor Documentation

◆ Emc2DCrystal() [1/2]

Emc2DCrystal::Emc2DCrystal ( )

◆ Emc2DCrystal() [2/2]

Emc2DCrystal::Emc2DCrystal ( const char * name,
const char * title,
Int_t N,
Double_t * P,
Int_t part,
Int_t theta )

Definition at line 25 of file Emc2DCrystal.cxx.

26{
27 SetName(name);
29 fTip = 0;
30 fHighlighted = false;
31 fFired = false;
32 fPart = part;
33 fTheta = theta;
34
35 fTime = 0.0;
36 fCharge = 0.0;
37
38 fZRSectionTolerance[1] = 0.1; // degree
39 fZRSectionTolerance[2] = fZRSectionTolerance[0] = 1.2; // degree
40
41 // ------XY------
42
43 Double_t Pxy[3*5]; // 4 side and 5 side shape in Emc End crystal
44 if (N == 8) { // 4 side
45 Int_t iXYSeq[4] = {0,2,6,4};
46 for (Int_t i = 0; i < 4; i++) {
47 if (part == 1) {
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;
50 }
51 }
52 else if (part == 0) {
53 SetXYPoint(&P[3*i], &P[3*(i+4)], &Pxy[3*i], ecXYPointZ);
54 //for (Int_t j = 0; j < 3; j++) Pxy[3*i+j] = P[3*i+j];
55 }
56 else if (part == 2) {
57 SetXYPoint(&P[3*i], &P[3*(i+4)], &Pxy[3*i], -ecXYPointZ);
58 //for (Int_t j = 0; j < 3; j++) Pxy[3*i+j] = P[3*i+j];
59 }
60 //cout << GetName() << endl;
61 //if (GetName() == TString("EastEcTheta5Phi0")) cout << Pxy[3*i] << " " << Pxy[3*i+1] << " " << Pxy[3*i+2] << endl;
62 }
63
64 fCrystalXY = new BesPolygon2D(name, title, 4, &Pxy[0]);
65 fCrystalXYFired = new BesPolygon2D(name, title, 4, &Pxy[0]);
66 }
67 if (N == 16) { // 5 side
68 Int_t iXYSeq[5] = {8,9,1,2,3}; // 9 10,1 2
69 for (Int_t i = 0; i < 5; i++) { // 8 11,0 3
70 if (part == 0) {
71 SetXYPoint(&P[3*iXYSeq[i]], &P[3*(iXYSeq[i]+4)], &Pxy[3*i], ecXYPointZ);
72 }
73 else if (part == 2) {
74 SetXYPoint(&P[3*iXYSeq[i]], &P[3*(iXYSeq[i]+4)], &Pxy[3*i], -ecXYPointZ);
75 }
76 //for (Int_t j = 0; j < 3; j++) Pxy[3*i+j] = P[3*iXYSeq[i]+j];
77 }
78
79 fCrystalXY = new BesPolygon2D(name, title, 5, &Pxy[0]);
80 fCrystalXYFired = new BesPolygon2D(name, title, 5, &Pxy[0]);
81 }
82
83 // ------ZR------
84
85 Double_t Pzr[3*4];
86 Int_t iSeq[8] = {0,3,1,2,5,6,4,7}; // center of 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;
90 }
91 //if (GetName() == TString("EastEcCrystal0")) cout << Pxy[i] << endl;
92 }
93
94
95 fCrystalZR = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]);
96 fCrystalZRFired = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]);
97
98 if (N == 8) {
99 if (GetPart() == 1) {
100 fPhiMin = GetAngle( P[3*0], P[3*0+1] );
101 fPhiMax = GetAngle( P[3*3], P[3*3+1] );
102 }
103 else {
104 fPhiMin = GetAngle( P[3*3], P[3*3+1] );
105 fPhiMax = GetAngle( P[3*0], P[3*0+1] );
106 }
107 }
108 else if (N == 16) {
109 fPhiMin = GetAngle( P[3*3], P[3*3+1] );
110 fPhiMax = GetAngle( P[3*8], P[3*8+1] );
111 }
112
113 //Long Peixun's update: Remove fabs()
114 if (fPhiMin > fPhiMax && fPhiMin - fPhiMax < 180.0)
115 { // not cross 0 degree
116 Double_t phiTemp = fPhiMin;
117 fPhiMin = fPhiMax;
118 fPhiMax = phiTemp;
119 }
120 //Long Peixun's update: Consider crossing 0 degree
121 if (fPhiMax > fPhiMin && fPhiMax - fPhiMin > 180.0)
122 {
123 Double_t phiTemp = fPhiMin;
124 fPhiMin = fPhiMax;
125 fPhiMax = phiTemp;
126 }
127 //cout << GetName() << " min "<< fPhiMin << " max " << fPhiMax << endl;
128
129 // ------Side------
130
131 Double_t Pside[3*5]; // 4 side and 5 side shape in Emc End crystal
132 if (N == 8) { // 4 side
133 //Int_t iSideSeq[4] = {0,1,2,3};
134 for (Int_t i = 0; i < 4; i++) {
135 if (part == 1) {
136 SetZRPoint(&P[3*i], &P[3*(i+4)], &Pside[3*i], brZRPointR);
137 }
138 else {
139 ProjectECToSide(&Pxy[3*i], &Pside[3*i]);
140 }
141 }
142
143 fCrystalSide = new BesPolygon2D(name, title, 4, &Pside[0]);
144 fCrystalSideFired = new BesPolygon2D(name, title, 4, &Pside[0]);
145 }
146 if (N == 16) { // 5 side
147 for (Int_t i = 0; i < 5; i++) {
148 ProjectECToSide(&Pxy[3*i], &Pside[3*i]);
149 }
150
151 fCrystalSide = new BesPolygon2D(name, title, 5, &Pside[0]);
152 fCrystalSideFired = new BesPolygon2D(name, title, 5, &Pside[0]);
153 }
154
155 // Init
156
157 SetStyle();
158
159 fTip = new BesPaveText(0, 0, 0.45, 0.08);
160 CloseInfo();
161}
double P(RecMdcKalTrack *trk)
cout<<"end eff5"<< endl;TGraph *gr1=new TGraphErrors(15, x, eff_ep, errx, err_ep);TGraph *gr2=new TGraphErrors(15, x, eff_em, errx, err_em);TGraph *gr3=new TGraphErrors(15, x, eff_ep2, errx, err_ep2);TGraph *gr4=new TGraphErrors(15, x, eff_em2, errx, err_em2);TGraph *gr5=new TGraphErrors(15, x, eff_ep3, errx, err_ep3);TGraph *gr6=new TGraphErrors(15, x, eff_em3, errx, err_em3);TGraph *gr7=new TGraphErrors(15, x, eff_ep4, errx, err_ep4);TGraph *gr8=new TGraphErrors(15, x, eff_em4, errx, err_em4);TGraph *gr9=new TGraphErrors(15, x, eff_ep5, errx, err_ep5);TGraph *gr10=new TGraphErrors(15, x, eff_em5, errx, err_em5);TCanvas *c1=new TCanvas("c1","bhabha_eff", 100, 10, 600, 400);TMultiGraph *mg=new TMultiGraph();mg-> SetTitle("bhabha_eff")
titledef title[20]
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 SetStyle()
virtual void CloseInfo()
Double_t GetAngle(Double_t x, Double_t y)
virtual Int_t GetPart()
virtual void SetXYPoint(Double_t *p1, Double_t *p2, Double_t *newP, Double_t z)

◆ ~Emc2DCrystal()

Emc2DCrystal::~Emc2DCrystal ( )

Definition at line 165 of file Emc2DCrystal.cxx.

165 {
166 //Long Peixun's update: remove "if"
167 delete fCrystalXY;
168 delete fCrystalZR;
169 delete fCrystalXYFired;
170 delete fCrystalZRFired;
171}

Member Function Documentation

◆ AddInfo()

virtual void Emc2DCrystal::AddInfo ( TString info)
inlinevirtual

Definition at line 35 of file Emc2DCrystal.h.

35{ fInfoCon.push_back(info); }

Referenced by EmcROOTGeo::SetHits().

◆ ClearInfo()

void Emc2DCrystal::ClearInfo ( )
virtual

Definition at line 197 of file Emc2DCrystal.cxx.

198{
199 fInfoCon.clear();
200 fTip->DeleteText();
201}

Referenced by EmcROOTGeo::SetHits().

◆ CloseInfo()

void Emc2DCrystal::CloseInfo ( )
virtual

Definition at line 203 of file Emc2DCrystal.cxx.

204{
205 if (fTip) {
206 fTip->Clear();
207
208 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
209 fTip->SetText(fInfoCon);
210 }
211 else
212 cout << "Emc2DCrystal::CloseInfo, not initialized" << endl;
213}
virtual void SetText(std::vector< TString > infoCon)

Referenced by Emc2DCrystal(), and EmcROOTGeo::SetHits().

◆ DistancetoPrimitive()

Int_t Emc2DCrystal::DistancetoPrimitive ( Int_t px,
Int_t py )
virtual

Definition at line 217 of file Emc2DCrystal.cxx.

217 {
218
219 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
220 if ( view->GetViewType() & kXYView ) {
221 if ( fCrystalXY && IsXYVisible() ) {
222 return fCrystalXY->DistancetoPrimitive(px, py);
223 }
224 }
225 else if ( view->GetViewType() & kZRView && fCrystalZR && fCrystalSide ) {
226 if (HasZRSection())
227 return fCrystalZR->DistancetoPrimitive(px, py);
228 else if ( IsSideVisible() &&
229 (view->GetVisEmcSide() || (view->GetVisEmcHitsSide() && IsFired())) )
230 return fCrystalSide->DistancetoPrimitive(px, py);
231 }
232
233 return 9999;
234}
@ kXYView
Definition BesStatus.h:18
@ kZRView
Definition BesStatus.h:19
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Bool_t GetVisEmcHitsSide()
Definition BesView.h:215
EBESViewType GetViewType()
Definition BesView.h:71
Bool_t GetVisEmcSide()
Definition BesView.h:138
virtual bool IsSideVisible()
virtual bool HasZRSection()
virtual bool IsXYVisible()
virtual bool IsFired()

◆ Draw()

void Emc2DCrystal::Draw ( Option_t * option = "")
virtual

Definition at line 294 of file Emc2DCrystal.cxx.

294 {
295 //
296 // Emc2DCrystal draw function
297 TString opt = option;
298 opt.ToUpper();
299
300 AppendPad(option);
301}

Referenced by EmcROOTGeo::Draw(), and EmcROOTGeo::DrawHits().

◆ ExecuteEvent()

void Emc2DCrystal::ExecuteEvent ( Int_t event,
Int_t px,
Int_t py )
virtual

Definition at line 238 of file Emc2DCrystal.cxx.

238 {
239
240 //if (fWireType == 2 && fWireBubble[0] ) {
241 //if (fWireCone->GetLineWidth() > 1) // FIRED
242 //cout << GetName() << endl;
243
244 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
245
246 if (gBesCursor->GetType() == kBesHand) {
247 if (view) view->ExecuteEvent(event, px, py);
248 }
249 else if (gBesCursor->GetType() == kBesPick){
250
251 if (gPad) gPad->SetCursor(kPointer);
252
253 switch (event) {
254
255 case kMouseEnter :
256 this->SetHighlighted(true);
257
258 //if (this->IsFired() || view->GetVisEmcHitsGlobal()) {
259 Draw();
260
261 fTip->SetPos(px, py);
262 view->UpdateView(0);
263
264 //Long Peixun's update: If ShowInfo is not checked, don't show tip text.
265 if (gBesCursor->GetShowInfo()) fTip->Draw("BR,SAME"); // "BR,ARC,SAME"
266 gPad->Modified();
267 gPad->Update();
268 break;
269
270 case kMouseLeave:
271 if (this->IsHighlighted()) {
272 this->SetHighlighted(false);
273 //if (view->GetVisEmcHitsGlobal())
274 Draw();
275
276 /*
277 if (fTip) {
278 delete fTip;
279 fTip = 0;
280 }
281 */
282
283 view->UpdateView(0);
284 gPad->Modified();
285 gPad->Update();
286 break;
287 }
288 }
289 }
290}
@ kBesHand
Definition BesCursor.h:15
@ kBesPick
Definition BesCursor.h:14
R__EXTERN BesCursor * gBesCursor
Definition BesCursor.h:40
legend Draw()
Bool_t GetShowInfo()
Definition BesCursor.h:35
EBESCursorType GetType()
Definition BesCursor.h:32
virtual void SetPos(Int_t px, Int_t py)
virtual void UpdateView(Bool_t resetview=kFALSE)
Definition BesView.cxx:657
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Definition BesView.cxx:366
virtual void SetHighlighted(bool status=true)
virtual bool IsHighlighted()

◆ GetAngle()

Double_t Emc2DCrystal::GetAngle ( Double_t x,
Double_t y )

Definition at line 511 of file Emc2DCrystal.cxx.

512{
513 Double_t angle = TMath::ACos( x/TMath::Sqrt(x*x+y*y) ) * TMath::RadToDeg();
514 if ( y<0.0 ) angle *= -1;
515 angle = Range360(angle);
516
517 return angle;
518}
Double_t Range360(Double_t input)
double y[1000]

Referenced by Emc2DCrystal().

◆ GetCharge()

virtual Double_t Emc2DCrystal::GetCharge ( )
inlinevirtual

Definition at line 42 of file Emc2DCrystal.h.

42{ return fCharge; }

Referenced by EmcROOTGeo::DrawHits().

◆ GetObjectInfo()

char * Emc2DCrystal::GetObjectInfo ( Int_t px,
Int_t py ) const
virtual

Definition at line 464 of file Emc2DCrystal.cxx.

464 {
465
466 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
467 if (view) return view->GetObjectInfo(px, py);
468 else return TObject::GetObjectInfo(px, py);
469}
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Definition BesView.cxx:869

◆ GetPart()

virtual Int_t Emc2DCrystal::GetPart ( )
inlinevirtual

Definition at line 49 of file Emc2DCrystal.h.

49{ return fPart; }

Referenced by EmcROOTGeo::DrawHits(), Emc2DCrystal(), BesGeoTrack::ExecuteEvent(), HasZRSection(), and IsXYVisible().

◆ GetTheta()

virtual Int_t Emc2DCrystal::GetTheta ( )
inlinevirtual

Definition at line 50 of file Emc2DCrystal.h.

50{ return fTheta; }

Referenced by IsXYVisible().

◆ GetTime()

virtual Double_t Emc2DCrystal::GetTime ( )
inlinevirtual

Definition at line 41 of file Emc2DCrystal.h.

41{ return fTime; }

◆ HasZRSection()

bool Emc2DCrystal::HasZRSection ( )
virtual

Definition at line 473 of file Emc2DCrystal.cxx.

474{
475 bool flag = false;
476 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
477 Double_t viewPhi = view->GetLongitude();
478 viewPhi = Range360(viewPhi);
479 //if (GetName() == TString("Layer0Wire0")) cout << "view " << viewPhi << endl;
480
481 Double_t zrPhi = viewPhi-90.0;
482 zrPhi = Range360(zrPhi);
483 //if (GetName() == TString("Layer0Wire0")) cout << zrPhi << endl;
484
485 for (Int_t i = 0; i < 2; i++) {
486 if (i==1) {
487 zrPhi += 180.0;
488 zrPhi = Range360(zrPhi);
489 }
490
491 if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] &&
492 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
493 flag = true;
494 break;
495 }
496 else if (fPhiMin > fPhiMax) { // cross 0 degree
497 //cout << GetName() << " zrPhi " << zrPhi << " min " << fPhiMin << " max " << fPhiMax << endl;
498 if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] ||
499 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
500 flag = true;
501 break;
502 }
503 }
504 }
505
506 return flag;
507}
Double_t GetLongitude()
Definition BesTView.h:95

Referenced by DistancetoPrimitive(), and Paint().

◆ IsFired()

virtual bool Emc2DCrystal::IsFired ( )
inlinevirtual

Definition at line 33 of file Emc2DCrystal.h.

33{ return fFired; }

Referenced by DistancetoPrimitive(), IsXYVisible(), and Paint().

◆ IsHighlighted()

virtual bool Emc2DCrystal::IsHighlighted ( )
inlinevirtual

Definition at line 32 of file Emc2DCrystal.h.

32{ return fHighlighted; }

Referenced by BesGeoTrack::ExecuteEvent(), ExecuteEvent(), and Paint().

◆ IsSideVisible()

bool Emc2DCrystal::IsSideVisible ( )
virtual

Definition at line 548 of file Emc2DCrystal.cxx.

549{
550 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
551 Double_t viewPhi = view->GetLongitude();
552 Double_t viewPhiMin = viewPhi - sideDeltaPhi;
553 Double_t viewPhiMax = viewPhi + sideDeltaPhi;
554
555 viewPhi = Range360(viewPhi);
556 viewPhiMin = Range360(viewPhiMin);
557 viewPhiMax = Range360(viewPhiMax);
558 //if (GetName() == TString("Layer0Wire0")) cout << "view " << viewPhi << endl;
559
560 if (viewPhiMin < viewPhiMax) { // not cross 0 degree
561 if (fPhiMax > viewPhiMin && fPhiMax < viewPhiMax) return true;
562 }
563 else { // cross 0 degree
564 if (fPhiMax > viewPhiMin || fPhiMax < viewPhiMax) return true;
565 }
566
567 return false;
568}

Referenced by DistancetoPrimitive(), and Paint().

◆ IsXYVisible()

bool Emc2DCrystal::IsXYVisible ( )
virtual

Definition at line 540 of file Emc2DCrystal.cxx.

541{
542 if ( GetPart() != 1 || GetTheta() == 0 || IsFired() )
543 return true;
544 else
545 return false;
546}
virtual Int_t GetTheta()

Referenced by DistancetoPrimitive(), and Paint().

◆ Paint()

void Emc2DCrystal::Paint ( Option_t * option = "")
virtual

Definition at line 305 of file Emc2DCrystal.cxx.

305 {
306
307 TString opt = option;
308 opt.ToUpper();
309
310 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
311 if (view->GetViewType() & kXYView) {
312
313 if (fCrystalXY) {
314 fCrystalXY->SetLineColor(lcCrystal);
315 fCrystalXY->SetLineWidth(lwCrystal);
316 fCrystalXY->SetFillColor(fcCrystal);
317 fCrystalXY->SetFillStyle(fsCrystal);
318 }
319
320 if (this->IsFired()) {
321 if (fCrystalXY) {
322 fCrystalXY->SetFillStyle(fsCrystalTrans);
323 }
324 if (fCrystalXYFired) {
325 fCrystalXYFired->SetLineColor(lcCrystalFired);
326 fCrystalXYFired->SetLineWidth(lwCrystalFired);
327 fCrystalXYFired->SetFillColor(fcCrystalFired);
328 fCrystalXYFired->SetFillStyle(fsCrystalFired);
329 }
330 }
331
332 if (this->IsHighlighted()) {
333 if (fCrystalXY) {
334 fCrystalXY->SetLineColor(lcCrystalHL);
335 fCrystalXY->SetLineWidth(lwCrystalHL);
336 fCrystalXY->SetFillColor(fcCrystalHL);
337 fCrystalXY->SetFillStyle(fsCrystalHL);
338 }
339 if (fCrystalXYFired) {
340 fCrystalXYFired->SetLineColor(lcCrystalFiredHL);
341 fCrystalXYFired->SetLineWidth(lwCrystalFiredHL);
342 fCrystalXYFired->SetFillColor(fcCrystalFiredHL);
343 fCrystalXYFired->SetFillStyle(fsCrystalFiredHL);
344 }
345 }
346
347 if ( fCrystalXY && IsXYVisible() ) fCrystalXY->Paint();
348 if (this->IsFired()) {
349 if (view->GetVisEmcHitsGlobal() &&
350 ( (fPart == 0 && view->GetVisEmcHitsEast()) ||
351 (fPart == 1 && view->GetVisEmcHitsBarrel()) ||
352 (fPart == 2 && view->GetVisEmcHitsWest()) )) {
353 if (fCrystalXYFired) {
354 fCrystalXY->Paint();
355 //if (this->IsHighlighted()) cout << GetName() << " is highlighted " << endl;
356 //cout << "Emc fired Crystal size " << fCharge/fChargeMax << endl;
357 fCrystalXYFired->Restore(); // restore default size
358 fCrystalXYFired->SetSize(fCharge/fChargeMax);
359 fCrystalXYFired->Paint();
360 }
361 }
362 }
363 }
364
365 if (view->GetViewType() & kZRView) {
366 if (HasZRSection()) {
367 if (this->IsFired()) {
368 if (fCrystalZRFired) {
369 fCrystalZRFired->SetLineColor(lcCrystalFired);
370 fCrystalZRFired->SetLineWidth(lwCrystalFired);
371 fCrystalZRFired->SetFillColor(fcCrystalFired);
372 fCrystalZRFired->SetFillStyle(fsCrystalFired);
373 }
374 }
375
376 if (fCrystalZR) {
377 fCrystalZR->SetLineColor(lcCrystal);
378 fCrystalZR->SetLineWidth(lwCrystal);
379 fCrystalZR->SetFillColor(fcCrystal);
380 fCrystalZR->SetFillStyle(fsCrystal);
381 }
382
383 if (this->IsHighlighted()) {
384 if (fCrystalZR) {
385 fCrystalZR->SetLineColor(lcCrystalHL);
386 fCrystalZR->SetLineWidth(lwCrystalHL);
387 fCrystalZR->SetFillColor(fcCrystalHL);
388 fCrystalZR->SetFillStyle(fsCrystalHL);
389 }
390 if (fCrystalZRFired) {
391 fCrystalZRFired->SetLineColor(lcCrystalFiredHL);
392 fCrystalZRFired->SetLineWidth(lwCrystalFiredHL);
393 fCrystalZRFired->SetFillColor(fcCrystalFiredHL);
394 fCrystalZRFired->SetFillStyle(fsCrystalFiredHL);
395 }
396 }
397
398 if ( fCrystalZR ) fCrystalZR->Paint();
399 if (this->IsFired()) {
400 if (view->GetVisEmcHitsGlobal() &&
401 ( (fPart == 0 && view->GetVisEmcHitsEast()) ||
402 (fPart == 1 && view->GetVisEmcHitsBarrel()) ||
403 (fPart == 2 && view->GetVisEmcHitsWest()) )) {
404 if (fCrystalZRFired) {
405 //cout << "Emc fired Crystal size " << fCharge/fChargeMax << endl;
406 fCrystalZRFired->Restore(); // restore default size
407 fCrystalZRFired->SetSize(fCharge/fChargeMax);
408 fCrystalZRFired->Paint();
409 }
410 }
411 }
412 }
413
414 // side
415 if (this->IsFired()) {
416 if (fCrystalSideFired) {
417 fCrystalSideFired->SetLineColor(lcCrystalFired);
418 fCrystalSideFired->SetLineWidth(lwCrystalFired);
419 fCrystalSideFired->SetFillColor(fcCrystalFired);
420 fCrystalSideFired->SetFillStyle(fsCrystalFired);
421 }
422 }
423
424 if (fCrystalSide) {
425 fCrystalSide->SetLineColor(lcCrystal);
426 fCrystalSide->SetLineWidth(lwCrystal);
427 fCrystalSide->SetFillColor(fcCrystal);
428 fCrystalSide->SetFillStyle(fsCrystal);
429 }
430
431 if (this->IsHighlighted()) {
432 if (fCrystalSide) {
433 fCrystalSide->SetLineColor(lcCrystalHL);
434 fCrystalSide->SetLineWidth(lwCrystalHL);
435 fCrystalSide->SetFillColor(fcCrystalHL);
436 fCrystalSide->SetFillStyle(fsCrystalHL);
437 }
438 if (fCrystalSideFired) {
439 fCrystalSideFired->SetLineColor(lcCrystalFiredHL);
440 fCrystalSideFired->SetLineWidth(lwCrystalFiredHL);
441 fCrystalSideFired->SetFillColor(fcCrystalFiredHL);
442 fCrystalSideFired->SetFillStyle(fsCrystalFiredHL);
443 }
444 }
445
446 if ( IsSideVisible() ) {
447 if ( (view->GetVisEmcSide() || view->GetVisEmcHitsSide() && this->IsFired()) && fCrystalSide ) fCrystalSide->Paint();
448 if ( this->IsFired() ) {
449 if (view->GetVisEmcHitsGlobal() && view->GetVisEmcHitsSide()) {
450 if (fCrystalSideFired) {
451 //cout << "Emc fired Crystal size " << fCharge/fChargeMax << endl;
452 fCrystalSideFired->Restore(); // restore default size
453 fCrystalSideFired->SetSize(fCharge/fChargeMax);
454 fCrystalSideFired->Paint();
455 }
456 }
457 }
458 }
459 }
460}
virtual void SetSize(Double_t size)
virtual void Paint(Option_t *option="")
virtual void Restore()
Bool_t GetVisEmcHitsBarrel()
Definition BesView.h:213
Bool_t GetVisEmcHitsGlobal()
Definition BesView.h:211
Bool_t GetVisEmcHitsWest()
Definition BesView.h:214
Bool_t GetVisEmcHitsEast()
Definition BesView.h:212

◆ ProjectECToSide()

void Emc2DCrystal::ProjectECToSide ( Double_t * p1,
Double_t * newP )
virtual

Definition at line 593 of file Emc2DCrystal.cxx.

594{
595 // ------ R ---------
596 // | --> |
597 // | r |
598
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);
602
603 Double_t drToR = brZRPointR - r1;
604 newP[2] = fabs(ecXYPointZ + drToR) * (p1[2]/fabs(p1[2]));
605
606
607 //if (GetName() == TString("EastEcTheta0Phi0")) {
608 //cout << p1[0] << " " << p1[1] << " " << p1[2] << endl;
609 //cout << newP[0] << " " << newP[1] << " " << newP[2] << endl;
610 //}
611
612}
double p1[4]

Referenced by Emc2DCrystal().

◆ Range360()

Double_t Emc2DCrystal::Range360 ( Double_t input)

Definition at line 522 of file Emc2DCrystal.cxx.

523{
524 if (input >= 360.0) {
525 do {
526 input -= 360.0;
527 }
528 while (input >= 360.0);
529 }
530 else if (input < 0.0) {
531 do {
532 input += 360.0;
533 }
534 while (input < 0.0);
535 }
536
537 return input;
538}

Referenced by GetAngle(), HasZRSection(), and IsSideVisible().

◆ ResetTimeCharge()

virtual void Emc2DCrystal::ResetTimeCharge ( )
inlinevirtual

Definition at line 43 of file Emc2DCrystal.h.

43{ fTime = 0.0; fCharge = 0.0; }

◆ SetCharge()

virtual void Emc2DCrystal::SetCharge ( Double_t charge)
inlinevirtual

Definition at line 40 of file Emc2DCrystal.h.

40{ fCharge = charge; }
float charge

Referenced by EmcROOTGeo::SetHits().

◆ SetFired()

virtual void Emc2DCrystal::SetFired ( bool status = true)
inlinevirtual

Definition at line 31 of file Emc2DCrystal.h.

31{ fFired = status; }

Referenced by EmcROOTGeo::Draw(), and EmcROOTGeo::DrawHits().

◆ SetHighlighted()

virtual void Emc2DCrystal::SetHighlighted ( bool status = true)
inlinevirtual

Definition at line 30 of file Emc2DCrystal.h.

30{ fHighlighted = status; }

Referenced by BesGeoTrack::ExecuteEvent(), and ExecuteEvent().

◆ SetStyle()

void Emc2DCrystal::SetStyle ( )
virtual

Definition at line 173 of file Emc2DCrystal.cxx.

174{
175 lcCrystal = 15;
176 lwCrystal = 1;
177 fcCrystal = 9005; // lightBlue
178 fsCrystal = 1001;
179 fsCrystalTrans = 4000;
180
181 lcCrystalFired = kRed;
182 lwCrystalFired = 1;
183 fcCrystalFired = kRed;
184 fsCrystalFired = 1001;
185
186 lcCrystalHL = lcCrystal;
187 lwCrystalHL = 1;
188 fcCrystalHL = kBlue;
189 fsCrystalHL = 1001;
190
191 lcCrystalFiredHL = kRed;
192 lwCrystalFiredHL = 2;
193 fcCrystalFiredHL = kWhite;
194 fsCrystalFiredHL = 4000;
195}

Referenced by Emc2DCrystal().

◆ SetTime()

virtual void Emc2DCrystal::SetTime ( Double_t time)
inlinevirtual

Definition at line 39 of file Emc2DCrystal.h.

39{ fTime = time; }
Double_t time

Referenced by EmcROOTGeo::SetHits().

◆ SetXYPoint()

void Emc2DCrystal::SetXYPoint ( Double_t * p1,
Double_t * p2,
Double_t * newP,
Double_t z )
virtual

Definition at line 572 of file Emc2DCrystal.cxx.

573{
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;
577 }
578}
double p2[4]

Referenced by Emc2DCrystal().

◆ SetZRPoint()

void Emc2DCrystal::SetZRPoint ( Double_t * p1,
Double_t * p2,
Double_t * newP,
Double_t r )
virtual

Definition at line 582 of file Emc2DCrystal.cxx.

583{
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]);
586
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;
590 }
591}

Referenced by Emc2DCrystal().


The documentation for this class was generated from the following files: