BOSS 7.1.2
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)
 
void SetTimeChannel (UInt_t tc)
 
void SetChargeChannel (UInt_t cc)
 
UInt_t GetTimeChannel () const
 
UInt_t GetChargeChannel () const
 

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);
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 //Huang Shuhui's update: Fix ZR view of Mrpc
69 if (fPhiMin > fPhiMax && fPhiMin - fPhiMax < 180.0)
70 { // not cross 0 degree
71 Double_t phiTemp = fPhiMin;
72 fPhiMin = fPhiMax;
73 fPhiMax = phiTemp;
74 }
75 //Long Peixun's update: Consider crossing 0 degree
76 if (fPhiMax > fPhiMin && fPhiMax - fPhiMin > 180.0)
77 {
78 Double_t phiTemp = fPhiMin;
79 fPhiMin = fPhiMax;
80 fPhiMax = phiTemp;
81 }
82 //cout << GetName() << " min "<< fPhiMin << " max " << fPhiMax << endl;
83
84 SetStyle();
85
86 fTip = new BesPaveText(0, 0, 0.1, 0.1);
87 CloseInfo();
88}
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]
Double_t GetAngle(Double_t x, Double_t y)
virtual void CloseInfo()
virtual void SetStyle()

◆ ~Tof2DScin()

Tof2DScin::~Tof2DScin ( )

Definition at line 92 of file Tof2DScin.cxx.

92 {
93 //Long Peixun's update: remove "if"
94 delete fScinXY;
95 delete fScinZR;
96 delete fScinXYFired;
97 delete fScinZRFired;
98}

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 124 of file Tof2DScin.cxx.

125{
126 fInfoCon.clear();
127 fTip->DeleteText();
128}

Referenced by TofROOTGeo::SetHits().

◆ CloseInfo()

void Tof2DScin::CloseInfo ( )
virtual

Definition at line 130 of file Tof2DScin.cxx.

131{
132 if (fTip) {
133 fTip->Clear();
134
135 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle());
136 fTip->SetText(fInfoCon);
137 }
138 else
139 cout << "Tof2DScin::CloseInfo, not initialized" << endl;
140}
virtual void SetText(std::vector< TString > infoCon)

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

◆ DistancetoPrimitive()

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

Definition at line 144 of file Tof2DScin.cxx.

144 {
145
146 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
147 if (view->GetViewType() & kXYView && fScinXY) {
148 return fScinXY->DistancetoPrimitive(px, py);
149 }
150 else if (view->GetViewType() & kZRView && fScinZR) {
151 if (HasZRSection())
152 return fScinZR->DistancetoPrimitive(px, py);
153 }
154
155 return 9999;
156}
@ kXYView
Definition BesStatus.h:18
@ kZRView
Definition BesStatus.h:19
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
EBESViewType GetViewType()
Definition BesView.h:71
virtual bool HasZRSection()

◆ Draw()

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

Definition at line 207 of file Tof2DScin.cxx.

207 {
208 //
209 // Tof2DScin draw function
210 TString opt = option;
211 opt.ToUpper();
212
213 AppendPad(option);
214}

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

◆ ExecuteEvent()

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

Definition at line 160 of file Tof2DScin.cxx.

160 {
161
162 //cout << GetName() << endl;
163
164 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
165
166 if (gBesCursor->GetType() == kBesHand) {
167 if (view) view->ExecuteEvent(event, px, py);
168 }
169 else if (gBesCursor->GetType() == kBesPick){
170
171 if (gPad) gPad->SetCursor(kPointer);
172
173 switch (event) {
174
175 case kMouseEnter :
176 this->SetHighlighted(true);
177
178 //if (this->IsFired() || view->GetVisTofHitsGlobal()) {
179 Draw();
180
181 fTip->SetPos(px, py);
182 view->UpdateView(0);
183
184 //Long Peixun's update: If ShowInfo is not checked, don't show tip text.
185 if (gBesCursor->GetShowInfo()) fTip->Draw("BR,SAME"); // "BR,ARC,SAME"
186 gPad->Modified();
187 gPad->Update();
188 break;
189
190 case kMouseLeave:
191 if (this->IsHighlighted()) {
192 this->SetHighlighted(false);
193 //if (view->GetVisTofHitsGlobal())
194 Draw();
195
196 view->UpdateView(0);
197 gPad->Modified();
198 gPad->Update();
199 break;
200 }
201 }
202 }
203}
@ 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)
Definition Tof2DScin.h:30
virtual bool IsHighlighted()
Definition Tof2DScin.h:32

◆ GetAngle()

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

Definition at line 373 of file Tof2DScin.cxx.

374{
375 Double_t angle = TMath::ACos( x/TMath::Sqrt(x*x+y*y) ) * TMath::RadToDeg();
376 if ( y<0.0 ) angle *= -1;
377 angle = Range360(angle);
378
379 return angle;
380}
Double_t Range360(Double_t input)
double y[1000]

Referenced by Tof2DScin().

◆ GetCharge()

virtual Double_t Tof2DScin::GetCharge ( )
inlinevirtual

Definition at line 42 of file Tof2DScin.h.

42{ return fCharge; }

Referenced by TofROOTGeo::SetHits().

◆ GetChargeChannel()

UInt_t Tof2DScin::GetChargeChannel ( ) const
inline

Definition at line 58 of file Tof2DScin.h.

58{ return chargeChannel; }

Referenced by TofROOTGeo::DrawHits().

◆ GetObjectInfo()

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

Definition at line 327 of file Tof2DScin.cxx.

327 {
328
329 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
330 if (view) return view->GetObjectInfo(px, py);
331 else return TObject::GetObjectInfo(px, py);
332}
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Definition BesView.cxx:869

◆ GetPart()

virtual Int_t Tof2DScin::GetPart ( )
inlinevirtual

Definition at line 49 of file Tof2DScin.h.

49{ return fPart; }

Referenced by TofROOTGeo::DrawHits(), BesGeoTrack::ExecuteEvent(), and HasZRSection().

◆ GetTime()

virtual Double_t Tof2DScin::GetTime ( )
inlinevirtual

Definition at line 41 of file Tof2DScin.h.

41{ return fTime; }

◆ GetTimeChannel()

UInt_t Tof2DScin::GetTimeChannel ( ) const
inline

Definition at line 57 of file Tof2DScin.h.

57{ return timeChannel; }

Referenced by TofROOTGeo::DrawHits().

◆ HasZRSection()

bool Tof2DScin::HasZRSection ( )
virtual

Definition at line 336 of file Tof2DScin.cxx.

337{
338 bool flag = false;
339 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
340 Double_t viewPhi = view->GetLongitude();
341 viewPhi = Range360(viewPhi);
342 //if (GetName() == TString("Layer0Wire0")) cout << "view " << viewPhi << endl;
343
344 Double_t zrPhi = viewPhi-90.0;
345 zrPhi = Range360(zrPhi);
346 //if (GetName() == TString("Layer0Wire0")) cout << zrPhi << endl;
347
348 for (Int_t i = 0; i < 2; i++) {
349 if (i==1) {
350 zrPhi += 180.0;
351 zrPhi = Range360(zrPhi);
352 }
353
354 if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] &&
355 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
356 flag = true;
357 break;
358 }
359 else if (fPhiMin > fPhiMax) { // cross 0 degree
360 if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] ||
361 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) {
362 flag = true;
363 break;
364 }
365 }
366 }
367
368 return flag;
369}
Double_t GetLongitude()
Definition BesTView.h:95
virtual Int_t GetPart()
Definition Tof2DScin.h:49

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 218 of file Tof2DScin.cxx.

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

◆ Range360()

Double_t Tof2DScin::Range360 ( Double_t input)

Definition at line 384 of file Tof2DScin.cxx.

385{
386 if (input >= 360.0) {
387 do {
388 input -= 360.0;
389 }
390 while (input >= 360.0);
391 }
392 else if (input < 0.0) {
393 do {
394 input += 360.0;
395 }
396 while (input < 0.0);
397 }
398
399 return input;
400}

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::SetHits().

◆ SetCharge()

virtual void Tof2DScin::SetCharge ( Double_t charge)
inlinevirtual

Definition at line 40 of file Tof2DScin.h.

40{ fCharge = charge; }
float charge

Referenced by TofROOTGeo::SetHits().

◆ SetChargeChannel()

void Tof2DScin::SetChargeChannel ( UInt_t cc)
inline

Definition at line 56 of file Tof2DScin.h.

56{ chargeChannel = cc; }

Referenced by 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 100 of file Tof2DScin.cxx.

101{
102 lcScin = 15;
103 lwScin = 1;
104 fcScin = 9003; // lightYellow
105 fsScin = 1001;
106
107 lcScinFired = kRed;
108 lwScinFired = 1;
109 fcScinFired = kRed;
110 fsScinFired = 1001;
111
112 lcScinHL = lcScin;
113 lwScinHL = 1;
114 fcScinHL = kBlue;
115 fsScinHL = 1001;
116
117 lcScinFiredHL = kRed;
118 lwScinFiredHL = 2;
119 fcScinFiredHL = kBlue;
120 fsScinFiredHL = 4000;
121}

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

◆ SetTimeChannel()

void Tof2DScin::SetTimeChannel ( UInt_t tc)
inline

Definition at line 55 of file Tof2DScin.h.

55{ timeChannel = tc; }

Referenced by TofROOTGeo::SetHits().


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