BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
Tof2DScin Class Reference

#include <Tof2DScin.h>

+ Inheritance diagram for Tof2DScin:

Public Member Functions

 Tof2DScin ()
 
 Tof2DScin (const char *name, const char *title, Int_t N, Double_t *P, Int_t part)
 
 ~Tof2DScin ()
 
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 bool HasZRSection ()
 
Double_t GetAngle (Double_t x, Double_t y)
 
Double_t Range360 (Double_t input)
 

Detailed Description

Definition at line 18 of file Tof2DScin.h.

Constructor & Destructor Documentation

◆ Tof2DScin() [1/2]

Tof2DScin::Tof2DScin ( )

◆ Tof2DScin() [2/2]

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

Definition at line 25 of file Tof2DScin.cxx.

26{
27 SetName(name);
28 SetTitle(title);
29 fTip = 0;
30 fHighlighted = false;
31 fFired = false;
32 fPart = part;
33
34 fTime = 0.0;
35 fCharge = 0.0;
36
37 fZRSectionTolerance[1] = 0.071; // half of gap between two scin
38 fZRSectionTolerance[2] = fZRSectionTolerance[0] = 0.1647;
39
40 // ------XY------
41
42 Double_t Pxy[3*4]; // N=8
43 for (Int_t i = 0; i < 3*4; i++) {
44 Pxy[i] = (P[i] + P[i+3*4])/2.0;
45 //if (GetName() == TString("EastEcScin0")) cout << Pxy[i] << endl;
46 }
47
48 fScinXY = new BesPolygon2D(name, title, 4, &Pxy[0]);
49 fScinXYFired = new BesPolygon2D(name, title, 4, &Pxy[0]);
50
51 // ------ZR------
52
53 Double_t Pzr[3*4];
54 Int_t iSeq[8] = {0,3,1,2,5,6,4,7}; // center of 0+3, 1+2, 5+6, 4+7
55 for (Int_t i = 0; i < 4; i++) {
56 for (Int_t j = 0; j < 3; j++) {
57 Pzr[3*i+j] = (P[3*iSeq[2*i]+j] + P[3*iSeq[2*i+1]+j])/2.0;
58 }
59 //if (GetName() == TString("EastEcScin0")) cout << Pxy[i] << endl;
60 }
61
62
63 fScinZR = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]);
64 fScinZRFired = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]);
65
66 fPhiMin = GetAngle( P[3*3], P[3*3+1] );
67 fPhiMax = GetAngle( P[3*0], P[3*0+1] );
68 if (GetPart() == 2) {
69 Double_t phiTemp = fPhiMin;
70 fPhiMin = fPhiMax;
71 fPhiMax = phiTemp;
72 }
73 //cout << GetName() << " min "<< fPhiMin << " max " << fPhiMax << endl;
74
75 SetStyle();
76
77 fTip = new BesPaveText(0, 0, 0.1, 0.1);
78 CloseInfo();
79}
double P(RecMdcKalTrack *trk)
gr SetTitle("BbLum_000XXXX")
virtual Int_t GetPart()
Definition: Tof2DScin.h:49
Double_t GetAngle(Double_t x, Double_t y)
Definition: Tof2DScin.cxx:363
virtual void CloseInfo()
Definition: Tof2DScin.cxx:121
virtual void SetStyle()
Definition: Tof2DScin.cxx:91

◆ ~Tof2DScin()

Tof2DScin::~Tof2DScin ( )

Definition at line 83 of file Tof2DScin.cxx.

83 {
84
85 if (fScinXY) delete fScinXY;
86 if (fScinZR) delete fScinZR;
87 if (fScinXYFired) delete fScinXYFired;
88 if (fScinZRFired) delete fScinZRFired;
89}

Member Function Documentation

◆ AddInfo()

virtual void Tof2DScin::AddInfo ( TString  info)
inlinevirtual

Definition at line 35 of file Tof2DScin.h.

35{ fInfoCon.push_back(info); }

Referenced by TofROOTGeo::SetHits().

◆ ClearInfo()

void Tof2DScin::ClearInfo ( )
virtual

Definition at line 115 of file Tof2DScin.cxx.

116{
117 fInfoCon.clear();
118 fTip->DeleteText();
119}

Referenced by TofROOTGeo::SetHits().

◆ CloseInfo()

void Tof2DScin::CloseInfo ( )
virtual

Definition at line 121 of file Tof2DScin.cxx.

122{
123 if (fTip) {
124 fTip->Clear();
125
126 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
127 fTip->SetText(fInfoCon);
128 }
129 else
130 cout << "Tof2DScin::CloseInfo, not initialized" << endl;
131}
virtual void SetText(std::vector< TString > infoCon)
Definition: BesPaveText.cxx:35

Referenced by TofROOTGeo::SetHits(), and Tof2DScin().

◆ DistancetoPrimitive()

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

Definition at line 135 of file Tof2DScin.cxx.

135 {
136
137 BesView *view = (BesView*)gPad->GetView();
138 if (view->GetViewType() & kXYView && fScinXY) {
139 return fScinXY->DistancetoPrimitive(px, py);
140 }
141 else if (view->GetViewType() & kZRView && fScinZR) {
142 if (HasZRSection())
143 return fScinZR->DistancetoPrimitive(px, py);
144 }
145
146 return 9999;
147}
@ kXYView
Definition: BesStatus.h:15
@ kZRView
Definition: BesStatus.h:16
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
EBESViewType GetViewType()
Definition: BesView.h:65
virtual bool HasZRSection()
Definition: Tof2DScin.cxx:326

◆ Draw()

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

Definition at line 197 of file Tof2DScin.cxx.

197 {
198 //
199 // Tof2DScin draw function
200 TString opt = option;
201 opt.ToUpper();
202
203 AppendPad(option);
204}

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

◆ ExecuteEvent()

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

Definition at line 151 of file Tof2DScin.cxx.

151 {
152
153 //cout << GetName() << endl;
154
155 BesView *view = (BesView*)gPad->GetView();
156
157 if (gBesCursor->GetType() == kBesHand) {
158 if (view) view->ExecuteEvent(event, px, py);
159 }
160 else if (gBesCursor->GetType() == kBesPick){
161
162 if (gPad) gPad->SetCursor(kPointer);
163
164 switch (event) {
165
166 case kMouseEnter :
167 this->SetHighlighted(true);
168
169 //if (this->IsFired() || view->GetVisTofHitsGlobal()) {
170 Draw();
171
172 fTip->SetPos(px, py);
173 view->UpdateView(0);
174
175 fTip->Draw("BR,SAME"); // "BR,ARC,SAME"
176 gPad->Modified();
177 gPad->Update();
178 break;
179
180 case kMouseLeave:
181 if (this->IsHighlighted()) {
182 this->SetHighlighted(false);
183 //if (view->GetVisTofHitsGlobal())
184 Draw();
185
186 view->UpdateView(0);
187 gPad->Modified();
188 gPad->Update();
189 break;
190 }
191 }
192 }
193}
@ kBesHand
Definition: BesCursor.h:15
@ kBesPick
Definition: BesCursor.h:14
R__EXTERN BesCursor * gBesCursor
Definition: BesCursor.h:40
EBESCursorType GetType()
Definition: BesCursor.h:32
virtual void SetPos(Int_t px, Int_t py)
Definition: BesPaveText.cxx:76
virtual void UpdateView(Bool_t resetview=kFALSE)
Definition: BesView.cxx:598
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Definition: BesView.cxx:365
virtual void SetHighlighted(bool status=true)
Definition: Tof2DScin.h:30
virtual bool IsHighlighted()
Definition: Tof2DScin.h:32
c1_1 Draw()

◆ GetAngle()

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

Definition at line 363 of file Tof2DScin.cxx.

364{
365 Double_t angle = TMath::ACos( x/TMath::Sqrt(x*x+y*y) ) * TMath::RadToDeg();
366 if ( y<0.0 ) angle *= -1;
367 angle = Range360(angle);
368
369 return angle;
370}
Double_t Range360(Double_t input)
Definition: Tof2DScin.cxx:374

Referenced by Tof2DScin().

◆ GetCharge()

virtual Double_t Tof2DScin::GetCharge ( )
inlinevirtual

Definition at line 42 of file Tof2DScin.h.

42{ return fCharge; }

Referenced by TofROOTGeo::DrawHits(), and TofROOTGeo::SetHits().

◆ GetObjectInfo()

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

Definition at line 317 of file Tof2DScin.cxx.

317 {
318
319 BesView *view = (BesView*)gPad->GetView();
320 if (view) return view->GetObjectInfo(px, py);
321 else return TObject::GetObjectInfo(px, py);
322}
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Definition: BesView.cxx:800

◆ GetPart()

virtual Int_t Tof2DScin::GetPart ( )
inlinevirtual

Definition at line 49 of file Tof2DScin.h.

49{ return fPart; }

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

◆ GetTime()

virtual Double_t Tof2DScin::GetTime ( )
inlinevirtual

Definition at line 41 of file Tof2DScin.h.

41{ return fTime; }

◆ HasZRSection()

bool Tof2DScin::HasZRSection ( )
virtual

Definition at line 326 of file Tof2DScin.cxx.

327{
328 bool flag = false;
329 BesView *view = (BesView*)gPad->GetView();
330 Double_t viewPhi = view->GetLongitude();
331 viewPhi = Range360(viewPhi);
332 //if (GetName() == TString("Layer0Wire0")) cout << "view " << viewPhi << endl;
333
334 Double_t zrPhi = viewPhi-90.0;
335 zrPhi = Range360(zrPhi);
336 //if (GetName() == TString("Layer0Wire0")) cout << zrPhi << endl;
337
338 for (Int_t i = 0; i < 2; i++) {
339 if (i==1) {
340 zrPhi += 180.0;
341 zrPhi = Range360(zrPhi);
342 }
343
344 if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] &&
345 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
346 flag = true;
347 break;
348 }
349 else if (fPhiMin > fPhiMax) { // cross 0 degree
350 if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] ||
351 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
352 flag = true;
353 break;
354 }
355 }
356 }
357
358 return flag;
359}
Double_t GetLongitude()
Definition: BesTView.h:95

Referenced by DistancetoPrimitive(), and Paint().

◆ IsFired()

virtual bool Tof2DScin::IsFired ( )
inlinevirtual

Definition at line 33 of file Tof2DScin.h.

33{ return fFired; }

Referenced by Paint().

◆ IsHighlighted()

virtual bool Tof2DScin::IsHighlighted ( )
inlinevirtual

Definition at line 32 of file Tof2DScin.h.

32{ return fHighlighted; }

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

◆ Paint()

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

Definition at line 208 of file Tof2DScin.cxx.

208 {
209
210 TString opt = option;
211 opt.ToUpper();
212
213 BesView *view = (BesView*)gPad->GetView();
214 if (view->GetViewType() & kXYView) {
215
216 if (this->IsFired()) {
217 if (fScinXYFired) {
218 fScinXYFired->SetLineColor(lcScinFired);
219 fScinXYFired->SetLineWidth(lwScinFired);
220 fScinXYFired->SetFillColor(fcScinFired);
221 fScinXYFired->SetFillStyle(fsScinFired);
222 }
223 }
224
225 if (fScinXY) {
226 fScinXY->SetLineColor(lcScin);
227 fScinXY->SetLineWidth(lwScin);
228 fScinXY->SetFillColor(fcScin);
229 fScinXY->SetFillStyle(fsScin);
230 }
231
232 if (this->IsHighlighted()) {
233 if (fScinXY) {
234 fScinXY->SetLineColor(lcScinHL);
235 fScinXY->SetLineWidth(lwScinHL);
236 fScinXY->SetFillColor(fcScinHL);
237 fScinXY->SetFillStyle(fsScinHL);
238 }
239 if (fScinXYFired) {
240 fScinXYFired->SetLineColor(lcScinFiredHL);
241 fScinXYFired->SetLineWidth(lwScinFiredHL);
242 fScinXYFired->SetFillColor(fcScinFiredHL);
243 fScinXYFired->SetFillStyle(fsScinFiredHL);
244 }
245 }
246
247 if (fScinXY) fScinXY->Paint();
248 if (this->IsFired()) {
249 if (view->GetVisTofHitsGlobal() &&
250 ( (fPart == 0 && view->GetVisTofHitsEast()) ||
251 (fPart == 1 && view->GetVisTofHitsBarrel()) ||
252 (fPart == 2 && view->GetVisTofHitsWest()) )) {
253 if (fScinXYFired) {
254 //cout << "Tof fired Scin size " << fCharge/fChargeMax << endl;
255 fScinXYFired->Restore(); // restore default size
256 fScinXYFired->SetSize(fCharge/fChargeMax);
257 fScinXYFired->Paint();
258 }
259 }
260 }
261 }
262
263 if (view->GetViewType() & kZRView) {
264 if (HasZRSection()) {
265 if (this->IsFired()) {
266 if (fScinZRFired) {
267 fScinZRFired->SetLineColor(lcScinFired);
268 fScinZRFired->SetLineWidth(lwScinFired);
269 fScinZRFired->SetFillColor(fcScinFired);
270 fScinZRFired->SetFillStyle(fsScinFired);
271 }
272 }
273
274 if (fScinZR) {
275 fScinZR->SetLineColor(lcScin);
276 fScinZR->SetLineWidth(lwScin);
277 fScinZR->SetFillColor(fcScin);
278 fScinZR->SetFillStyle(fsScin);
279 }
280
281 if (this->IsHighlighted()) {
282 if (fScinZR) {
283 fScinZR->SetLineColor(lcScinHL);
284 fScinZR->SetLineWidth(lwScinHL);
285 fScinZR->SetFillColor(fcScinHL);
286 fScinZR->SetFillStyle(fsScinHL);
287 }
288 if (fScinZRFired) {
289 fScinZRFired->SetLineColor(lcScinFiredHL);
290 fScinZRFired->SetLineWidth(lwScinFiredHL);
291 fScinZRFired->SetFillColor(fcScinFiredHL);
292 fScinZRFired->SetFillStyle(fsScinFiredHL);
293 }
294 }
295
296 if (fScinZR) fScinZR->Paint();
297 if (this->IsFired()) {
298 if (view->GetVisTofHitsGlobal() &&
299 ( (fPart == 0 && view->GetVisTofHitsEast()) ||
300 (fPart == 1 && view->GetVisTofHitsBarrel()) ||
301 (fPart == 2 && view->GetVisTofHitsWest()) )) {
302 if (fScinZRFired) {
303 //cout << "Tof fired Scin size " << fCharge/fChargeMax << endl;
304 fScinZRFired->Restore(); // restore default size
305 fScinZRFired->SetSize(fCharge/fChargeMax);
306 fScinZRFired->Paint();
307 }
308 }
309 }
310 }
311 }
312
313}
virtual void SetSize(Double_t size)
virtual void Paint(Option_t *option="")
virtual void Restore()
Bool_t GetVisTofHitsWest()
Definition: BesView.h:172
Bool_t GetVisTofHitsGlobal()
Definition: BesView.h:169
Bool_t GetVisTofHitsBarrel()
Definition: BesView.h:171
Bool_t GetVisTofHitsEast()
Definition: BesView.h:170
virtual bool IsFired()
Definition: Tof2DScin.h:33

◆ Range360()

Double_t Tof2DScin::Range360 ( Double_t  input)

Definition at line 374 of file Tof2DScin.cxx.

375{
376 if (input >= 360.0) {
377 do {
378 input -= 360.0;
379 }
380 while (input >= 360.0);
381 }
382 else if (input < 0.0) {
383 do {
384 input += 360.0;
385 }
386 while (input < 0.0);
387 }
388
389 return input;
390}

Referenced by GetAngle(), and HasZRSection().

◆ ResetTimeCharge()

virtual void Tof2DScin::ResetTimeCharge ( )
inlinevirtual

Definition at line 43 of file Tof2DScin.h.

43{ fTime = 0.0; fCharge = 0.0; }

Referenced by TofROOTGeo::DrawHits(), and TofROOTGeo::SetHits().

◆ SetCharge()

virtual void Tof2DScin::SetCharge ( Double_t  charge)
inlinevirtual

Definition at line 40 of file Tof2DScin.h.

40{ fCharge = charge; }

Referenced by TofROOTGeo::DrawHits(), and TofROOTGeo::SetHits().

◆ SetFired()

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

Definition at line 31 of file Tof2DScin.h.

31{ fFired = status; }

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

◆ SetHighlighted()

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

Definition at line 30 of file Tof2DScin.h.

30{ fHighlighted = status; }

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

◆ SetStyle()

void Tof2DScin::SetStyle ( )
virtual

Definition at line 91 of file Tof2DScin.cxx.

92{
93 lcScin = 15;
94 lwScin = 1;
95 fcScin = 1003; // lightYellow
96 fsScin = 1001;
97
98 lcScinFired = kRed;
99 lwScinFired = 1;
100 fcScinFired = kRed;
101 fsScinFired = 1001;
102
103 lcScinHL = lcScin;
104 lwScinHL = 1;
105 fcScinHL = kBlue;
106 fsScinHL = 1001;
107
108 lcScinFiredHL = kRed;
109 lwScinFiredHL = 2;
110 fcScinFiredHL = kBlue;
111 fsScinFiredHL = 4000;
112}

Referenced by Tof2DScin().

◆ SetTime()

virtual void Tof2DScin::SetTime ( Double_t  time)
inlinevirtual

Definition at line 39 of file Tof2DScin.h.

39{ fTime = time; }
Double_t time

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