BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
Muc2DStrip Class Reference

#include <Muc2DStrip.h>

+ Inheritance diagram for Muc2DStrip:

Public Member Functions

 Muc2DStrip ()
 
 Muc2DStrip (const char *name, const char *title, Int_t N, Double_t *P, Int_t part, Int_t seg, Int_t gap, Int_t strip)
 
 ~Muc2DStrip ()
 
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 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 GetSeg ()
 
virtual Int_t GetGap ()
 
virtual Int_t GetStrip ()
 
virtual bool IsZRVisible ()
 
Double_t GetAngle (Double_t x, Double_t y)
 
Double_t Range360 (Double_t input)
 

Detailed Description

Definition at line 18 of file Muc2DStrip.h.

Constructor & Destructor Documentation

◆ Muc2DStrip() [1/2]

Muc2DStrip::Muc2DStrip ( )

◆ Muc2DStrip() [2/2]

Muc2DStrip::Muc2DStrip ( const char *  name,
const char *  title,
Int_t  N,
Double_t *  P,
Int_t  part,
Int_t  seg,
Int_t  gap,
Int_t  strip 
)

Definition at line 25 of file Muc2DStrip.cxx.

26{
27 SetName(name);
29 fTip = 0;
30 fHighlighted = false;
31 fFired = false;
32 fPart = part;
33 fSeg = seg;
34 fGap = gap;
35 fStrip = strip;
36
37 // ------XY------
38
39 Double_t Pxy[3*4];
40 for (Int_t i = 0; i < 4; i++) {
41 if (part == 1) {
42 Int_t iXYSeq[8] = {1,0,4,5, 2,3,7,6}; // center of 1+2, 0+3, 4+7, 5+6
43 for (Int_t j = 0; j < 3; j++) {
44 Pxy[3*i+j] = ( P[3*iXYSeq[i]+j] + P[3*(iXYSeq[i+4])+j] )/2.0;
45 }
46 }
47 else {
48 Int_t iXYSeq[8] = {0,1,2,3, 4,5,6,7}; // center of 0+4, 1+5, 2+6, 3+7
49 for (Int_t j = 0; j < 3; j++) {
50 Pxy[3*i+j] = ( P[3*iXYSeq[i]+j] + P[3*(iXYSeq[i+4])+j] )/2.0;
51 }
52 }
53 }
54
55 fStripXY = new BesPolygon2D(name, title, 4, &Pxy[0]);
56
57 // ------ZR------
58
59 Double_t Pzr[3*6];
60 Int_t nzrPoints = 6;
61 if (part == 1) {
62 Int_t iZRSeq[6] = {4,5,1,2,6,7}; //{1,2,6,5, 0,3,7,4}; // center of 0+4, 1+5, 2+6, 3+7
63 for (Int_t i = 0; i < nzrPoints; i++) {
64 for (Int_t j = 0; j < 3; j++) {
65 Pzr[3*i+j] = P[3*iZRSeq[i]+j]; // ( P[3*iZRSeq[i]+j] + P[3*(iZRSeq[i+4])+j] )/2.0;
66 }
67 }
68 }
69 else {
70 nzrPoints = 6;
71 Int_t iZRSeq[6] = {1,2,3,7,6,5};
72 for (Int_t i = 0; i < nzrPoints; i++) {
73 for (Int_t j = 0; j < 3; j++) {
74 Pzr[3*i+j] = P[3*iZRSeq[i]+j];
75 }
76 }
77 }
78
79 fStripZR = new BesPolygon2D(name, title, nzrPoints, &Pzr[0]);
80
81 // Init
82
83 SetStyle();
84
85 fTip = new BesPaveText(0, 0, 0.1, 0.1);
86 CloseInfo();
87}
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")
virtual void SetStyle()
Definition: Muc2DStrip.cxx:97
virtual void CloseInfo()
Definition: Muc2DStrip.cxx:125

◆ ~Muc2DStrip()

Muc2DStrip::~Muc2DStrip ( )

Definition at line 91 of file Muc2DStrip.cxx.

91 {
92 //Long Peixun's update: remove "if"
93 delete fStripXY;
94 delete fStripZR;
95}

Member Function Documentation

◆ AddInfo()

virtual void Muc2DStrip::AddInfo ( TString  info)
inlinevirtual

Definition at line 35 of file Muc2DStrip.h.

35{ fInfoCon.push_back(info); }

Referenced by MucROOTGeo::SetHits().

◆ ClearInfo()

void Muc2DStrip::ClearInfo ( )
virtual

Definition at line 119 of file Muc2DStrip.cxx.

120{
121 fInfoCon.clear();
122 fTip->DeleteText();
123}

Referenced by MucROOTGeo::SetHits().

◆ CloseInfo()

void Muc2DStrip::CloseInfo ( )
virtual

Definition at line 125 of file Muc2DStrip.cxx.

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

Referenced by Muc2DStrip(), and MucROOTGeo::SetHits().

◆ DistancetoPrimitive()

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

Definition at line 139 of file Muc2DStrip.cxx.

139 {
140
141 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
142 if ( view->GetViewType() & kXYView && fStripXY &&
143 ( view->GetVisMucStrips() || (view->GetVisMucHitsGlobal() && this->IsFired()) ) ) {
144 return fStripXY->DistancetoPrimitive(px, py);
145 }
146 else if ( view->GetViewType() & kZRView && fStripZR &&
147 ( (view->GetVisMucStrips() && this->IsZRVisible()) ||
148 (view->GetVisMucHitsGlobal() && this->IsFired() && this->IsZRVisible()) ) ) {
149 return fStripZR->DistancetoPrimitive(px, py);
150 }
151
152 return 9999;
153}
@ kXYView
Definition: BesStatus.h:15
@ kZRView
Definition: BesStatus.h:16
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Bool_t GetVisMucHitsGlobal()
Definition: BesView.h:224
EBESViewType GetViewType()
Definition: BesView.h:71
Bool_t GetVisMucStrips()
Definition: BesView.h:151
virtual bool IsZRVisible()
Definition: Muc2DStrip.cxx:333
virtual bool IsFired()
Definition: Muc2DStrip.h:33

◆ Draw()

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

Definition at line 205 of file Muc2DStrip.cxx.

205 {
206 //
207 // Muc2DStrip draw function
208 TString opt = option;
209 opt.ToUpper();
210
211 AppendPad(option);
212}

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

◆ ExecuteEvent()

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

Definition at line 157 of file Muc2DStrip.cxx.

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

◆ GetAngle()

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

Definition at line 363 of file Muc2DStrip.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: Muc2DStrip.cxx:374
double y[1000]

◆ GetGap()

virtual Int_t Muc2DStrip::GetGap ( )
inlinevirtual

Definition at line 45 of file Muc2DStrip.h.

45{ return fGap; }

◆ GetObjectInfo()

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

Definition at line 324 of file Muc2DStrip.cxx.

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

◆ GetPart()

virtual Int_t Muc2DStrip::GetPart ( )
inlinevirtual

Definition at line 43 of file Muc2DStrip.h.

43{ return fPart; }

Referenced by MucROOTGeo::DrawHits().

◆ GetSeg()

virtual Int_t Muc2DStrip::GetSeg ( )
inlinevirtual

Definition at line 44 of file Muc2DStrip.h.

44{ return fSeg; }

◆ GetStrip()

virtual Int_t Muc2DStrip::GetStrip ( )
inlinevirtual

Definition at line 46 of file Muc2DStrip.h.

46{ return fStrip; }

◆ IsFired()

virtual bool Muc2DStrip::IsFired ( )
inlinevirtual

Definition at line 33 of file Muc2DStrip.h.

33{ return fFired; }

Referenced by DistancetoPrimitive(), and Paint().

◆ IsHighlighted()

virtual bool Muc2DStrip::IsHighlighted ( )
inlinevirtual

Definition at line 32 of file Muc2DStrip.h.

32{ return fHighlighted; }

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

◆ IsZRVisible()

Bool_t Muc2DStrip::IsZRVisible ( )
virtual

Definition at line 333 of file Muc2DStrip.cxx.

334{
335 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
336 Double_t viewPhi = view->GetLongitude();
337 viewPhi = Range360(viewPhi);
338
339 if (fPart != 1) {
340 if ( (Int_t)viewPhi % 90 == 0 ) return true;
341 else return false;
342 }
343 else {
344 Int_t viewSeg = Int_t(viewPhi/45.0+0.5);
345 //cout << "viewSeg " << viewSeg << endl;
346 Int_t upSeg = viewSeg-2;
347 Int_t downSeg = viewSeg+2;
348 if (upSeg < 0) upSeg += 8;
349 else if (upSeg >= 8) upSeg -= 8;
350 if (downSeg < 0) downSeg += 8;
351 else if (downSeg >= 8) downSeg -= 8;
352 //if (fStrip == 0) cout << GetName() << " upSeg " << upSeg << " downSeg " << downSeg << endl;
353
354 if ( (Int_t)viewPhi % 45 == 0 && (fSeg == upSeg || fSeg == downSeg) ) return true;
355 else return false;
356 }
357
358 return false;
359}
Double_t GetLongitude()
Definition: BesTView.h:95

Referenced by DistancetoPrimitive(), and Paint().

◆ Paint()

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

Definition at line 216 of file Muc2DStrip.cxx.

216 {
217
218 TString opt = option;
219 opt.ToUpper();
220
221 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
222 Double_t min[3], max[3];
223 view->GetRange(&min[0], &max[0]);
224 Double_t maxRange = 0.0;
225 Double_t range[3];
226 for (Int_t i = 0; i < 3; i++) {
227 range[i] = fabs(max[i] - min[i]);
228 if (range[i] > maxRange) maxRange = range[i];
229 }
230
231 if (view->GetViewType() & kXYView) {
232
233 if (fStripXY) {
234 fStripXY->SetLineColor(lcStrip);
235 fStripXY->SetLineWidth(lwStrip);
236 fStripXY->SetLineStyle(lsStrip);
237 fStripXY->SetFillColor(fcStrip);
238 fStripXY->SetFillStyle(fsStrip);
239 }
240
241 if (this->IsFired()) {
242 if (fStripXY) {
243 fStripXY->SetLineColor(lcStripFired);
244 if (maxRange > m_kDrawLineRange && fPart == 1)
245 fStripXY->SetLineColor(fcStripFired); // too small makes it hard to see
246 fStripXY->SetLineWidth(lwStripFired);
247 fStripXY->SetLineStyle(lsStripFired);
248 fStripXY->SetFillColor(fcStripFired);
249 fStripXY->SetFillStyle(fsStripFired);
250 }
251 }
252
253 if (this->IsHighlighted()) {
254 if (fStripXY) {
255 fStripXY->SetLineColor(lcStripHL);
256 if (maxRange > m_kDrawLineRange && fPart == 1)
257 fStripXY->SetLineColor(fcStripHL); // too small makes it hard to see
258 fStripXY->SetLineWidth(lwStripHL);
259 fStripXY->SetLineStyle(lsStripHL);
260 fStripXY->SetFillColor(fcStripHL);
261 fStripXY->SetFillStyle(fsStripHL);
262 }
263 }
264
265 if ( fStripXY && view->GetVisMucStrips() ) fStripXY->Paint();
266 if (this->IsFired()) {
267 if (view->GetVisMucHitsGlobal() &&
268 ( (fPart == 0 && view->GetVisMucHitsEast()) ||
269 (fPart == 1 && view->GetVisMucHitsBarrel()) ||
270 (fPart == 2 && view->GetVisMucHitsWest()) )) {
271 fStripXY->Paint();
272 }
273 }
274 }
275
276 if (view->GetViewType() & kZRView) {
277
278 if (fStripZR) {
279 fStripZR->SetLineColor(lcStrip);
280 fStripZR->SetLineWidth(lwStrip);
281 fStripZR->SetLineStyle(lsStrip);
282 fStripZR->SetFillColor(fcStrip);
283 fStripZR->SetFillStyle(fsStrip);
284 }
285
286 if (this->IsFired()) {
287 if (fStripZR) {
288 fStripZR->SetLineColor(lcStripFired);
289 if (maxRange > m_kDrawLineRange)
290 fStripZR->SetLineColor(fcStripFired); // too small makes it hard to see
291 fStripZR->SetLineWidth(lwStripFired);
292 fStripZR->SetLineStyle(lsStripFired);
293 fStripZR->SetFillColor(fcStripFired);
294 fStripZR->SetFillStyle(fsStripFired);
295 }
296 }
297
298 if (this->IsHighlighted()) {
299 if (fStripZR) {
300 fStripZR->SetLineColor(lcStripHL);
301 if (maxRange > m_kDrawLineRange)
302 fStripZR->SetLineColor(fcStripHL); // too small makes it hard to see
303 fStripZR->SetLineWidth(lwStripHL);
304 fStripZR->SetLineStyle(lsStripHL);
305 fStripZR->SetFillColor(fcStripHL);
306 fStripZR->SetFillStyle(fsStripHL);
307 }
308 }
309
310 if ( fStripZR && view->GetVisMucStrips() && IsZRVisible() ) fStripZR->Paint();
311 if (this->IsFired() && IsZRVisible() ) {
312 if (view->GetVisMucHitsGlobal() &&
313 ( (fPart == 0 && view->GetVisMucHitsEast()) ||
314 (fPart == 1 && view->GetVisMucHitsBarrel()) ||
315 (fPart == 2 && view->GetVisMucHitsWest()) )) {
316 fStripZR->Paint();
317 }
318 }
319 }
320}
virtual void Paint(Option_t *option="")
virtual void GetRange(Float_t *min, Float_t *max)
Definition: BesTView.cxx:1138
Bool_t GetVisMucHitsWest()
Definition: BesView.h:227
Bool_t GetVisMucHitsEast()
Definition: BesView.h:225
Bool_t GetVisMucHitsBarrel()
Definition: BesView.h:226

◆ Range360()

Double_t Muc2DStrip::Range360 ( Double_t  input)

Definition at line 374 of file Muc2DStrip.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 IsZRVisible().

◆ SetFired()

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

Definition at line 31 of file Muc2DStrip.h.

31{ fFired = status; }

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

◆ SetHighlighted()

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

Definition at line 30 of file Muc2DStrip.h.

30{ fHighlighted = status; }

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

◆ SetStyle()

void Muc2DStrip::SetStyle ( )
virtual

Definition at line 97 of file Muc2DStrip.cxx.

98{
99 lcStrip = 15;
100 lwStrip = 1;
101 lsStrip = 1;
102 fcStrip = 1007; // lightBrown // 1005; // lightBlue
103 fsStrip = 1001;
104
105 lcStripFired = 15; //kRed; //15
106 lwStripFired = 1;
107 lsStripFired = 1;
108 fcStripFired = kRed;
109 fsStripFired = 1001;
110
111 lcStripHL = lcStrip;
112 lwStripHL = 1;
113 lsStripHL = 1;
114 fcStripHL = kBlue;
115 fsStripHL = 1001;
116
117}

Referenced by Muc2DStrip().


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