]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
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 5d1ac09b5399158febbe10fb556a12d3067b9826..8f90458f54f5fe322e67a15e3a1b7c832a1023f2 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 ca1073e833b1d3ccec1c83e230b1cb209ddcf1a5..97dc1648042fbdccd9954495e11ff9e91da15c0c 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());