+/**************************************************************************
+ * 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 //
// //
//Begin_Html
/*
-<img src="gif/AliPointsClass.gif">
+<img src="picts/AliPointsClass.gif">
*/
//End_Html
// //
// //
///////////////////////////////////////////////////////////////////////////////
-#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)
{
//
return TPolyMarker3D::DistancetoPrimitive(px,py);
}
-//_____________________________________________________________________________
-void AliPoints::DumpParticle()
+//_______________________________________________________________________
+void AliPoints::DumpParticle() const
{
//
// Dump particle corresponding to this point
//
- GParticle *particle = GetParticle();
+ TParticle *particle = GetParticle();
if (particle) particle->Dump();
}
-//_____________________________________________________________________________
+//_______________________________________________________________________
void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
{
//
}
-//_____________________________________________________________________________
+//_______________________________________________________________________
const Text_t *AliPoints::GetName() const
{
//
// Return name of the Geant3 particle corresponding to this point
//
- GParticle *particle = GetParticle();
+ TParticle *particle = GetParticle();
if (!particle) return "Particle";
return particle->GetName();
}
-//_____________________________________________________________________________
-Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
+//_______________________________________________________________________
+Text_t *AliPoints::GetObjectInfo(Int_t, Int_t) const
{
//
// Redefines TObject::GetObjectInfo.
return info;
}
-//_____________________________________________________________________________
-GParticle *AliPoints::GetParticle() const
+//_______________________________________________________________________
+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 (GParticle*)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
//
- GParticle *particle = GetParticle();
+ TParticle *particle = GetParticle();
if (particle) particle->Inspect();
}
-//_____________________________________________________________________________
+//_______________________________________________________________________
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());