3#include <TGeoManager.h>
30 : TGeoTrack(id, pdgcode, parent, particle)
39 if (fTip)
delete fTip;
40 if (fPolyLine3D)
delete fPolyLine3D;
41 if (fMarker)
delete fMarker;
59 cout <<
"BesGeoTrack::CloseInfo, not initialized" << endl;
64 TGeoTrack::AddPoint(
x,y,z,
t);
69 fMarker =
new BesMarker2D(
"RecMarker",
"RecMarker",
x, y, z);
73 fMarker->SetMarkerStyle(5);
74 fMarker->SetMarkerColor(kBlack);
76 else if (fType == 2) {
78 fMarker->SetMarkerStyle(2);
79 fMarker->SetMarkerColor(kBlack);
88 Double_t markSizeRatio = 4.0;
90 if (fType == 1 || fType == 2) {
91 if (!fMarker)
return dist;
94 Double_t r = sqrt( Double_t((px-cx)*(px-cx) + (py-cy)*(py-cy)) );
95 Double_t markerR = markSizeRatio*fMarker->GetMarkerSize();
96 if (markerR > 50) markerR = 50;
98 if ( fabs(r-markerR) < edge ) dist = 0;
100 else if (fType == 2) {
101 Double_t dx =
abs(px-cx), dy =
abs(py-cy);
102 if ( fabs(dx) < edge && fabs(dy) < markSizeRatio*fMarker->GetMarkerSize() ||
103 fabs(dy) < edge && fabs(dx) < markSizeRatio*fMarker->GetMarkerSize() )
109 else return TGeoTrack::DistancetoPrimitive(px, py);
121 if (gPad) gPad->SetCursor(kPointer);
124 Int_t normalWidth = 1, hlWidth = 2;
130 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
140 else if (fType == 1) {
142 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
154 else if (fType == 2) {
156 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
168 else if (fType == 3) {
170 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
183 width = this->GetLineWidth();
184 color = this->GetLineColor();
188 else if (fType == 1) {
189 fMarker->SetMarkerColor(kMagenta);
191 else if (fType == 2) {
192 fMarker->SetMarkerColor(kMagenta);
194 else if (fType == 3) {
195 width = this->GetLineWidth();
196 color = this->GetLineColor();
200 else if (fType == 4) {
217 for (Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++) {
224 else if (fType == 1) {
225 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
232 else if (fType == 2) {
233 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
240 else if (fType == 3) {
241 for (Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++) {
254 else if (fType == 1) {
255 fMarker->SetMarkerColor(kBlack);
257 else if (fType == 2) {
258 fMarker->SetMarkerColor(kBlack);
260 else if (fType == 3) {
264 else if (fType == 4) {
275 TGeoTrack::ExecuteEvent(event, px, py);
285 fPolyLine3D =
new TPolyLine3D(GetNpoints());
286 for (Int_t i = 0; i < GetNpoints(); i++) {
288 fPolyLine3D->SetPoint(i,
x,y,z);
290 fPolyLine3D->SetBit(kCanDelete);
292 fPolyLine3D->SetLineWidth(5);
293 fPolyLine3D->SetLineColor(kRed);
294 fPolyLine3D->Draw(option);
297 if (!gPad) gGeoManager->GetMasterVolume()->Draw();
298 char *opt1 = Compress(option);
300 Bool_t is_default = kTRUE;
301 Bool_t is_onelevel = kFALSE;
302 Bool_t is_all = kFALSE;
303 Bool_t is_type = kFALSE;
304 if (opt.Contains(
"/D")) {
308 if (opt.Contains(
"/*")) {
312 if (opt.Contains(
"/N")) {
314 Int_t ist = opt.Index(
"/N")+2;
315 Int_t ilast = opt.Index(
"/",ist);
316 if (ilast<0) ilast=opt.Length();
317 TString type = opt(ist, ilast-ist);
318 gGeoManager->SetParticleName(type.Data());
320 SetBits(is_default, is_onelevel, is_all, is_type);
331 TVector3 viewVec(
cos(viewPhi*TMath::DegToRad()),
sin(viewPhi*TMath::DegToRad()), 0);
333 Double_t x1=0.0, y1=0.0, z1=0.0;
334 Double_t dot, dotMin = 1e+20, dotTolerance = 0.01;
335 for (Int_t i = 1; i < GetNpoints(); i++) {
336 GetPoint(i,
x, y, z,
t);
338 if (
vec.Mag() > 5.0) {
340 dot = fabs(
vec.Dot(viewVec));
341 if ( dot < dotTolerance && dot < dotMin ) {
350 if (dotMin < 1e+20) {
351 BesMarker2D sectionPhi(
"trackPhi",
"trackPhi", x1, y1, z1);
352 sectionPhi.SetMarkerStyle(28);
353 sectionPhi.SetMarkerColor(1);
354 sectionPhi.SetMarkerSize(2);
359 if (fMarker) fMarker->
Paint(option);
360 TGeoTrack::Paint(option);
369 else return TObject::GetObjectInfo(px, py);
double sin(const BesAngle a)
double cos(const BesAngle a)
R__EXTERN BesCursor * gBesCursor
ClassImp(BesGeoTrack) BesGeoTrack
double abs(const EvtComplex &c)
virtual void Draw(Option_t *option="")
virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t)
virtual char * GetObjectInfo(Int_t px, Int_t py) const
virtual void SetMarker(Double_t x, Double_t y, Double_t z)
virtual void Paint(Option_t *option="")
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
virtual void SetCharge(Int_t charge)
virtual void GetCenterPixel(Int_t &px, Int_t &py)
virtual void SetMarkerSizeMultiple(Int_t input)
virtual void Paint(Option_t *option="")
virtual void SetText(std::vector< TString > infoCon)
virtual void SetPos(Int_t px, Int_t py)
Bool_t GetVisMucHitsGlobal()
Bool_t GetVisMdcHitsGlobal()
Bool_t GetVisEmcHitsBarrel()
Bool_t GetVisEmcHitsGlobal()
virtual void UpdateView(Bool_t resetview=kFALSE)
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Bool_t GetVisEmcHitsWest()
EBESViewType GetViewType()
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Bool_t GetVisTofHitsWest()
Bool_t GetVisTofHitsGlobal()
Bool_t GetVisEmcHitsEast()
Bool_t GetVisTofHitsBarrel()
Bool_t GetVisTofHitsEast()
virtual void SetHighlighted(bool status=true)
virtual bool IsHighlighted()
virtual void SetHighlighted(bool status=true)
virtual bool IsHighlighted()
virtual void SetHighlighted(bool status=true)
virtual bool IsHighlighted()
virtual void SetHighlighted(bool status=true)
virtual bool IsHighlighted()