#include <Tof2DScin.h>
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) |
Private Attributes | |
Int_t | fPart |
BesPolygon2D * | fScinXY |
BesPolygon2D * | fScinZR |
BesPolygon2D * | fScinXYFired |
BesPolygon2D * | fScinZRFired |
Double_t | fTime |
Double_t | fCharge |
Double_t | fZRSectionTolerance [3] |
Double_t | fPhiMin |
Double_t | fPhiMax |
std::vector< TString > | fInfoCon |
BesPaveText * | fTip |
bool | fHighlighted |
bool | fFired |
Int_t | lcScin |
Int_t | lwScin |
Int_t | fcScin |
Int_t | fsScin |
Int_t | lcScinFired |
Int_t | lwScinFired |
Int_t | fcScinFired |
Int_t | fsScinFired |
Int_t | lcScinHL |
Int_t | lwScinHL |
Int_t | fcScinHL |
Int_t | fsScinHL |
Int_t | lcScinFiredHL |
Int_t | lwScinFiredHL |
Int_t | fcScinFiredHL |
Int_t | fsScinFiredHL |
Static Private Attributes | |
static const Int_t | fChargeMax = 50 |
Definition at line 18 of file Tof2DScin.h.
Tof2DScin::Tof2DScin | ( | ) |
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.
References CloseInfo(), fCharge, fFired, fHighlighted, fPart, fPhiMax, fPhiMin, fScinXY, fScinXYFired, fScinZR, fScinZRFired, fTime, fTip, fZRSectionTolerance, GetAngle(), GetPart(), genRecEmupikp::i, ganga-rec::j, and SetStyle().
00026 { 00027 SetName(name); 00028 SetTitle(title); 00029 fTip = 0; 00030 fHighlighted = false; 00031 fFired = false; 00032 fPart = part; 00033 00034 fTime = 0.0; 00035 fCharge = 0.0; 00036 00037 fZRSectionTolerance[1] = 0.071; // half of gap between two scin 00038 fZRSectionTolerance[2] = fZRSectionTolerance[0] = 0.1647; 00039 00040 // ------XY------ 00041 00042 Double_t Pxy[3*4]; // N=8 00043 for (Int_t i = 0; i < 3*4; i++) { 00044 Pxy[i] = (P[i] + P[i+3*4])/2.0; 00045 //if (GetName() == TString("EastEcScin0")) cout << Pxy[i] << endl; 00046 } 00047 00048 fScinXY = new BesPolygon2D(name, title, 4, &Pxy[0]); 00049 fScinXYFired = new BesPolygon2D(name, title, 4, &Pxy[0]); 00050 00051 // ------ZR------ 00052 00053 Double_t Pzr[3*4]; 00054 Int_t iSeq[8] = {0,3,1,2,5,6,4,7}; // center of 0+3, 1+2, 5+6, 4+7 00055 for (Int_t i = 0; i < 4; i++) { 00056 for (Int_t j = 0; j < 3; j++) { 00057 Pzr[3*i+j] = (P[3*iSeq[2*i]+j] + P[3*iSeq[2*i+1]+j])/2.0; 00058 } 00059 //if (GetName() == TString("EastEcScin0")) cout << Pxy[i] << endl; 00060 } 00061 00062 00063 fScinZR = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]); 00064 fScinZRFired = new BesPolygon2D(TString(name)+TString("zr"), title, 4, &Pzr[0]); 00065 00066 fPhiMin = GetAngle( P[3*3], P[3*3+1] ); 00067 fPhiMax = GetAngle( P[3*0], P[3*0+1] ); 00068 if (GetPart() == 2) { 00069 Double_t phiTemp = fPhiMin; 00070 fPhiMin = fPhiMax; 00071 fPhiMax = phiTemp; 00072 } 00073 //cout << GetName() << " min "<< fPhiMin << " max " << fPhiMax << endl; 00074 00075 SetStyle(); 00076 00077 fTip = new BesPaveText(0, 0, 0.1, 0.1); 00078 CloseInfo(); 00079 }
Tof2DScin::~Tof2DScin | ( | ) |
Definition at line 83 of file Tof2DScin.cxx.
References fScinXY, fScinXYFired, fScinZR, and fScinZRFired.
00083 { 00084 00085 if (fScinXY) delete fScinXY; 00086 if (fScinZR) delete fScinZR; 00087 if (fScinXYFired) delete fScinXYFired; 00088 if (fScinZRFired) delete fScinZRFired; 00089 }
virtual void Tof2DScin::AddInfo | ( | TString | info | ) | [inline, virtual] |
Definition at line 35 of file Tof2DScin.h.
References fInfoCon.
Referenced by TofROOTGeo::SetHits().
00035 { fInfoCon.push_back(info); }
void Tof2DScin::ClearInfo | ( | ) | [virtual] |
Definition at line 115 of file Tof2DScin.cxx.
References fInfoCon, and fTip.
Referenced by TofROOTGeo::SetHits().
void Tof2DScin::CloseInfo | ( | ) | [virtual] |
Definition at line 121 of file Tof2DScin.cxx.
References fInfoCon, fTip, and BesPaveText::SetText().
Referenced by TofROOTGeo::SetHits(), and Tof2DScin().
00122 { 00123 if (fTip) { 00124 fTip->Clear(); 00125 00126 if (fInfoCon.size() == 0) fInfoCon.push_back(GetTitle()); 00127 fTip->SetText(fInfoCon); 00128 } 00129 else 00130 cout << "Tof2DScin::CloseInfo, not initialized" << endl; 00131 }
Int_t Tof2DScin::DistancetoPrimitive | ( | Int_t | px, | |
Int_t | py | |||
) | [virtual] |
Definition at line 135 of file Tof2DScin.cxx.
References BesPolygon2D::DistancetoPrimitive(), fScinXY, fScinZR, BesView::GetViewType(), HasZRSection(), kXYView, and kZRView.
00135 { 00136 00137 BesView *view = (BesView*)gPad->GetView(); 00138 if (view->GetViewType() & kXYView && fScinXY) { 00139 return fScinXY->DistancetoPrimitive(px, py); 00140 } 00141 else if (view->GetViewType() & kZRView && fScinZR) { 00142 if (HasZRSection()) 00143 return fScinZR->DistancetoPrimitive(px, py); 00144 } 00145 00146 return 9999; 00147 }
void Tof2DScin::Draw | ( | Option_t * | option = "" |
) | [virtual] |
Definition at line 197 of file Tof2DScin.cxx.
Referenced by TofROOTGeo::Draw(), and ExecuteEvent().
00197 { 00198 // 00199 // Tof2DScin draw function 00200 TString opt = option; 00201 opt.ToUpper(); 00202 00203 AppendPad(option); 00204 }
void Tof2DScin::ExecuteEvent | ( | Int_t | event, | |
Int_t | px, | |||
Int_t | py | |||
) | [virtual] |
Definition at line 151 of file Tof2DScin.cxx.
References Draw(), fTip, gBesCursor, BesCursor::GetType(), kBesHand, kBesPick, SetHighlighted(), BesPaveText::SetPos(), and BesView::UpdateView().
00151 { 00152 00153 //cout << GetName() << endl; 00154 00155 BesView *view = (BesView*)gPad->GetView(); 00156 00157 if (gBesCursor->GetType() == kBesHand) { 00158 if (view) view->ExecuteEvent(event, px, py); 00159 } 00160 else if (gBesCursor->GetType() == kBesPick){ 00161 00162 if (gPad) gPad->SetCursor(kPointer); 00163 00164 switch (event) { 00165 00166 case kMouseEnter : 00167 this->SetHighlighted(true); 00168 00169 //if (this->IsFired() || view->GetVisTofHitsGlobal()) { 00170 Draw(); 00171 00172 fTip->SetPos(px, py); 00173 view->UpdateView(0); 00174 00175 fTip->Draw("BR,SAME"); // "BR,ARC,SAME" 00176 gPad->Modified(); 00177 gPad->Update(); 00178 break; 00179 00180 case kMouseLeave: 00181 if (this->IsHighlighted()) { 00182 this->SetHighlighted(false); 00183 //if (view->GetVisTofHitsGlobal()) 00184 Draw(); 00185 00186 view->UpdateView(0); 00187 gPad->Modified(); 00188 gPad->Update(); 00189 break; 00190 } 00191 } 00192 } 00193 }
Double_t Tof2DScin::GetAngle | ( | Double_t | x, | |
Double_t | y | |||
) |
Definition at line 363 of file Tof2DScin.cxx.
References Range360().
Referenced by Tof2DScin().
00364 { 00365 Double_t angle = TMath::ACos( x/TMath::Sqrt(x*x+y*y) ) * TMath::RadToDeg(); 00366 if ( y<0.0 ) angle *= -1; 00367 angle = Range360(angle); 00368 00369 return angle; 00370 }
virtual Double_t Tof2DScin::GetCharge | ( | ) | [inline, virtual] |
Definition at line 42 of file Tof2DScin.h.
References fCharge.
Referenced by TofROOTGeo::SetHits().
00042 { return fCharge; }
char * Tof2DScin::GetObjectInfo | ( | Int_t | px, | |
Int_t | py | |||
) | const [virtual] |
Definition at line 317 of file Tof2DScin.cxx.
References BesView::GetObjectInfo().
00317 { 00318 00319 BesView *view = (BesView*)gPad->GetView(); 00320 if (view) return view->GetObjectInfo(px, py); 00321 else return TObject::GetObjectInfo(px, py); 00322 }
virtual Int_t Tof2DScin::GetPart | ( | ) | [inline, virtual] |
Definition at line 49 of file Tof2DScin.h.
References fPart.
Referenced by HasZRSection(), and Tof2DScin().
00049 { return fPart; }
virtual Double_t Tof2DScin::GetTime | ( | ) | [inline, virtual] |
bool Tof2DScin::HasZRSection | ( | ) | [virtual] |
Definition at line 326 of file Tof2DScin.cxx.
References fPhiMax, fPhiMin, fZRSectionTolerance, BesTView::GetLongitude(), GetPart(), genRecEmupikp::i, and Range360().
Referenced by DistancetoPrimitive(), and Paint().
00327 { 00328 bool flag = false; 00329 BesView *view = (BesView*)gPad->GetView(); 00330 Double_t viewPhi = view->GetLongitude(); 00331 viewPhi = Range360(viewPhi); 00332 //if (GetName() == TString("Layer0Wire0")) cout << "view " << viewPhi << endl; 00333 00334 Double_t zrPhi = viewPhi-90.0; 00335 zrPhi = Range360(zrPhi); 00336 //if (GetName() == TString("Layer0Wire0")) cout << zrPhi << endl; 00337 00338 for (Int_t i = 0; i < 2; i++) { 00339 if (i==1) { 00340 zrPhi += 180.0; 00341 zrPhi = Range360(zrPhi); 00342 } 00343 00344 if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] && 00345 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) { 00346 flag = true; 00347 break; 00348 } 00349 else if (fPhiMin > fPhiMax) { // cross 0 degree 00350 if (zrPhi >= fPhiMin-fZRSectionTolerance[GetPart()] || 00351 zrPhi <= fPhiMax+fZRSectionTolerance[GetPart()]) { 00352 flag = true; 00353 break; 00354 } 00355 } 00356 } 00357 00358 return flag; 00359 }
virtual bool Tof2DScin::IsFired | ( | ) | [inline, virtual] |
virtual bool Tof2DScin::IsHighlighted | ( | ) | [inline, virtual] |
void Tof2DScin::Paint | ( | Option_t * | option = "" |
) | [virtual] |
Definition at line 208 of file Tof2DScin.cxx.
References fCharge, fChargeMax, fcScin, fcScinFired, fcScinFiredHL, fcScinHL, fPart, fScinXY, fScinXYFired, fScinZR, fScinZRFired, fsScin, fsScinFired, fsScinFiredHL, fsScinHL, BesView::GetViewType(), BesView::GetVisTofHitsBarrel(), BesView::GetVisTofHitsEast(), BesView::GetVisTofHitsGlobal(), BesView::GetVisTofHitsWest(), HasZRSection(), kXYView, kZRView, lcScin, lcScinFired, lcScinFiredHL, lcScinHL, lwScin, lwScinFired, lwScinFiredHL, lwScinHL, and BesPolygon2D::Paint().
00208 { 00209 00210 TString opt = option; 00211 opt.ToUpper(); 00212 00213 BesView *view = (BesView*)gPad->GetView(); 00214 if (view->GetViewType() & kXYView) { 00215 00216 if (this->IsFired()) { 00217 if (fScinXYFired) { 00218 fScinXYFired->SetLineColor(lcScinFired); 00219 fScinXYFired->SetLineWidth(lwScinFired); 00220 fScinXYFired->SetFillColor(fcScinFired); 00221 fScinXYFired->SetFillStyle(fsScinFired); 00222 } 00223 } 00224 00225 if (fScinXY) { 00226 fScinXY->SetLineColor(lcScin); 00227 fScinXY->SetLineWidth(lwScin); 00228 fScinXY->SetFillColor(fcScin); 00229 fScinXY->SetFillStyle(fsScin); 00230 } 00231 00232 if (this->IsHighlighted()) { 00233 if (fScinXY) { 00234 fScinXY->SetLineColor(lcScinHL); 00235 fScinXY->SetLineWidth(lwScinHL); 00236 fScinXY->SetFillColor(fcScinHL); 00237 fScinXY->SetFillStyle(fsScinHL); 00238 } 00239 if (fScinXYFired) { 00240 fScinXYFired->SetLineColor(lcScinFiredHL); 00241 fScinXYFired->SetLineWidth(lwScinFiredHL); 00242 fScinXYFired->SetFillColor(fcScinFiredHL); 00243 fScinXYFired->SetFillStyle(fsScinFiredHL); 00244 } 00245 } 00246 00247 if (fScinXY) fScinXY->Paint(); 00248 if (this->IsFired()) { 00249 if (view->GetVisTofHitsGlobal() && 00250 ( (fPart == 0 && view->GetVisTofHitsEast()) || 00251 (fPart == 1 && view->GetVisTofHitsBarrel()) || 00252 (fPart == 2 && view->GetVisTofHitsWest()) )) { 00253 if (fScinXYFired) { 00254 //cout << "Tof fired Scin size " << fCharge/fChargeMax << endl; 00255 fScinXYFired->Restore(); // restore default size 00256 fScinXYFired->SetSize(fCharge/fChargeMax); 00257 fScinXYFired->Paint(); 00258 } 00259 } 00260 } 00261 } 00262 00263 if (view->GetViewType() & kZRView) { 00264 if (HasZRSection()) { 00265 if (this->IsFired()) { 00266 if (fScinZRFired) { 00267 fScinZRFired->SetLineColor(lcScinFired); 00268 fScinZRFired->SetLineWidth(lwScinFired); 00269 fScinZRFired->SetFillColor(fcScinFired); 00270 fScinZRFired->SetFillStyle(fsScinFired); 00271 } 00272 } 00273 00274 if (fScinZR) { 00275 fScinZR->SetLineColor(lcScin); 00276 fScinZR->SetLineWidth(lwScin); 00277 fScinZR->SetFillColor(fcScin); 00278 fScinZR->SetFillStyle(fsScin); 00279 } 00280 00281 if (this->IsHighlighted()) { 00282 if (fScinZR) { 00283 fScinZR->SetLineColor(lcScinHL); 00284 fScinZR->SetLineWidth(lwScinHL); 00285 fScinZR->SetFillColor(fcScinHL); 00286 fScinZR->SetFillStyle(fsScinHL); 00287 } 00288 if (fScinZRFired) { 00289 fScinZRFired->SetLineColor(lcScinFiredHL); 00290 fScinZRFired->SetLineWidth(lwScinFiredHL); 00291 fScinZRFired->SetFillColor(fcScinFiredHL); 00292 fScinZRFired->SetFillStyle(fsScinFiredHL); 00293 } 00294 } 00295 00296 if (fScinZR) fScinZR->Paint(); 00297 if (this->IsFired()) { 00298 if (view->GetVisTofHitsGlobal() && 00299 ( (fPart == 0 && view->GetVisTofHitsEast()) || 00300 (fPart == 1 && view->GetVisTofHitsBarrel()) || 00301 (fPart == 2 && view->GetVisTofHitsWest()) )) { 00302 if (fScinZRFired) { 00303 //cout << "Tof fired Scin size " << fCharge/fChargeMax << endl; 00304 fScinZRFired->Restore(); // restore default size 00305 fScinZRFired->SetSize(fCharge/fChargeMax); 00306 fScinZRFired->Paint(); 00307 } 00308 } 00309 } 00310 } 00311 } 00312 00313 }
Double_t Tof2DScin::Range360 | ( | Double_t | input | ) |
Definition at line 374 of file Tof2DScin.cxx.
Referenced by GetAngle(), and HasZRSection().
00375 { 00376 if (input >= 360.0) { 00377 do { 00378 input -= 360.0; 00379 } 00380 while (input >= 360.0); 00381 } 00382 else if (input < 0.0) { 00383 do { 00384 input += 360.0; 00385 } 00386 while (input < 0.0); 00387 } 00388 00389 return input; 00390 }
virtual void Tof2DScin::ResetTimeCharge | ( | ) | [inline, virtual] |
Definition at line 43 of file Tof2DScin.h.
References fCharge, and fTime.
Referenced by TofROOTGeo::DrawHits().
virtual void Tof2DScin::SetCharge | ( | Double_t | charge | ) | [inline, virtual] |
Definition at line 40 of file Tof2DScin.h.
References fCharge.
Referenced by TofROOTGeo::DrawHits(), and TofROOTGeo::SetHits().
00040 { fCharge = charge; }
virtual void Tof2DScin::SetFired | ( | bool | status = true |
) | [inline, virtual] |
Definition at line 31 of file Tof2DScin.h.
References fFired.
Referenced by TofROOTGeo::Draw().
00031 { fFired = status; }
virtual void Tof2DScin::SetHighlighted | ( | bool | status = true |
) | [inline, virtual] |
Definition at line 30 of file Tof2DScin.h.
References fHighlighted.
Referenced by ExecuteEvent().
00030 { fHighlighted = status; }
void Tof2DScin::SetStyle | ( | ) | [virtual] |
Definition at line 91 of file Tof2DScin.cxx.
References fcScin, fcScinFired, fcScinFiredHL, fcScinHL, fsScin, fsScinFired, fsScinFiredHL, fsScinHL, lcScin, lcScinFired, lcScinFiredHL, lcScinHL, lwScin, lwScinFired, lwScinFiredHL, and lwScinHL.
Referenced by Tof2DScin().
00092 { 00093 lcScin = 15; 00094 lwScin = 1; 00095 fcScin = 1003; // lightYellow 00096 fsScin = 1001; 00097 00098 lcScinFired = kRed; 00099 lwScinFired = 1; 00100 fcScinFired = kRed; 00101 fsScinFired = 1001; 00102 00103 lcScinHL = lcScin; 00104 lwScinHL = 1; 00105 fcScinHL = kBlue; 00106 fsScinHL = 1001; 00107 00108 lcScinFiredHL = kRed; 00109 lwScinFiredHL = 2; 00110 fcScinFiredHL = kBlue; 00111 fsScinFiredHL = 4000; 00112 }
virtual void Tof2DScin::SetTime | ( | Double_t | time | ) | [inline, virtual] |
Double_t Tof2DScin::fCharge [private] |
Definition at line 63 of file Tof2DScin.h.
Referenced by GetCharge(), Paint(), ResetTimeCharge(), SetCharge(), and Tof2DScin().
const Int_t Tof2DScin::fChargeMax = 50 [static, private] |
Int_t Tof2DScin::fcScin [private] |
Int_t Tof2DScin::fcScinFired [private] |
Int_t Tof2DScin::fcScinFiredHL [private] |
Int_t Tof2DScin::fcScinHL [private] |
bool Tof2DScin::fFired [private] |
bool Tof2DScin::fHighlighted [private] |
Definition at line 70 of file Tof2DScin.h.
Referenced by IsHighlighted(), SetHighlighted(), and Tof2DScin().
std::vector<TString> Tof2DScin::fInfoCon [private] |
Int_t Tof2DScin::fPart [private] |
Double_t Tof2DScin::fPhiMax [private] |
Double_t Tof2DScin::fPhiMin [private] |
BesPolygon2D* Tof2DScin::fScinXY [private] |
Definition at line 57 of file Tof2DScin.h.
Referenced by DistancetoPrimitive(), Paint(), Tof2DScin(), and ~Tof2DScin().
BesPolygon2D* Tof2DScin::fScinXYFired [private] |
BesPolygon2D* Tof2DScin::fScinZR [private] |
Definition at line 58 of file Tof2DScin.h.
Referenced by DistancetoPrimitive(), Paint(), Tof2DScin(), and ~Tof2DScin().
BesPolygon2D* Tof2DScin::fScinZRFired [private] |
Int_t Tof2DScin::fsScin [private] |
Int_t Tof2DScin::fsScinFired [private] |
Int_t Tof2DScin::fsScinFiredHL [private] |
Int_t Tof2DScin::fsScinHL [private] |
Double_t Tof2DScin::fTime [private] |
Definition at line 63 of file Tof2DScin.h.
Referenced by GetTime(), ResetTimeCharge(), SetTime(), and Tof2DScin().
BesPaveText* Tof2DScin::fTip [private] |
Definition at line 69 of file Tof2DScin.h.
Referenced by ClearInfo(), CloseInfo(), ExecuteEvent(), and Tof2DScin().
Double_t Tof2DScin::fZRSectionTolerance[3] [private] |
Int_t Tof2DScin::lcScin [private] |
Int_t Tof2DScin::lcScinFired [private] |
Int_t Tof2DScin::lcScinFiredHL [private] |
Int_t Tof2DScin::lcScinHL [private] |
Int_t Tof2DScin::lwScin [private] |
Int_t Tof2DScin::lwScinFired [private] |
Int_t Tof2DScin::lwScinFiredHL [private] |
Int_t Tof2DScin::lwScinHL [private] |