Fixing copy/paste erro. Additional protections
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Mar 2007 07:01:21 +0000 (07:01 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Mar 2007 07:01:21 +0000 (07:01 +0000)
PHOS/AliPHOSTrackSegmentMakerv1.cxx

index 59d9f1a700ac1b91949b5092e5de489fd289be61..fc7eef2a39c330371da955385faf52063faef268 100644 (file)
@@ -17,6 +17,9 @@
 /* History of cvs commits:
  *
  * $Log$
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.83  2007/03/06 21:07:37  kharlov
+ * DP: xz CPV-EMC distance filled to TS
+ *
  * Revision 1.82  2007/03/06 06:54:48  kharlov
  * DP:Calculation of cluster properties dep. on vertex added
  *
  * Revision 1.82  2007/03/06 06:54:48  kharlov
  * DP:Calculation of cluster properties dep. on vertex added
  *
@@ -539,19 +542,37 @@ void AliPHOSTrackSegmentMakerv1::EvalRecPoints(void)
   AliPHOSGetter * gime = AliPHOSGetter::Instance() ; 
   TClonesArray * digits = gime->Digits() ;
   AliPHOSClusterizer * cl = gime->Clusterizer() ;
   AliPHOSGetter * gime = AliPHOSGetter::Instance() ; 
   TClonesArray * digits = gime->Digits() ;
   AliPHOSClusterizer * cl = gime->Clusterizer() ;
-  Double_t w0=cl->GetEmcLogWeight() ;
   TObjArray * emcRecPoints = gime->EmcRecPoints() ; 
   TObjArray * emcRecPoints = gime->EmcRecPoints() ; 
-  for(Int_t i=0; i<emcRecPoints->GetEntriesFast() ; i++){
-    static_cast<AliPHOSEmcRecPoint*>(emcRecPoints->At(i))->EvalAll(w0,fVtx,digits) ;
+  if (!emcRecPoints) {
+    AliError("No CPV rec. points!");
+  }
+  else {
+    Double_t w0=cl->GetEmcLogWeight() ;
+    for(Int_t i=0; i<emcRecPoints->GetEntriesFast() ; i++){
+      AliPHOSEmcRecPoint * point = static_cast<AliPHOSEmcRecPoint*>(emcRecPoints->At(i));
+      if (point) point->EvalAll(w0,fVtx,digits) ;
+      else {
+       AliError(Form("No AliPHOSEmcRecPoint is found at %d",i));
+      }
+    }
+    emcRecPoints->Sort() ;
   }
   }
-  emcRecPoints->Sort() ;
 
 
-  TObjArray * cpvRecPoints = gime->CpvRecPoints() ; 
-  Double_t w0CPV=cl->GetCpvLogWeight() ;
-  for(Int_t i=0; i<emcRecPoints->GetEntriesFast() ; i++){
-    static_cast<AliPHOSCpvRecPoint*>(cpvRecPoints->At(i))->EvalAll(w0CPV,fVtx,digits) ;
+  TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+  if (!cpvRecPoints) {
+    AliError("No CPV rec. points!");
+  }
+  else {
+    Double_t w0CPV=cl->GetCpvLogWeight() ;
+    for(Int_t i=0; i<cpvRecPoints->GetEntriesFast() ; i++){
+      AliPHOSCpvRecPoint * point = static_cast<AliPHOSCpvRecPoint*>(cpvRecPoints->At(i));
+      if (point) point->EvalAll(w0CPV,fVtx,digits) ;
+      else {
+       AliError(Form("No AliPHOSCpvRecPoint is found at %d",i));
+      }
+    }
+    cpvRecPoints->Sort() ;
   }
   }
-  cpvRecPoints->Sort() ;
 
   //write recaculated RecPoints
   gime->WriteRecPoints("OVERWRITE");
 
   //write recaculated RecPoints
   gime->WriteRecPoints("OVERWRITE");