]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliPoints.cxx
Incrementing class version
[u/mrichter/AliRoot.git] / STEER / AliPoints.cxx
index f0eb412b62b5eab43e747252cdba62480a621883..15d535ddf2d22e23f3a3ffa1975057fb4874e6ef 100644 (file)
@@ -1,3 +1,20 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 //  This class contains the points for the ALICE event display               //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "AliPoints.h"
-#include "AliRun.h"
-#include "AliDetector.h"
 #include "TPad.h"
+#include "TParticle.h"
 #include "TView.h"
+
+#include "AliDetector.h"
+#include "AliPoints.h"
+#include "AliRun.h"
+#include "AliMC.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)
 {
   //
@@ -71,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
@@ -81,7 +126,7 @@ void AliPoints::DumpParticle()
   if (particle) particle->Dump();
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
 {
   //
@@ -100,7 +145,7 @@ void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
 
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 const Text_t *AliPoints::GetName() const
 {
   //
@@ -111,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.
@@ -124,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
@@ -146,7 +189,7 @@ void AliPoints::InspectParticle()
   if (particle) particle->Inspect();
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliPoints::Propagate()
 {
   //
@@ -158,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());