Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BesGeoTrack Class Reference

#include <BesGeoTrack.h>

List of all members.

Public Member Functions

virtual void AddHit (TObject *obj)
virtual void AddHit (TObject *obj)
virtual void AddInfo (TString info)
virtual void AddInfo (TString info)
virtual void AddPoint (Double_t x, Double_t y, Double_t z, Double_t t)
virtual void AddPoint (Double_t x, Double_t y, Double_t z, Double_t t)
 BesGeoTrack (Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent=0, TObject *particle=0)
 BesGeoTrack ()
 BesGeoTrack (Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent=0, TObject *particle=0)
 BesGeoTrack ()
virtual void CloseInfo ()
virtual void CloseInfo ()
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
virtual void Draw (Option_t *option="")
virtual void Draw (Option_t *option="")
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
virtual char * GetObjectInfo (Int_t px, Int_t py) const
virtual char * GetObjectInfo (Int_t px, Int_t py) const
virtual void Init ()
virtual void Init ()
virtual void Paint (Option_t *option="")
virtual void Paint (Option_t *option="")
virtual void SetCharge (Int_t charge)
virtual void SetCharge (Int_t charge)
virtual void SetMarker (Double_t x, Double_t y, Double_t z)
virtual void SetMarker (Double_t x, Double_t y, Double_t z)
virtual void SetTrackType (Int_t type)
virtual void SetTrackType (Int_t type)
virtual ~BesGeoTrack ()
virtual ~BesGeoTrack ()

Private Attributes

Int_t fCharge
TObjArray fHits
std::vector< TString > fInfoCon
std::vector< TString > fInfoCon
BesMarker2DfMarker
BesMarker2DfMarker
TPolyLine3D * fPolyLine3D
TPolyLine3D * fPolyLine3D
BesPaveTextfTip
BesPaveTextfTip
Int_t fType


Constructor & Destructor Documentation

BesGeoTrack::BesGeoTrack  ) 
 

BesGeoTrack::BesGeoTrack Int_t  id,
Int_t  pdgcode,
TVirtualGeoTrack *  parent = 0,
TObject *  particle = 0
 

00028         : TGeoTrack(id, pdgcode, parent, particle)
00029 {
00030 //  std::cout << "co BesGeoTrack: " << ++count << std::endl;
00031     Init();
00032 }

BesGeoTrack::~BesGeoTrack  )  [virtual]
 

00035 {
00036 //  std::cout << "de BesGeoTrack: " << --count << std::endl;
00037     if (fTip)        delete fTip;
00038     if (fPolyLine3D) delete fPolyLine3D;
00039     if (fMarker)     delete fMarker;
00040 }

BesGeoTrack::BesGeoTrack  ) 
 

BesGeoTrack::BesGeoTrack Int_t  id,
Int_t  pdgcode,
TVirtualGeoTrack *  parent = 0,
TObject *  particle = 0
 

virtual BesGeoTrack::~BesGeoTrack  )  [virtual]
 


Member Function Documentation

virtual void BesGeoTrack::AddHit TObject *  obj  )  [inline, virtual]
 

00021 { fHits.Add(obj); }

virtual void BesGeoTrack::AddHit TObject *  obj  )  [inline, virtual]
 

00021 { fHits.Add(obj); }

virtual void BesGeoTrack::AddInfo TString  info  )  [inline, virtual]
 

00022 { fInfoCon.push_back(info); }

virtual void BesGeoTrack::AddInfo TString  info  )  [inline, virtual]
 

00022 { fInfoCon.push_back(info); }

virtual void BesGeoTrack::AddPoint Double_t  x,
Double_t  y,
Double_t  z,
Double_t  t
[virtual]
 

void BesGeoTrack::AddPoint Double_t  x,
Double_t  y,
Double_t  z,
Double_t  t
[virtual]
 

00061 {
00062     TGeoTrack::AddPoint(x,y,z,t);
00063 }

virtual void BesGeoTrack::CloseInfo  )  [virtual]
 

void BesGeoTrack::CloseInfo  )  [virtual]
 

00052 {
00053     if (fTip) {
00054         fTip->SetText(fInfoCon);
00055     }
00056     else
00057         cout << "BesGeoTrack::CloseInfo, not initialized" << endl;
00058 }

virtual Int_t BesGeoTrack::DistancetoPrimitive Int_t  px,
Int_t  py
[virtual]
 

Int_t BesGeoTrack::DistancetoPrimitive Int_t  px,
Int_t  py
[virtual]
 

00082 {
00083     Int_t dist = 9999;
00084     Int_t cx, cy;
00085     Double_t edge = 4.0; // edge width of track
00086     Double_t markSizeRatio = 4.0;  // 4.0 is approximate size.
00087 
00088     if (fType == 1 || fType == 2) { // tof or emc
00089         if (!fMarker) return dist;
00090         fMarker->GetCenterPixel(cx, cy);
00091         if (fType == 1) { // tof
00092             Double_t r = sqrt( Double_t((px-cx)*(px-cx) + (py-cy)*(py-cy)) );
00093             Double_t markerR = markSizeRatio*fMarker->GetMarkerSize();
00094             if (markerR > 50) markerR = 50;  
00095             // if the size of a marker with type of circle is too large > 50 pixel, it could not be enlarged.
00096             if ( fabs(r-markerR) < edge ) dist = 0;
00097         }
00098         else if (fType == 2) { // emc
00099             Double_t dx = abs(px-cx), dy = abs(py-cy);
00100             if ( fabs(dx) < edge && fabs(dy) < markSizeRatio*fMarker->GetMarkerSize() ||
00101                     fabs(dy) < edge && fabs(dx) < markSizeRatio*fMarker->GetMarkerSize() )
00102                 dist = 0;
00103         }
00104 
00105         return dist;
00106     }
00107     else return TGeoTrack::DistancetoPrimitive(px, py);
00108 }

virtual void BesGeoTrack::Draw Option_t *  option = ""  )  [virtual]
 

void BesGeoTrack::Draw Option_t *  option = ""  )  [virtual]
 

00276 {
00277     // Draw Polyline3D for OpenGL and X3d
00278     BesView *view = (BesView*)gPad->GetView();
00279     if (view && view->GetViewType() & k3DView) {
00280         Double_t x,y,z,t;
00281         fPolyLine3D = new TPolyLine3D(GetNpoints());
00282         for (Int_t i = 0; i < GetNpoints(); i++) {
00283             GetPoint(i,x,y,z,t);
00284             fPolyLine3D->SetPoint(i,x,y,z);
00285         }
00286         fPolyLine3D->SetBit(kCanDelete);
00287 
00288         fPolyLine3D->SetLineWidth(5);
00289         fPolyLine3D->SetLineColor(kRed);
00290         fPolyLine3D->Draw(option);
00291     }
00292 
00293     if (!gPad) gGeoManager->GetMasterVolume()->Draw();
00294     char *opt1 = Compress(option); // we will have to delete this ?
00295     TString opt(opt1);
00296     Bool_t is_default = kTRUE;
00297     Bool_t is_onelevel = kFALSE;
00298     Bool_t is_all = kFALSE;
00299     Bool_t is_type = kFALSE;
00300     if (opt.Contains("/D")) {
00301         is_onelevel = kTRUE;
00302         is_default = kFALSE;
00303     }
00304     if (opt.Contains("/*")) {
00305         is_all = kTRUE;
00306         is_default = kFALSE;
00307     }
00308     if (opt.Contains("/N")) {
00309         is_type = kTRUE;
00310         Int_t ist = opt.Index("/N")+2;
00311         Int_t ilast = opt.Index("/",ist);
00312         if (ilast<0) ilast=opt.Length();
00313         TString type = opt(ist, ilast-ist);
00314         gGeoManager->SetParticleName(type.Data());
00315     }
00316     SetBits(is_default, is_onelevel, is_all, is_type);
00317     AppendPad("SAME");
00318 
00319     delete [] opt1;
00320     return;
00321 }

virtual void BesGeoTrack::ExecuteEvent Int_t  event,
Int_t  px,
Int_t  py
[virtual]
 

void BesGeoTrack::ExecuteEvent Int_t  event,
Int_t  px,
Int_t  py
[virtual]
 

00111 {
00112     BesView *view = (BesView*)gPad->GetView();
00113 
00114     if (gBesCursor->GetType() == kBesHand) {
00115         if (view) view->ExecuteEvent(event, px, py);
00116     }
00117     else if (gBesCursor->GetType() == kBesPick){
00118 
00119         if (gPad) gPad->SetCursor(kPointer);
00120 
00121         Int_t width, color;
00122         Int_t normalWidth = 1, hlWidth = 2;
00123 
00124         switch (event) {
00125         case kMouseEnter:
00126             if (fType == 0) {
00127                 if (view->GetVisMdcHitsGlobal()) {
00128                     for (Int_t i = 0; i < fHits.GetEntries(); i++) {
00129                         Mdc2DWire *aHit = (Mdc2DWire*)fHits.At(i);
00130                         if (aHit != 0) {
00131                             if (view->GetVisMdcHits()) {
00132                                 aHit->SetHighlighted(true);
00133                             }
00134                         }
00135                     }
00136                 }
00137             }
00138             else if (fType == 1) {
00139                 if (view->GetVisTofHitsGlobal()) {
00140                     for (Int_t i = 0; i < fHits.GetEntries(); i++) {
00141                         Tof2DScin *aHit = (Tof2DScin*)fHits.At(i);
00142                         if (aHit != 0) {
00143                             if ( aHit->GetPart() == 0 && view->GetVisTofHitsEast() ||
00144                                     aHit->GetPart() == 1 && view->GetVisTofHitsBarrel() ||
00145                                     aHit->GetPart() == 2 && view->GetVisTofHitsWest() ) {
00146                                 aHit->SetHighlighted(true);
00147                             }
00148                         }
00149                     }
00150                 }
00151             }
00152             else if (fType == 2) {
00153                 if (view->GetVisEmcHitsGlobal()) {
00154                     for (Int_t i = 0; i < fHits.GetEntries(); i++) {
00155                         Emc2DCrystal *aHit = (Emc2DCrystal*)fHits.At(i);
00156                         if (aHit != 0) {
00157                             if ( aHit->GetPart() == 0 && view->GetVisEmcHitsEast() ||
00158                                     aHit->GetPart() == 1 && view->GetVisEmcHitsBarrel() ||
00159                                     aHit->GetPart() == 2 && view->GetVisEmcHitsWest() ) {
00160                                 aHit->SetHighlighted(true);
00161                             }
00162                         }
00163                     }
00164                 }
00165             }
00166             else if (fType == 3) {
00167                 if (view->GetVisMucHitsGlobal()) {
00168                     for (Int_t i = 0; i < fHits.GetEntries(); i++) {
00169                         Muc2DStrip *aHit = (Muc2DStrip*)fHits.At(i);
00170                         if (aHit != 0) {
00171                             if (view->GetVisMucHitsGlobal()) {
00172                                 aHit->SetHighlighted(true);
00173                             }
00174                         }
00175                     }
00176                 }
00177             }
00178 
00179 
00180             if (fType == 0) {
00181                 width = this->GetLineWidth();
00182                 color = this->GetLineColor();
00183                 this->SetLineWidth(hlWidth);
00184                 this->SetLineColor(kRed);
00185             }
00186             else if (fType == 1) {
00187                 fMarker->SetMarkerColor(kMagenta);
00188             }
00189             else if (fType == 2) {
00190                 fMarker->SetMarkerColor(kMagenta);
00191             }
00192             else if (fType == 3) {
00193                 width = this->GetLineWidth();
00194                 color = this->GetLineColor();
00195                 this->SetLineWidth(hlWidth);
00196                 this->SetLineColor(kRed);
00197             }
00198             else if (fType == 4) {
00199                 this->SetLineWidth(hlWidth);
00200                 this->SetLineColor(kBlue);
00201             }
00202 
00203             fTip->SetPos(px, py);
00204             view->UpdateView(0);
00205 
00206             if (gBesCursor->GetShowInfo()) fTip->Draw("TL,SAME"); // "BR,ARC,SAME"
00207             gPad->Modified();
00208             gPad->Update();
00209             break;
00210 
00211         case kMouseLeave:
00212             if (fType == 0) {
00213                 for (Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++) {
00214                     Mdc2DWire *aHit = (Mdc2DWire*)fHits.At(i);
00215                     if (aHit != 0 && aHit->IsHighlighted()) {
00216                         aHit->SetHighlighted(false);
00217                     }
00218                 }
00219             }
00220             else if (fType == 1) {
00221                 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
00222                     Tof2DScin *aHit = (Tof2DScin*)fHits.At(i);
00223                     if (aHit != 0 && aHit->IsHighlighted()) {
00224                         aHit->SetHighlighted(false);
00225                     }
00226                 }
00227             }
00228             else if (fType == 2) {
00229                 for (Int_t i = 0; i < fHits.GetEntries(); i++) {
00230                     Emc2DCrystal *aHit = (Emc2DCrystal*)fHits.At(i);
00231                     if (aHit != 0 && aHit->IsHighlighted()) {
00232                         aHit->SetHighlighted(false);
00233                     }
00234                 }
00235             }
00236             else if (fType == 3) {
00237                 for (Int_t i = 0; i < (Int_t)fHits.GetEntries(); i++) {
00238                     Muc2DStrip *aHit = (Muc2DStrip*)fHits.At(i);
00239                     if (aHit != 0 && aHit->IsHighlighted()) {
00240                         aHit->SetHighlighted(false);
00241                     }
00242                 }
00243             }
00244 
00245 
00246             if (fType == 0) {
00247                 this->SetLineWidth(normalWidth);
00248                 this->SetLineColor(kBlack);
00249             }
00250             else if (fType == 1) {
00251                 fMarker->SetMarkerColor(kBlack);
00252             }
00253             else if (fType == 2) {
00254                 fMarker->SetMarkerColor(kBlack);
00255             }
00256             else if (fType == 3) {
00257                 this->SetLineWidth(normalWidth);
00258                 this->SetLineColor(kBlack);
00259             }
00260             else if (fType == 4) {
00261                 this->SetLineWidth(normalWidth);
00262                 this->SetLineColor(kBlack);
00263             }
00264 
00265             view->UpdateView(0);
00266             gPad->Modified();
00267             gPad->Update();
00268             break;
00269         }
00270 
00271         TGeoTrack::ExecuteEvent(event, px, py);
00272     }
00273 }

virtual char* BesGeoTrack::GetObjectInfo Int_t  px,
Int_t  py
const [virtual]
 

char * BesGeoTrack::GetObjectInfo Int_t  px,
Int_t  py
const [virtual]
 

00361                                                          {
00362 
00363     BesView *view = (BesView*)gPad->GetView();
00364     if (view) return view->GetObjectInfo(px, py);
00365     else return TObject::GetObjectInfo(px, py);
00366 }

virtual void BesGeoTrack::Init  )  [virtual]
 

void BesGeoTrack::Init  )  [virtual]
 

00043 {
00044     fTip = new BesPaveText(0, 0, 0.1, 0.1, "TL");
00045 
00046     fMarker = 0;
00047 
00048     //fHits.Clear("C");
00049 }

virtual void BesGeoTrack::Paint Option_t *  option = ""  )  [virtual]
 

void BesGeoTrack::Paint Option_t *  option = ""  )  [virtual]
 

00324 {
00325     BesView *view = (BesView*)gPad->GetView();
00326     Double_t viewPhi = view->GetLongitude();
00327     TVector3 viewVec(cos(viewPhi*TMath::DegToRad()), sin(viewPhi*TMath::DegToRad()), 0);
00328     Double_t x, y, z, t;
00329     Double_t x1=0.0, y1=0.0, z1=0.0;
00330     Double_t dot, dotMin = 1e+20, dotTolerance = 0.01;
00331     for (Int_t i = 1; i < GetNpoints(); i++) {
00332         GetPoint(i, x, y, z, t);
00333         TVector3 vec(x,y,0);
00334         if (vec.Mag() > 5.0) {
00335             vec.SetMag(1.0);
00336             dot = fabs(vec.Dot(viewVec));
00337             if ( dot < dotTolerance && dot < dotMin ) {
00338                 x1 = x;
00339                 y1 = y;
00340                 z1 = z;
00341                 dotMin = dot;
00342             }
00343         }
00344     }
00345 
00346     if (dotMin < 1e+20) {
00347         BesMarker2D sectionPhi("trackPhi", "trackPhi", x1, y1, z1);
00348         sectionPhi.SetMarkerStyle(28);
00349         sectionPhi.SetMarkerColor(1);
00350         sectionPhi.SetMarkerSize(2);
00351         sectionPhi.Paint();  
00352         //sectionPhi paint the marker in origin point of MdcTrack!!!
00353     }
00354 
00355     if (fMarker) fMarker->Paint(option);
00356     TGeoTrack::Paint(option);
00357 }

virtual void BesGeoTrack::SetCharge Int_t  charge  )  [virtual]
 

void BesGeoTrack::SetCharge Int_t  charge  )  [virtual]
 

00369 {
00370     fCharge = charge;
00371     if (fCharge > 0)      this->SetLineColor(kBlack); // +
00372     else if (fCharge < 0) this->SetLineColor(kBlack); // -
00373     else                   this->SetLineColor(kGreen); // 0
00374 }

virtual void BesGeoTrack::SetMarker Double_t  x,
Double_t  y,
Double_t  z
[virtual]
 

void BesGeoTrack::SetMarker Double_t  x,
Double_t  y,
Double_t  z
[virtual]
 

00066 {
00067     fMarker = new BesMarker2D("RecMarker", "RecMarker", x, y, z);
00068 
00069     if (fType == 1) { // tof
00070         fMarker->SetMarkerSizeMultiple(20);
00071         fMarker->SetMarkerStyle(5);
00072         fMarker->SetMarkerColor(kBlack);
00073     }
00074     else if (fType == 2) { // emc
00075         fMarker->SetMarkerSizeMultiple(20);
00076         fMarker->SetMarkerStyle(2);
00077         fMarker->SetMarkerColor(kBlack);
00078     }
00079 }

virtual void BesGeoTrack::SetTrackType Int_t  type  )  [inline, virtual]
 

00025 { fType = type; }

virtual void BesGeoTrack::SetTrackType Int_t  type  )  [inline, virtual]
 

00025 { fType = type; }


Member Data Documentation

Int_t BesGeoTrack::fCharge [private]
 

TObjArray BesGeoTrack::fHits [private]
 

std::vector<TString> BesGeoTrack::fInfoCon [private]
 

std::vector<TString> BesGeoTrack::fInfoCon [private]
 

BesMarker2D* BesGeoTrack::fMarker [private]
 

BesMarker2D* BesGeoTrack::fMarker [private]
 

TPolyLine3D* BesGeoTrack::fPolyLine3D [private]
 

TPolyLine3D* BesGeoTrack::fPolyLine3D [private]
 

BesPaveText* BesGeoTrack::fTip [private]
 

BesPaveText* BesGeoTrack::fTip [private]
 

Int_t BesGeoTrack::fType [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 15:52:30 2011 for BOSS6.5.5 by  doxygen 1.3.9.1