]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliPoints.cxx
Improved version of online detector-algorithm makefile
[u/mrichter/AliRoot.git] / STEER / AliPoints.cxx
index a47f54080fabca4d5c9b64c0f6dc58b8c80b4ac4..8e7e9ffc7cb57a199041d34be1393d3446684395 100644 (file)
@@ -13,9 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -30,47 +28,75 @@ $Log$
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "AliPoints.h"
-#include "AliRun.h"
-#include "AliDetector.h"
 #include "TPad.h"
+#include "TParticle.h"
 #include "TView.h"
+
+#include "AliDetector.h"
+#include "AliMC.h"
+#include "AliPoints.h"
+#include "AliRun.h"
  
 ClassImp(AliPoints)
 
-//_____________________________________________________________________________
-AliPoints::AliPoints()
+//_______________________________________________________________________
+AliPoints::AliPoints():
+  fDetector(0),
+  fIndex(0)
 {
   //
   // Default constructor
   //
-  fDetector = 0;       
-  fIndex    = 0;
 }
 
-//_____________________________________________________________________________
-AliPoints::AliPoints(Int_t nhits)
-  :TPolyMarker3D(nhits)
+//_______________________________________________________________________
+AliPoints::AliPoints(const AliPoints &pts):
+  TPolyMarker3D(pts),
+  fDetector(0),
+  fIndex(0)
+{
+  //
+  // Copy constructor
+  //
+  pts.Copy(*this);
+}
+
+//_______________________________________________________________________
+AliPoints::AliPoints(Int_t nhits):
+  TPolyMarker3D(nhits),
+  fDetector(0),
+  fIndex(0)
 {
   //
   // Standard constructor
   //
-  fDetector = 0;       
-  fIndex    = 0;
   ResetBit(kCanDelete);
 }
         
-//_____________________________________________________________________________
+//_______________________________________________________________________
 AliPoints::~AliPoints()
 {
   //
-  // Default constructor
+  // Default destructor
+  //
+}
+
+//_______________________________________________________________________
+void AliPoints::Copy(TObject &pts) const
+{
   //
-  fDetector = 0;       
-  fIndex    = 0;
+  // Copy *this onto pts
+  //
+  if((TObject*)this != &pts) {
+    ((TPolyMarker3D*)this)->Copy(dynamic_cast<TPolyMarker3D&>(pts));
+    (dynamic_cast<AliPoints&>(pts)).fGLList = fGLList;
+    (dynamic_cast<AliPoints&>(pts)).fLastPoint = fLastPoint;
+    (dynamic_cast<AliPoints&>(pts)).fDetector = fDetector;
+    (dynamic_cast<AliPoints&>(pts)).fIndex = fIndex;
+  }
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
 {
   //
@@ -90,8 +116,8 @@ Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
   return TPolyMarker3D::DistancetoPrimitive(px,py);
 }
 
-//_____________________________________________________________________________
-void AliPoints::DumpParticle()
+//_______________________________________________________________________
+void AliPoints::DumpParticle() const
 {
   //
   //   Dump particle corresponding to this point
@@ -100,7 +126,7 @@ void AliPoints::DumpParticle()
   if (particle) particle->Dump();
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
 {
   //
@@ -119,7 +145,7 @@ void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
 
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 const Text_t *AliPoints::GetName() const
 {
   //
@@ -130,8 +156,8 @@ const Text_t *AliPoints::GetName() const
   return particle->GetName();
 }
 
-//_____________________________________________________________________________
-Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
+//_______________________________________________________________________
+Text_t *AliPoints::GetObjectInfo(Int_t, Int_t) const
 {
   //
   //   Redefines TObject::GetObjectInfo.
@@ -143,20 +169,18 @@ Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
   return info;
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 TParticle *AliPoints::GetParticle() const
 {
   //
   //   Returns pointer to particle index in AliRun::fParticles
   //
-  TClonesArray *particles = gAlice->Particles();
-  Int_t nparticles = particles->GetEntriesFast();
-  if (fIndex < 0 || fIndex >= nparticles) return 0;
-  return (TParticle*)particles->UncheckedAt(fIndex);
+  if (fIndex < 0 || fIndex >= gAlice->GetMCApp()->GetNtrack()) return 0;
+  else return gAlice->GetMCApp()->Particle(fIndex);
 }
 
-//_____________________________________________________________________________
-void AliPoints::InspectParticle()
+//_______________________________________________________________________
+void AliPoints::InspectParticle() const
 {
   //
   //   Inspect particle corresponding to this point
@@ -165,7 +189,7 @@ void AliPoints::InspectParticle()
   if (particle) particle->Inspect();
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliPoints::Propagate()
 {
   //
@@ -177,13 +201,13 @@ void AliPoints::Propagate()
   //  
   TIter next(gAlice->Detectors());
   AliDetector *detector;
-  while((detector = (AliDetector*)next())) {
+  while((detector = (AliDetector*)(next()))) {
     if (!detector->IsActive()) continue;
     points = detector->Points();
     if (!points) continue;
     ntracks = points->GetEntriesFast();
     for (track=0;track<ntracks;track++) {
-      pm = (AliPoints*)points->UncheckedAt(track);
+      pm = dynamic_cast<AliPoints*>(points->UncheckedAt(track));
       if (!pm) continue;
       if (fIndex == pm->GetIndex()) {
        pm->SetMarkerColor(GetMarkerColor());