Handle missing rec-point tree in a uniform way: return null pointer to TEvePointSet.
[u/mrichter/AliRoot.git] / EVE / alice-macros / its_clusters.C
index 14921d450615290b84c0b3eeff4662dde0ddc75c..0ddcb13ef883e2fca6f160c1656a487fec6d4030 100644 (file)
@@ -4,21 +4,18 @@
 /**************************************************************************
  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 * 
+ * full copyright notice.                                                 *
  **************************************************************************/
 #ifdef __CINT__
 
-namespace TEveUtil
-{
 class TEveElement;
 class TEvePointSet;
-}
 
 #else
 
 #include <TEveManager.h>
 #include <TEvePointSet.h>
-#include <Alieve/AliEveEventManager.h>
+#include <EveBase/AliEveEventManager.h>
 
 #include <AliRunLoader.h>
 #include <AliCluster.h>
@@ -35,14 +32,16 @@ TEvePointSet* its_clusters(TEveElement* cont=0, Float_t maxR=50)
   rl->LoadRecPoints("ITS");
 
   TTree *cTree = rl->GetTreeR("ITS", false);
-
-  TEvePointSet* clusters = new TEvePointSet(10000);
-  clusters->SetOwnIds(kTRUE);
+  if (cTree == 0)
+    return 0;
 
   TClonesArray *cl = NULL;
   TBranch *branch  = cTree->GetBranch("ITSRecPoints");
   branch->SetAddress(&cl);
 
+  TEvePointSet* clusters = new TEvePointSet(10000);
+  clusters->SetOwnIds(kTRUE);
+
   Int_t nentr=(Int_t)cTree->GetEntries();
   for (Int_t i=0; i<nentr; i++) {
     if (!cTree->GetEvent(i)) continue;
@@ -64,7 +63,7 @@ TEvePointSet* its_clusters(TEveElement* cont=0, Float_t maxR=50)
   }
 
   if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
-    Warning("its_clusters", "No ITS clusters");
+    Warning("its_clusters.C", "No ITS clusters");
     delete clusters;
     return 0;
   }