protection added
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Oct 2011 14:01:44 +0000 (14:01 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Oct 2011 14:01:44 +0000 (14:01 +0000)
PWG4/JetTasks/AliPWG4HighPtTrackQA.cxx

index 2aaf71f..b9025c0 100644 (file)
@@ -1524,13 +1524,10 @@ Float_t AliPWG4HighPtTrackQA::GetGGCChi2(AliESDtrack *origtrack) {
 
   AliESDtrack *esdtrackC = new AliESDtrack(*origtrack);
   if(esdtrackC) {
-    esdtrackC->Set(origtrack->GetConstrainedParam()->GetX(),origtrack->GetConstrainedParam()->GetAlpha(),origtrack->GetConstrainedParam()->GetParameter(),origtrack->GetConstrainedParam()->GetCovariance());
-    chi2GGC = (Float_t)origtrack->GetPredictedChi2(esdtrackC);
-    
-    /*
-    if(chi2GGC==0.)
-      cout << "origtrack: " << origtrack << "\tesdtrackC: " << esdtrackC << endl;
-    */
+    if(origtrack->GetConstrainedParam()) {
+      esdtrackC->Set(origtrack->GetConstrainedParam()->GetX(),origtrack->GetConstrainedParam()->GetAlpha(),origtrack->GetConstrainedParam()->GetParameter(),origtrack->GetConstrainedParam()->GetCovariance());
+      chi2GGC = (Float_t)origtrack->GetPredictedChi2(esdtrackC);
+    }
     delete esdtrackC;
   }