Fixes from Coverity(15969,15968,15967,15964,15963,15962,15961,10283)
authormvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Jan 2011 11:52:11 +0000 (11:52 +0000)
committermvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Jan 2011 11:52:11 +0000 (11:52 +0000)
ANALYSIS/EventMixing/AliAnalysisTaskMixInfo.cxx
ANALYSIS/EventMixing/AliMixEventPool.cxx
ANALYSIS/EventMixing/AliMixInfo.cxx
ANALYSIS/EventMixing/AliMixInputEventHandler.cxx

index c6bfcd6..c930e74 100644 (file)
@@ -92,10 +92,10 @@ void AliAnalysisTaskMixInfo::UserExec(Option_t *)
          } else {
             fMixInfo->FillHistogram(AliMixInfo::kMainEvents, mixEH->CurrentBinIndex());
          }
-      }
+
       if (mixEH->CurrentEntryMix() >= 0)
          AliDebug(AliLog::kDebug + 1, Form("Main %lld %d [%lld,%lld] %d", mixEH->CurrentEntry(), mixEH->NumberMixed(), mixEH->CurrentEntryMain(), mixEH->CurrentEntryMix(), mixEH->NumberMixed()));
-
+      }
    }
    // Post output data.
    PostData(1, fOutputList);
@@ -109,14 +109,13 @@ void AliAnalysisTaskMixInfo::UserExecMix(Option_t *)
    AliMultiInputEventHandler *inEvHMain = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());
    if (inEvHMain) {
       AliMixInputEventHandler *mixEH = dynamic_cast<AliMixInputEventHandler *>(inEvHMain->GetFirstMultiInputHandler());
-
+      if (!mixEH) return;
       if (fMixInfo) fMixInfo->FillHistogram(AliMixInfo::kMixedEvents, mixEH->CurrentBinIndex());
-      if (!mixEH || mixEH->CurrentEntryMix() < 0) {
+      if (mixEH->CurrentEntryMix() < 0) {
          AliError("Mix entry is -1 and it should not happen !!!!!");
          return ;
       }
-      if (mixEH)
-         AliDebug(AliLog::kDebug, Form("Mixing %lld %d [%lld,%lld] %d", mixEH->CurrentEntry(), mixEH->NumberMixed(), mixEH->CurrentEntryMain(), mixEH->CurrentEntryMix(), mixEH->CurrentBinIndex()));
+      AliDebug(AliLog::kDebug, Form("Mixing %lld %d [%lld,%lld] %d", mixEH->CurrentEntry(), mixEH->NumberMixed(), mixEH->CurrentEntryMain(), mixEH->CurrentEntryMix(), mixEH->CurrentBinIndex()));
    }
    // Post output data.
    PostData(1, fOutputList);
index 79e4884..cd7b47d 100644 (file)
@@ -126,6 +126,7 @@ void AliMixEventPool::CreateEntryListsRecursivly(Int_t index)
    if (index >= 0) {
       AliDebug(AliLog::kDebug, Form("index = %d", index));
       cut = dynamic_cast<AliMixEventCutObj *>(fListOfEventCuts.At(index));
+      if (!cut) return;
       cut->Reset();
       while (cut->HasMore()) {
          cut->AddStep();
@@ -258,6 +259,8 @@ void AliMixEventPool::SetCutValuesFromBinIndex(Int_t index)
 
    if (index < 0 || index >= timesNum) {
       AliError(Form("index=%d is out of range !!!", index));
+      delete [] lenght;
+      delete [] indexes;
       return;
    }
 
index 6a1b3e7..402c75a 100644 (file)
@@ -205,17 +205,16 @@ void AliMixInfo::Draw(Option_t* option)
    Int_t cols[4] = { kYellow, kViolet, kRed, kGreen  };
    style->SetPalette(4, cols);
    cMain->cd(2);
+//    cMain->SetGrid();
+   if (hMixInfo2D){
    hMixInfo2D->SetMaximum(4);
    hMixInfo2D->SetStats(0);
    hMixInfo2D->SetTitle("");
    hMixInfo2D->GetXaxis()->SetNdivisions(510);
    hMixInfo2D->GetYaxis()->SetNdivisions(0);
+   }
 
-   cMain->SetGrid();
-//     hMixInfo2D->SetBarWidth(1);
-//     hMixInfo2D->SetLineColor(kBlack);
-//     hMixInfo2D->SetLineWidth(11);
-   hMixInfo2D->Draw(Form("COL %s", option));
+   if (hMixInfo2D) hMixInfo2D->Draw(Form("COL %s", option));
 //
 //     TLegend *legend = new TLegend(0.55,0.65,0.76,0.82);
 //     legend->AddEntry(hOK,"OK","f");
@@ -232,6 +231,8 @@ void AliMixInfo::DynamicExec(AliMixInfo *const mixInfo)
    // Function which is run when user move mouse over mix info
    //
 
+  if (!mixInfo) return;
+
    TObject *select = gPad->GetSelected();
    if (!select) return;
    if (!select->InheritsFrom(TH2I::Class())) {
index c3d2abf..7f66a83 100644 (file)
@@ -319,6 +319,7 @@ Bool_t AliMixInputEventHandler::MixBuffer()
    AliInputEventHandler *eh = 0;
    TObjArrayIter next(&fInputHandlers);
    while ((eh = (AliInputEventHandler *) next())) {
+      if (!eh) continue;
       if (fEventPool && fEventPool->GetListOfEventCuts()->GetEntries() > 0) {
          entryMix = -1;
          if (elNum >= fBufferSize) {