MINFPoints Class Reference

#include <MINFPoints.h>

List of all members.

Public Member Functions

 MINFPoints ()
 MINFPoints (Int_t nhits)
virtual ~MINFPoints ()
virtual void DeEmbellishTrack ()
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
virtual void EmbellishTrack ()
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
virtual MINFDetectorGetDetector () const
virtual Int_t GetIndex ()
virtual GParticleGetParticle () const
virtual MINFHitGetSelHit () const
virtual const Text_t * GetHitName () const
virtual const Text_t * GetName () const
virtual void InspectParticle ()
virtual void DumpParticle ()
virtual void InspectSelectedHit ()
virtual void DumpSelectedHit ()
virtual char * GetObjectInfo (Int_t px, Int_t py) const
virtual void Propagate ()
virtual void SetDetector (MINFDetector *detector)
virtual void SetParticle (Int_t index)

Protected Attributes

MINFDetectorfDetector
Int_t fIndex
MINFHitfSelHit

Detailed Description

Definition at line 22 of file MINFPoints.h.


Constructor & Destructor Documentation

MINFPoints::MINFPoints (  ) 

Definition at line 39 of file MINFPoints.cxx.

00040 {
00041    fDetector = 0;       
00042    fIndex    = 0;
00043    fSelHit   = 0;
00044 }

MINFPoints::MINFPoints ( Int_t  nhits  ) 

Definition at line 47 of file MINFPoints.cxx.

References fDetector, fIndex, and fSelHit.

00047                                   :
00048    TPolyMarker3D(nhits)
00049 {
00050    fDetector = 0;       
00051    fIndex    = 0;
00052    fSelHit   = 0;
00053    ResetBit(kCanDelete);
00054 }
         

MINFPoints::~MINFPoints (  )  [virtual]

Definition at line 58 of file MINFPoints.cxx.

References fDetector, fIndex, and fSelHit.

00059 {
00060    fDetector = 0;       
00061    fIndex    = 0;
00062    fSelHit   = 0;
00063 }


Member Function Documentation

void MINFPoints::DeEmbellishTrack (  )  [virtual]

Definition at line 66 of file MINFPoints.cxx.

References MINFDetector::DeEmbellishTrack(), GetDetector(), and GetIndex().

Referenced by ExecuteEvent().

00067 {
00068 
00069 // De-embellish current track.
00070    GetDetector()->DeEmbellishTrack(GetIndex());
00071 }

Int_t MINFPoints::DistancetoPrimitive ( Int_t  px,
Int_t  py 
) [virtual]

Definition at line 74 of file MINFPoints.cxx.

References fSelHit, GetDetector(), GetIndex(), and MINFDetector::GetTrkHits().

00075 {
00076 
00077 //*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
00078 //*-*  Computes distance from point px,py to a 3-D polymarker*-*-*-*-*-*
00079 //*-*
00080 //*-*  Computes distance from mouse point (px,py) to each point of the
00081 //*-*  TPolyMarker3D for the track.  Returns distance found in pixels
00082 //*-*  for the closest point on the TPolyMarker3D.  Because MINFPoints
00083 //*-*  inherits from TPolyMarker3D, this object IS a TPolyMarker3D and
00084 //*-*  we could use parent TPolyMarker3D::DistancetoPrimitive method for
00085 //*-*  dist.  However, we extend the TPolyMarker3D::DistancetoPrimitive
00086 //*-*  to save the index of the closest point on the TPolyMarker3D, so
00087 //*-*  we have a hook into the hits bank for the selected hit. gmi10/98
00088 //*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
00089 
00090    const Int_t inaxis = 7;
00091    Int_t dist = 9999;
00092    Int_t idhit = -1;
00093    fSelHit = 0;
00094 
00095    Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
00096    Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
00097    Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
00098    Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
00099 
00100 // Return if point is not in the user area.
00101    if (px < puxmin - inaxis) return dist;
00102    if (py > puymin + inaxis) return dist;
00103    if (px > puxmax + inaxis) return dist;
00104    if (py < puymax - inaxis) return dist;
00105 
00106    TView *view = gPad->GetView();
00107    if (!view) return dist;
00108 
00109    Int_t i, dpoint;
00110    Float_t xndc[3];
00111    Int_t x1,y1;
00112    for (i=0; i<fN; i++) {
00113      view->WCtoNDC(&fP[3*i], xndc);
00114      x1     = gPad->XtoAbsPixel(xndc[0]);
00115      y1     = gPad->YtoAbsPixel(xndc[1]);
00116      dpoint = Int_t(TMath::Sqrt((Long_t)((px-x1)*(px-x1) +
00117                                          (py-y1)*(py-y1))));
00118      if (dpoint < dist) {
00119        dist = dpoint;
00120        idhit = i;
00121      }
00122    }
00123 
00124    if (dist < 2) {
00125      gPad->SetSelected(this);
00126      gPad->SetCursor(kCross);
00127    }
00128    fSelHit = (MINFHit *)
00129               GetDetector()->GetTrkHits(GetIndex())->UncheckedAt(idhit);
00130    return dist;
00131 }

void MINFPoints::DumpParticle (  )  [virtual]

Definition at line 134 of file MINFPoints.cxx.

References GetParticle().

00135 {
00136 
00137 // Dump particle corresponding to this point
00138    GParticle *particle = GetParticle();
00139    if (particle) particle->Dump();
00140 }

void MINFPoints::DumpSelectedHit (  )  [virtual]

Definition at line 143 of file MINFPoints.cxx.

References MINFDetector::DumpHit(), GetDetector(), and GetSelHit().

00144 {
00145 
00146 // Dump REROOT object for selected hit.
00147    GetDetector()->DumpHit(GetSelHit()->IDREROOTHit());
00148 }

void MINFPoints::EmbellishTrack (  )  [virtual]

Definition at line 151 of file MINFPoints.cxx.

References MINFDetector::EmbellishTrack(), GetDetector(), and GetIndex().

Referenced by ExecuteEvent().

00152 {
00153 
00154 // Embellish current track.
00155    GetDetector()->EmbellishTrack(GetIndex());
00156 }

void MINFPoints::ExecuteEvent ( Int_t  event,
Int_t  px,
Int_t  py 
) [virtual]

Definition at line 159 of file MINFPoints.cxx.

References DeEmbellishTrack(), EmbellishTrack(), and Propagate().

00160 {
00161 
00162 //*-*-*Execute an action resulting from a mouse event*-*-*-*-*-*-*-*-*-*
00163 //*-*
00164 //*-*  This member function must be implemented to realize an action
00165 //*-*  responding to a mouse click on this object in the window
00166 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
00167 
00168    switch (event) {
00169 
00170    case kButton1Down:
00171       gVirtualX->SetMarkerColor(-1);
00172       gPad->AbsCoordinates(kTRUE);
00173       this->SetMarkerColor(6);
00174       this->SetMarkerStyle(6);
00175       EmbellishTrack();
00176       Propagate();
00177       break;
00178 
00179    case kMouseMotion:
00180       break;
00181 
00182    case kButton1Motion:
00183       break;
00184 
00185    case kButton1Up:
00186       gVirtualX->SetMarkerColor(-1);
00187       this->SetMarkerColor(kBlack);
00188       this->SetMarkerStyle(1);
00189       DeEmbellishTrack();
00190       Propagate();
00191       gPad->AbsCoordinates(kFALSE);
00192    }
00193 }

virtual MINFDetector* MINFPoints::GetDetector (  )  const [inline, virtual]
const Text_t * MINFPoints::GetHitName (  )  const [virtual]

Definition at line 196 of file MINFPoints.cxx.

References GetDetector(), MINFDetector::GetIPDG(), GetParticle(), and GetSelHit().

Referenced by GetObjectInfo().

00197 {
00198 
00199 // Returns IPDG name for final state particle which lost energy to hit
00200    Int_t ip = GetDetector()->GetIPDG(GetSelHit()->IDREROOTHit());
00201    MINFAttParticle *PDGPart = MINFAttParticle::GetParticle(ip);
00202    return (PDGPart->GetName());
00203 }

virtual Int_t MINFPoints::GetIndex (  )  [inline, virtual]

Definition at line 38 of file MINFPoints.h.

References fIndex.

Referenced by DeEmbellishTrack(), DistancetoPrimitive(), EmbellishTrack(), and Propagate().

00038 {return fIndex;}

const Text_t * MINFPoints::GetName ( void   )  const [virtual]

Definition at line 206 of file MINFPoints.cxx.

References GParticle::GetName(), and GetParticle().

00207 {
00208 
00209 // Return name of the PDG particle corresponding to primary
00210    GParticle *particle = GetParticle();
00211    if (!particle) return "Particle";
00212    return (particle->GetName());
00213 }

char * MINFPoints::GetObjectInfo ( Int_t  px,
Int_t  py 
) const [virtual]

Definition at line 216 of file MINFPoints.cxx.

References fIndex, GetDetector(), MINFDetector::GetHitELOSS(), GetHitName(), MINFDetector::GetHitPartMom(), GParticle::GetMomentum(), GetParticle(), GetSelHit(), and info.

00217 {
00218 
00219 // Redefines TObject::GetObjectInfo.
00220 // Displays the info particle,etc corresponding to cursor position px,py
00221    static char info[64];
00222 
00223 // Return primary particle momentum
00224    GParticle *particle = GetParticle();
00225    Float_t pp = 0;
00226    if (particle) pp = particle->GetMomentum();
00227 
00228 // Get hit particle momentum
00229    Float_t tm =
00230         GetDetector()->GetHitPartMom(GetSelHit()->IDREROOTHit());
00231 
00232 // Get Hit ELoss
00233    Float_t el =
00234         1.e6 * (GetDetector()->GetHitELOSS(GetSelHit()->IDREROOTHit()));
00235 
00236    sprintf(info,
00237            "%.3g GeV/c Primary #%d (%.3g KeV ELoss from %.3g GeV/c %s)",
00238                                       pp, fIndex, el, tm, GetHitName());
00239    return info;
00240 }

GParticle * MINFPoints::GetParticle (  )  const [virtual]

Definition at line 243 of file MINFPoints.cxx.

References fIndex, gMINFast, and MINFast::Particles().

Referenced by MINFDisplay::DrawHits(), DumpParticle(), GetHitName(), GetName(), GetObjectInfo(), and InspectParticle().

00244 {
00245 
00246 // Returns pointer to primary particle index in MINFast::fParticles
00247    TClonesArray *particles = gMINFast->Particles();
00248    Int_t nparticles = particles->GetEntriesFast();
00249    if (fIndex < 0 || fIndex >= nparticles) return 0;
00250    return (GParticle *) particles->UncheckedAt(fIndex);
00251 }

virtual MINFHit* MINFPoints::GetSelHit (  )  const [inline, virtual]

Definition at line 40 of file MINFPoints.h.

References fSelHit.

Referenced by DumpSelectedHit(), GetHitName(), GetObjectInfo(), and InspectSelectedHit().

00040 {return fSelHit;}

void MINFPoints::InspectParticle (  )  [virtual]

Definition at line 254 of file MINFPoints.cxx.

References GetParticle().

00255 {
00256 
00257 // Inspect particle corresponding to this point
00258    GParticle *particle = GetParticle();
00259    if (particle) particle->Inspect();
00260 }

void MINFPoints::InspectSelectedHit (  )  [virtual]

Definition at line 263 of file MINFPoints.cxx.

References GetDetector(), GetSelHit(), and MINFDetector::InspectHit().

00264 {
00265 
00266 // Inspect REROOT object for selected hit.
00267    GetDetector()->InspectHit(GetSelHit()->IDREROOTHit());
00268 }

void MINFPoints::Propagate (  )  [virtual]

Definition at line 271 of file MINFPoints.cxx.

References MINFast::Detectors(), GetIndex(), and gMINFast.

Referenced by ExecuteEvent().

00272 {
00273 
00274 // Set attributes of all points for this track in all detectors to be
00275 // the attributes of this track's points.
00276    Int_t ntracks,track;
00277    TObjArray *points;
00278    MINFPoints *pm;
00279 
00280    TIter next(gMINFast->Detectors());
00281    MINFDetector *detector;
00282    while ((detector = (MINFDetector *) next())) {
00283       if (!detector->IsActive()) continue;
00284       points = detector->Points();
00285       if (!points) continue;
00286       ntracks = points->GetEntriesFast();
00287       for (track=0; track<ntracks; track++) {
00288          pm = (MINFPoints *) points->UncheckedAt(track);
00289          if (!pm) continue;
00290          if (GetIndex() == pm->GetIndex()) {
00291             pm->SetMarkerColor(GetMarkerColor());
00292             pm->SetMarkerSize(GetMarkerSize());
00293             pm->SetMarkerStyle(GetMarkerStyle());
00294             pm->Paint();
00295          }
00296       }
00297    }
00298 }

virtual void MINFPoints::SetDetector ( MINFDetector detector  )  [inline, virtual]

Definition at line 49 of file MINFPoints.h.

References fDetector.

Referenced by MINFDetector::LoadPoints().

00050                                                  {fDetector = detector;}

virtual void MINFPoints::SetParticle ( Int_t  index  )  [inline, virtual]

Definition at line 51 of file MINFPoints.h.

References fIndex.

Referenced by MINFDetector::LoadPoints().

00051 {fIndex = index;}


Member Data Documentation

Definition at line 25 of file MINFPoints.h.

Referenced by GetDetector(), MINFPoints(), SetDetector(), and ~MINFPoints().

Int_t MINFPoints::fIndex [protected]

Definition at line 26 of file MINFPoints.h.

Referenced by GetIndex(), GetObjectInfo(), GetParticle(), MINFPoints(), SetParticle(), and ~MINFPoints().

Definition at line 27 of file MINFPoints.h.

Referenced by DistancetoPrimitive(), GetSelHit(), MINFPoints(), and ~MINFPoints().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1