]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
insert protection against missing pointer
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 Oct 2008 13:14:15 +0000 (13:14 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 Oct 2008 13:14:15 +0000 (13:14 +0000)
TRD/qaRec/AliTRDcheckDetector.cxx
TRD/qaRec/AliTRDrecoTask.cxx

index c24504198bd4a6100dad5236446e0f485590324e..56f922135b7928bce2e8c7c4de34590f612f1027 100644 (file)
@@ -339,12 +339,8 @@ TH1 *AliTRDcheckDetector::PlotNClusters(const AliTRDtrackV1 *track){
       Float_t momentum = 0.;
       Int_t pdg = 0;
       if(fMC){
-        const AliTrackReference *fRef = 0x0;
-        Int_t jti = 0;
-        while(!(fRef = fMC->GetTrackRef(jti++)) && (jti <=12));
-        if(fRef) momentum = fRef->P();
-/*           if(fMC->GetNTrackRefs()) momentum = fMC->GetTrackRefIter()->P();
-        pdg = fMC->GetPDG();*/
+             if(fMC->GetTrackRef()) momentum = fMC->GetTrackRef()->P();
+        pdg = fMC->GetPDG();
       }
       (*fDebugStream) << "NClusters"
         << "Detector="  << detector
@@ -473,12 +469,8 @@ TH1 *AliTRDcheckDetector::PlotPulseHeight(const AliTRDtrackV1 *track){
         Float_t momentum = 0.;
         Int_t pdg = 0;
         if(fMC){
-        const AliTrackReference *fRef = 0x0;
-          Int_t jti = 0;
-          while(!(fRef = fMC->GetTrackRef(jti++)) && (jti <=12));
-          if(fRef) momentum = fRef->P();
-/*                   if(fMC->GetNTrackRefs()) momentum = fMC->GetTrackRefIter()->P();
-          pdg = fMC->GetPDG();*/
+          if(fMC->GetTrackRef()) momentum = fMC->GetTrackRef()->P();
+          pdg = fMC->GetPDG();
         }
         (*fDebugStream) << "PulseHeight"
           << "Detector="       << detector
@@ -565,12 +557,8 @@ TH1 *AliTRDcheckDetector::PlotChargeDeposit(const AliTRDtrackV1 *track){
       Float_t momentum = 0.;
       Int_t pdg = 0;
       if(fMC){
-        const AliTrackReference *fRef = 0x0;
-        Int_t jti = 0;
-        while(!(fRef = fMC->GetTrackRef(jti++)) && (jti <=12));
-        if(fRef) momentum = fRef->P();
-/*           if(fMC->GetNTrackRefs()) momentum = fMC->GetTrackRefIter()->P();
-        pdg = fMC->GetPDG();*/
+             if(fMC->GetTrackRef()) momentum = fMC->GetTrackRef()->P();
+        pdg = fMC->GetPDG();
       }
       (*fDebugStream) << "ChargeDeposit"
         << "Detector="  << detector
index 1dbf9de05efbf31160074af33c51ec652d2787a7..86837a06dd413793545242155e9849932b8e62cf 100644 (file)
@@ -108,18 +108,25 @@ void AliTRDrecoTask::InitFunctorList()
     if(!name.BeginsWith("Plot")) continue;
     if(!fPlotFuncList) fPlotFuncList = new TList();
     fPlotFuncList->AddLast(new TMethodCall(c, (const char*)name, ""));
-    //printf("%s%s\n", m->GetName(), m->GetSignature());
+    printf("%s%s\n", m->GetName(), m->GetSignature());
   }
 }
 
 //_______________________________________________________
 Bool_t AliTRDrecoTask::Load(const Char_t *filename)
 {
-  if(!TFile::Open(filename)) return kFALSE;
-  TObjArray *o = (TObjArray*)gFile->Get(GetName());
+  if(!TFile::Open(filename)){
+    AliWarning(Form("Couldn't open file %s.", filename));
+    return kFALSE;
+  }
+  TObjArray *o = 0x0;
+  if(!(o = (TObjArray*)gFile->Get(GetName()))){
+    AliWarning("Missing histogram container.");
+    return kFALSE;
+  }
   fContainer = (TObjArray*)o->Clone(GetName());
   gFile->Close();
-  return kFALSE;
+  return kTRUE;
 }
 
 //_______________________________________________________