tpc_clusters.C - return null pointer if tree can be obtained from run-loader.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 May 2008 11:32:03 +0000 (11:32 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 May 2008 11:32:03 +0000 (11:32 +0000)
visscan_init.C - handle null pointers returned from xyz_clusters.C.

EVE/alice-macros/tpc_clusters.C
EVE/alice-macros/visscan_init.C

index 5d1ac09..8f90458 100644 (file)
@@ -30,19 +30,22 @@ TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
 
   AliEveEventManager::AssertGeometry();
 
-  TEvePointSet* clusters = new TEvePointSet(kMaxCl);
-  clusters->SetOwnIds(kTRUE);
-
   AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
   rl->LoadRecPoints("TPC");
 
-  AliTPCClustersRow *clrow=new AliTPCClustersRow();
+  TTree *cTree = rl->GetTreeR("TPC", false);
+  if (cTree == 0)
+    return 0;
+
+  AliTPCClustersRow *clrow = new AliTPCClustersRow();
   clrow->SetClass("AliTPCclusterMI");
   clrow->SetArray(kMaxCl);
-
-  TTree *cTree = rl->GetTreeR("TPC", false);
   cTree->SetBranchAddress("Segment", &clrow);
 
+  TEvePointSet* clusters = new TEvePointSet(kMaxCl);
+  clusters->SetOwnIds(kTRUE);
+
+
   Float_t maxRsqr = maxR*maxR;
   Int_t nentr=(Int_t)cTree->GetEntries();
   for (Int_t i=0; i<nentr; i++)
index ca1073e..97dc164 100644 (file)
@@ -94,15 +94,21 @@ void on_new_event()
 {
   try {
     TEvePointSet* itsc = its_clusters();
-    itsc->SetMarkerColor(5);
+    if (itsc) {
+      itsc->SetMarkerColor(5);
+    }
 
     TEvePointSet* tpcc = tpc_clusters();
-    tpcc->SetMarkerColor(4);
+    if (tpcc) {
+      tpcc->SetMarkerColor(4);
+    }
 
     TEvePointSet* trdc = trd_clusters();
-    trdc->SetMarkerColor(7);
-    trdc->SetMarkerStyle(4);
-    trdc->SetMarkerSize(0.5);
+    if (trdc) {
+      trdc->SetMarkerColor(7);
+      trdc->SetMarkerStyle(4);
+      trdc->SetMarkerSize(0.5);
+    }
   }
   catch(TEveException& exc) {
     printf("Exception loading ITS/TPC clusters: %s\n", exc.Data());