kine_tracks.C
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 28 Aug 2008 17:43:00 +0000 (17:43 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 28 Aug 2008 17:43:00 +0000 (17:43 +0000)
-------------
Do not use AliStack::IsPhysicalPrimary() to decide whether to import a
particle and its daughters.
Instead loop over primary particles and check their status-code to be <= 1.

kine_print.C
------------
New macro - print basic information about kinematics.

EVE/alice-macros/kine_print.C [new file with mode: 0644]
EVE/alice-macros/kine_tracks.C

diff --git a/EVE/alice-macros/kine_print.C b/EVE/alice-macros/kine_print.C
new file mode 100644 (file)
index 0000000..ba1c111
--- /dev/null
@@ -0,0 +1,40 @@
+// $Id: kine_tracks.C 27225 2008-07-10 15:42:46Z mtadel $
+// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2008
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+// Import tracks from kinematics-tree / particle-stack.
+// Preliminary/minimal solution.
+
+#include "TParticlePDG.h"
+
+void
+kine_print(Double_t min_pt = 0, Double_t min_p = 0)
+{
+  AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
+  rl->LoadKinematics();
+  AliStack* stack = rl->Stack();
+  if (!stack) {
+    Error("kine_tracks.C", "can not get kinematics.");
+    return 0;
+  }
+
+  printf("\n");
+  printf("%4s | %-11s | %3s | %4s | %9s | %s %s\n",
+         "id", "name", "sts",
+         "mth", "dghtrs", "p", "P");
+  printf("------------------------------------------------------------\n");
+  Int_t N = stack->GetNtrack();
+  for (Int_t i=0; i<N; ++i)
+  {
+    TParticle* p = stack->Particle(i);
+    printf("%4d | %-11s | %3d | %4d | %4d %4d | %d %d\n",
+           i, p->GetName(), p->GetStatusCode(),
+           p->GetMother(0), p->GetDaughter(0), p->GetDaughter(1),
+           p->IsPrimary(), stack->IsPhysicalPrimary(i));
+  }
+}
index d8ddf0d..9bc5c28 100644 (file)
@@ -36,11 +36,12 @@ kine_tracks(Double_t min_pt  = 0,     Double_t min_p   = 0,
   gEve->AddElement(cont);
   Int_t count = 0;
   Int_t N = stack->GetNtrack();
-  for (Int_t i=0; i<N; ++i)
+  Int_t Np = stack->GetNprimary();
+  for (Int_t i = 0; i < Np; ++i)
   {
-    if (stack->IsPhysicalPrimary(i))
+    TParticle* p = stack->Particle(i);
+    if (p->GetStatusCode() <= 1)
     {
-      TParticle* p = stack->Particle(i);
       if (p->Pt() < min_pt && p->P() < min_p) continue;
 
       ++count;