#include <BesGeoTrack.h>
Public Member Functions | |
BesGeoTrack () | |
BesGeoTrack (Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent=0, TObject *particle=0) | |
virtual | ~BesGeoTrack () |
virtual void | Init () |
virtual void | AddHit (TObject *obj) |
virtual void | AddInfo (TString info) |
virtual void | CloseInfo () |
virtual void | SetCharge (Int_t charge) |
virtual void | SetTrackType (Int_t type) |
virtual void | AddPoint (Double_t x, Double_t y, Double_t z, Double_t t) |
virtual void | SetMarker (Double_t x, Double_t y, Double_t z) |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
virtual void | Draw (Option_t *option="") |
virtual void | Paint (Option_t *option="") |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Private Attributes | |
TObjArray | fHits |
std::vector< TString > | fInfoCon |
Int_t | fCharge |
Int_t | fType |
BesPaveText * | fTip |
TPolyLine3D * | fPolyLine3D |
BesMarker2D * | fMarker |
Definition at line 12 of file BesGeoTrack.h.
BesGeoTrack::BesGeoTrack | ( | ) |
BesGeoTrack::BesGeoTrack | ( | Int_t | id, | |
Int_t | pdgcode, | |||
TVirtualGeoTrack * | parent = 0 , |
|||
TObject * | particle = 0 | |||
) |
Definition at line 29 of file BesGeoTrack.cxx.
References Init().
00030 : TGeoTrack(id, pdgcode, parent, particle) 00031 { 00032 // std::cout << "co BesGeoTrack: " << ++count << std::endl; 00033 Init(); 00034 }
BesGeoTrack::~BesGeoTrack | ( | ) | [virtual] |
Definition at line 36 of file BesGeoTrack.cxx.
References fMarker, fPolyLine3D, and fTip.
00037 { 00038 // std::cout << "de BesGeoTrack: " << --count << std::endl; 00039 if (fTip) delete fTip; 00040 if (fPolyLine3D) delete fPolyLine3D; 00041 if (fMarker) delete fMarker; 00042 }
virtual void BesGeoTrack::AddHit | ( | TObject * | obj | ) | [inline, virtual] |
Definition at line 21 of file BesGeoTrack.h.
References fHits.
Referenced by BesEvent::ConstructEmcTrackFromRec(), BesEvent::ConstructMdcTrackFromRec(), BesEvent::ConstructMucTrackFromRec(), and BesEvent::ConstructTofTrackFromRec().
00021 { fHits.Add(obj); }
virtual void BesGeoTrack::AddInfo | ( | TString | info | ) | [inline, virtual] |
Definition at line 22 of file BesGeoTrack.h.
References fInfoCon.
Referenced by BesEvent::ConstructEmcTrackFromRec(), BesEvent::ConstructMdcTrackFromRec(), BesEvent::ConstructMucTrackFromRec(), and BesEvent::ConstructTofTrackFromRec().
00022 { fInfoCon.push_back(info); }
void BesGeoTrack::AddPoint | ( | Double_t | x, | |
Double_t | y, | |||
Double_t | z, | |||
Double_t | t | |||
) | [virtual] |
Definition at line 62 of file BesGeoTrack.cxx.
Referenced by BesEvent::ConstructMdcTrackFromRec(), and BesEvent::ConstructMucTrackFromRec().
void BesGeoTrack::CloseInfo | ( | ) | [virtual] |
Definition at line 53 of file BesGeoTrack.cxx.
References fInfoCon, fTip, and BesPaveText::SetText().
Referenced by BesEvent::ConstructEmcTrackFromRec(), BesEvent::ConstructMdcTrackFromRec(), BesEvent::ConstructMucTrackFromRec(), and BesEvent::ConstructTofTrackFromRec().
00054 { 00055 if (fTip) { 00056 fTip->SetText(fInfoCon); 00057 } 00058 else 00059 cout << "BesGeoTrack::CloseInfo, not initialized" << endl; 00060 }
Int_t BesGeoTrack::DistancetoPrimitive | ( | Int_t | px, | |
Int_t | py | |||
) | [virtual] |
Definition at line 83 of file BesGeoTrack.cxx.
References abs, check_raw_filter::dist, fMarker, fType, and BesMarker2D::GetCenterPixel().
00084 { 00085 Int_t dist = 9999; 00086 Int_t cx, cy; 00087 Double_t edge = 4.0; // edge width of track 00088 Double_t markSizeRatio = 4.0; // 4.0 is approximate size. 00089 00090 if (fType == 1 || fType == 2) { // tof or emc 00091 if (!fMarker) return dist; 00092 fMarker->GetCenterPixel(cx, cy); 00093 if (fType == 1) { // tof 00094 Double_t r = sqrt( Double_t((px-cx)*(px-cx) + (py-cy)*(py-cy)) ); 00095 Double_t markerR = markSizeRatio*fMarker->GetMarkerSize(); 00096 if (markerR > 50) markerR = 50; 00097 // if the size of a marker with type of circle is too large > 50 pixel, it could not be enlarged. 00098 if ( fabs(r-markerR) < edge ) dist = 0; 00099 } 00100 else if (fType == 2) { // emc 00101 Double_t dx = abs(px-cx), dy = abs(py-cy); 00102 if ( fabs(dx) < edge && fabs(dy) < markSizeRatio*fMarker->GetMarkerSize() || 00103 fabs(dy) < edge && fabs(dx) < markSizeRatio*fMarker->GetMarkerSize() ) 00104 dist = 0; 00105 } 00106 00107 return dist; 00108 } 00109 else return TGeoTrack::DistancetoPrimitive(px, py); 00110 }
void BesGeoTrack::Draw | ( | Option_t * | option = "" |
) | [virtual] |
Definition at line 279 of file BesGeoTrack.cxx.
References fPolyLine3D, BesView::GetViewType(), genRecEmupikp::i, k3DView, t(), type, and x.
00280 { 00281 // Draw Polyline3D for OpenGL and X3d 00282 BesView *view = (BesView*)gPad->GetView(); 00283 if (view && view->GetViewType() & k3DView) { 00284 Double_t x,y,z,t; 00285 fPolyLine3D = new TPolyLine3D(GetNpoints()); 00286 for (Int_t i = 0; i < GetNpoints(); i++) { 00287 GetPoint(i,x,y,z,t); 00288 fPolyLine3D->SetPoint(i,x,y,z); 00289 } 00290 fPolyLine3D->SetBit(kCanDelete); 00291 00292 fPolyLine3D->SetLineWidth(5); 00293 fPolyLine3D->SetLineColor(kRed); 00294 fPolyLine3D->Draw(option); 00295 } 00296 00297 if (!gPad) gGeoManager->GetMasterVolume()->Draw(); 00298 char *opt1 = Compress(option); // we will have to delete this ? 00299 TString opt(opt1); 00300 Bool_t is_default = kTRUE; 00301 Bool_t is_onelevel = kFALSE; 00302 Bool_t is_all = kFALSE; 00303 Bool_t is_type = kFALSE; 00304 if (opt.Contains("/D")) { 00305 is_onelevel = kTRUE; 00306 is_default = kFALSE; 00307 } 00308 if (opt.Contains("/*")) { 00309 is_all = kTRUE; 00310 is_default = kFALSE; 00311 } 00312 if (opt.Contains("/N")) { 00313 is_type = kTRUE; 00314 Int_t ist = opt.Index("/N")+2; 00315 Int_t ilast = opt.Index("/",ist); 00316 if (ilast<0) ilast=opt.Length(); 00317 TString type = opt(ist, ilast-ist); 00318 gGeoManager->SetParticleName(type.Data()); 00319 } 00320 SetBits(is_default, is_onelevel, is_all, is_type); 00321 AppendPad("SAME"); 00322 00323 delete [] opt1; 00324 return; 00325 }
void BesGeoTrack::ExecuteEvent | ( | Int_t | event, | |
Int_t | px, | |||
Int_t | py | |||
) | [virtual] |
Definition at line 112 of file BesGeoTrack.cxx.
References fHits, fMarker, fTip, fType, gBesCursor, BesCursor::GetShowInfo(), BesCursor::GetType(), BesView::GetVisEmcHitsBarrel(), BesView::GetVisEmcHitsEast(), BesView::GetVisEmcHitsGlobal(), BesView::GetVisEmcHitsWest(), BesView::GetVisMdcHits(), BesView::GetVisMdcHitsGlobal(), BesView::GetVisMucHitsGlobal(), BesView::GetVisTofHitsBarrel(), BesView::GetVisTofHitsEast(), BesView::GetVisTofHitsGlobal(), BesView::GetVisTofHitsWest(), genRecEmupikp::i, kBesHand, kBesPick, SetLineWidth(), BesPaveText::SetPos(), and BesView::UpdateView().
00113 { 00114 BesView *view = (BesView*)gPad->GetView(); 00115 00116 if (gBesCursor->GetType() == kBesHand) { 00117 if (view) view->ExecuteEvent(event, px, py); 00118 } 00119 else if (gBesCursor->GetType() == kBesPick){ 00120 00121 if (gPad) gPad->SetCursor(kPointer); 00122 00123 Int_t width, color; 00124 Int_t normalWidth = 1, hlWidth = 2; 00125 00126 switch (event) { 00127 case kMouseEnter: 00128 if (fType == 0) { 00129 if (view->GetVisMdcHitsGlobal()) { 00130 for (Int_t i = 0; i < fHits.GetEntries(); i++) { 00131 Mdc2DWire *aHit = (Mdc2DWire*)fHits.At(i); 00132 if (aHit != 0) { 00133 if (view->GetVisMdcHits()) { 00134 aHit->SetHighlighted(true); 00135 } 00136 } 00137 } 00138 } 00139 } 00140 else if (fType == 1) { 00141 if (view->GetVisTofHitsGlobal()) { 00142 for (Int_t i = 0; i < fHits.GetEntries(); i++) { 00143 Tof2DScin *aHit = (Tof2DScin*)fHits.At(i); 00144 if (aHit != 0) { 00145 if ( aHit->GetPart() == 0 && view->GetVisTofHitsEast() || 00146 aHit->GetPart() == 1 && view->GetVisTofHitsBarrel() || 00147 aHit->GetPart() == 2 && view->GetVisTofHitsWest() ) { 00148 aHit->SetHighlighted(true); 00149 } 00150 } 00151 } 00152 } 00153 } 00154 else if (fType == 2) { 00155 if (view->GetVisEmcHitsGlobal()) { 00156 for (Int_t i = 0; i < fHits.GetEntries(); i++) { 00157 Emc2DCrystal *aHit = (Emc2DCrystal*)fHits.At(i); 00158 if (aHit != 0) { 00159 if ( aHit->GetPart() == 0 && view->GetVisEmcHitsEast() || 00160 aHit->GetPart() == 1 && view->GetVisEmcHitsBarrel() || 00161 aHit->GetPart() == 2 && view->GetVisEmcHitsWest() ) { 00162 aHit->SetHighlighted(true); 00163 } 00164 } 00165 } 00166 } 00167 } 00168 else if (fType == 3) { 00169 if (view->GetVisMucHitsGlobal()) { 00170 for (Int_t i = 0; i < fHits.GetEntries(); i++) { 00171 Muc2DStrip *aHit = (Muc2DStrip*)fHits.At(i); 00172 if (aHit != 0) { 00173 if (view->GetVisMucHitsGlobal()) { 00174 aHit->SetHighlighted(true); 00175 } 00176 } 00177 } 00178 } 00179 } 00180 00181 00182 if (fType == 0) { 00183 width = this->GetLineWidth(); 00184 color = this->GetLineColor(); 00185 this->SetLineWidth(hlWidth); 00186 this->SetLineColor(kRed); 00187 } 00188 else if (fType == 1) { 00189 fMarker->SetMarkerColor(kMagenta); 00190 } 00191 else if (fType == 2) { 00192 fMarker->SetMarkerColor(kMagenta); 00193 } 00194 else if (fType == 3) { 00195 width = this->GetLineWidth(); 00196 color = this->GetLineColor(); 00197 this->SetLineWidth(hlWidth); 00198 this->SetLineColor(kRed); 00199 } 00200 else if (fType == 4) { 00201 this->SetLineWidth(hlWidth); 00202 this->SetLineColor(kBlue); 00203 } 00204 00205 fTip->SetPos(px, py); 00206 view->UpdateView(0); 00207 00208 //yzhang 2011-11-15 TEMP 00209 //drawHeader(fTip->GetText); 00210 if (gBesCursor->GetShowInfo()) fTip->Draw("TL,SAME"); // "BR,ARC,SAME" 00211 gPad->Modified(); 00212 gPad->Update(); 00213 break; 00214 00215 case kMouseLeave: 00216 if (fType == 0) { 00217 for (Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++) { 00218 Mdc2DWire *aHit = (Mdc2DWire*)fHits.At(i); 00219 if (aHit != 0 && aHit->IsHighlighted()) { 00220 aHit->SetHighlighted(false); 00221 } 00222 } 00223 } 00224 else if (fType == 1) { 00225 for (Int_t i = 0; i < fHits.GetEntries(); i++) { 00226 Tof2DScin *aHit = (Tof2DScin*)fHits.At(i); 00227 if (aHit != 0 && aHit->IsHighlighted()) { 00228 aHit->SetHighlighted(false); 00229 } 00230 } 00231 } 00232 else if (fType == 2) { 00233 for (Int_t i = 0; i < fHits.GetEntries(); i++) { 00234 Emc2DCrystal *aHit = (Emc2DCrystal*)fHits.At(i); 00235 if (aHit != 0 && aHit->IsHighlighted()) { 00236 aHit->SetHighlighted(false); 00237 } 00238 } 00239 } 00240 else if (fType == 3) { 00241 for (Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++) { 00242 Muc2DStrip *aHit = (Muc2DStrip*)fHits.At(i); 00243 if (aHit != 0 && aHit->IsHighlighted()) { 00244 aHit->SetHighlighted(false); 00245 } 00246 } 00247 } 00248 00249 00250 if (fType == 0) { 00251 this->SetLineWidth(normalWidth); 00252 this->SetLineColor(kBlack); 00253 } 00254 else if (fType == 1) { 00255 fMarker->SetMarkerColor(kBlack); 00256 } 00257 else if (fType == 2) { 00258 fMarker->SetMarkerColor(kBlack); 00259 } 00260 else if (fType == 3) { 00261 this->SetLineWidth(normalWidth); 00262 this->SetLineColor(kBlack); 00263 } 00264 else if (fType == 4) { 00265 this->SetLineWidth(normalWidth); 00266 this->SetLineColor(kBlack); 00267 } 00268 00269 view->UpdateView(0); 00270 gPad->Modified(); 00271 gPad->Update(); 00272 break; 00273 } 00274 00275 TGeoTrack::ExecuteEvent(event, px, py); 00276 } 00277 }
char * BesGeoTrack::GetObjectInfo | ( | Int_t | px, | |
Int_t | py | |||
) | const [virtual] |
Definition at line 365 of file BesGeoTrack.cxx.
References BesView::GetObjectInfo().
00365 { 00366 00367 BesView *view = (BesView*)gPad->GetView(); 00368 if (view) return view->GetObjectInfo(px, py); 00369 else return TObject::GetObjectInfo(px, py); 00370 }
void BesGeoTrack::Init | ( | ) | [virtual] |
Definition at line 44 of file BesGeoTrack.cxx.
Referenced by BesGeoTrack().
00045 { 00046 fTip = new BesPaveText(0, 0, 0.1, 0.1, "TL"); 00047 00048 fMarker = 0; 00049 00050 //fHits.Clear("C"); 00051 }
void BesGeoTrack::Paint | ( | Option_t * | option = "" |
) | [virtual] |
Definition at line 327 of file BesGeoTrack.cxx.
References cos(), fMarker, BesTView::GetLongitude(), genRecEmupikp::i, BesMarker2D::Paint(), sin(), t(), vec, and x.
00328 { 00329 BesView *view = (BesView*)gPad->GetView(); 00330 Double_t viewPhi = view->GetLongitude(); 00331 TVector3 viewVec(cos(viewPhi*TMath::DegToRad()), sin(viewPhi*TMath::DegToRad()), 0); 00332 Double_t x, y, z, t; 00333 Double_t x1=0.0, y1=0.0, z1=0.0; 00334 Double_t dot, dotMin = 1e+20, dotTolerance = 0.01; 00335 for (Int_t i = 1; i < GetNpoints(); i++) { 00336 GetPoint(i, x, y, z, t); 00337 TVector3 vec(x,y,0); 00338 if (vec.Mag() > 5.0) { 00339 vec.SetMag(1.0); 00340 dot = fabs(vec.Dot(viewVec)); 00341 if ( dot < dotTolerance && dot < dotMin ) { 00342 x1 = x; 00343 y1 = y; 00344 z1 = z; 00345 dotMin = dot; 00346 } 00347 } 00348 } 00349 00350 if (dotMin < 1e+20) { 00351 BesMarker2D sectionPhi("trackPhi", "trackPhi", x1, y1, z1); 00352 sectionPhi.SetMarkerStyle(28); 00353 sectionPhi.SetMarkerColor(1); 00354 sectionPhi.SetMarkerSize(2); 00355 sectionPhi.Paint(); 00356 //sectionPhi paint the marker in origin point of MdcTrack!!! 00357 } 00358 00359 if (fMarker) fMarker->Paint(option); 00360 TGeoTrack::Paint(option); 00361 }
void BesGeoTrack::SetCharge | ( | Int_t | charge | ) | [virtual] |
Definition at line 372 of file BesGeoTrack.cxx.
References fCharge.
Referenced by BesEvent::ConstructMdcTrackFromRec(), and BesEvent::ConstructMucTrackFromRec().
00373 { 00374 fCharge = charge; 00375 if (fCharge > 0) this->SetLineColor(kBlack); // + 00376 else if (fCharge < 0) this->SetLineColor(kBlack); // - 00377 else this->SetLineColor(kGreen); // 0 00378 }
void BesGeoTrack::SetMarker | ( | Double_t | x, | |
Double_t | y, | |||
Double_t | z | |||
) | [virtual] |
Definition at line 67 of file BesGeoTrack.cxx.
References fMarker, fType, and BesMarker2D::SetMarkerSizeMultiple().
Referenced by BesEvent::ConstructEmcTrackFromRec(), and BesEvent::ConstructTofTrackFromRec().
00068 { 00069 fMarker = new BesMarker2D("RecMarker", "RecMarker", x, y, z); 00070 00071 if (fType == 1) { // tof 00072 fMarker->SetMarkerSizeMultiple(20); 00073 fMarker->SetMarkerStyle(5); 00074 fMarker->SetMarkerColor(kBlack); 00075 } 00076 else if (fType == 2) { // emc 00077 fMarker->SetMarkerSizeMultiple(20); 00078 fMarker->SetMarkerStyle(2); 00079 fMarker->SetMarkerColor(kBlack); 00080 } 00081 }
virtual void BesGeoTrack::SetTrackType | ( | Int_t | type | ) | [inline, virtual] |
Definition at line 25 of file BesGeoTrack.h.
References fType.
Referenced by BesEvent::SetEmcShowers(), BesEvent::SetMdcTracks(), BesEvent::SetMucTracks(), and BesEvent::SetTofTracks().
Int_t BesGeoTrack::fCharge [private] |
TObjArray BesGeoTrack::fHits [private] |
std::vector<TString> BesGeoTrack::fInfoCon [private] |
BesMarker2D* BesGeoTrack::fMarker [private] |
Definition at line 46 of file BesGeoTrack.h.
Referenced by DistancetoPrimitive(), ExecuteEvent(), Init(), Paint(), SetMarker(), and ~BesGeoTrack().
TPolyLine3D* BesGeoTrack::fPolyLine3D [private] |
BesPaveText* BesGeoTrack::fTip [private] |
Definition at line 44 of file BesGeoTrack.h.
Referenced by CloseInfo(), ExecuteEvent(), Init(), and ~BesGeoTrack().
Int_t BesGeoTrack::fType [private] |
Definition at line 42 of file BesGeoTrack.h.
Referenced by DistancetoPrimitive(), ExecuteEvent(), SetMarker(), and SetTrackType().