From 2047680a377ee7127450273a135bae593a32114b Mon Sep 17 00:00:00 2001 From: snelling Date: Mon, 26 Dec 2011 10:14:08 +0000 Subject: [PATCH] coverity + some patch for pp --- PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.cxx | 1 + PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx | 1 + PWG2/FLOW/AliFlowCommon/AliFlowVector.cxx | 1 + PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx | 2 +- PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberMC.cxx | 1 + .../AliFlowTools/glauberMC/AliGlauberNucleus.cxx | 1 + PWG2/FLOW/macros/runFlowTaskCentralityPIDTrain.C | 42 +++++++------------ 7 files changed, 22 insertions(+), 27 deletions(-) diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.cxx b/PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.cxx index 221537d..285a583 100644 --- a/PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.cxx +++ b/PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.cxx @@ -112,6 +112,7 @@ AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& anEvent): AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEvent) { //assignment operator + if (&anEvent==this) return *this; //check self-assignment if (fTrackCollection) fTrackCollection->Delete(); delete fTrackCollection; fTrackCollection = (TObjArray*)(anEvent.fTrackCollection)->Clone(); //deep copy diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx b/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx index 005507b..a3d69f3 100644 --- a/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx +++ b/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx @@ -116,6 +116,7 @@ AliFlowTrackSimple* AliFlowTrackSimple::Clone(const char* /*option*/) const AliFlowTrackSimple& AliFlowTrackSimple::operator=(const AliFlowTrackSimple& aTrack) { //assignment + if (&aTrack==this) return *this; //handle self assignmnet fEta = aTrack.fEta; fPt = aTrack.fPt; fPhi = aTrack.fPhi; diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowVector.cxx b/PWG2/FLOW/AliFlowCommon/AliFlowVector.cxx index 121a35b..483446b 100644 --- a/PWG2/FLOW/AliFlowCommon/AliFlowVector.cxx +++ b/PWG2/FLOW/AliFlowCommon/AliFlowVector.cxx @@ -63,6 +63,7 @@ AliFlowVector::~AliFlowVector() AliFlowVector& AliFlowVector::operator=(const AliFlowVector& aVector) { // assignement operator + if (this==&aVector) return *this; fX = aVector.X(); fY = aVector.Y(); fMult = aVector.GetMult(); diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx b/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx index 537095c..63602a8 100644 --- a/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx +++ b/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx @@ -384,7 +384,7 @@ Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event) nselected++; } } - meanpt=meanpt/nselected; + if (nselected) meanpt=meanpt/nselected; if (meanpt= fMeanPtMax) pass=kFALSE; } if (fQA&&pass) diff --git a/PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberMC.cxx b/PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberMC.cxx index 69300f9..8096831 100644 --- a/PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberMC.cxx +++ b/PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberMC.cxx @@ -317,6 +317,7 @@ AliGlauberMC::AliGlauberMC(const AliGlauberMC& in): AliGlauberMC& AliGlauberMC::operator=(const AliGlauberMC& in) { //assignment + if (&in==this) return *this; fANucleus=in.fANucleus; fBNucleus=in.fBNucleus; fXSect=in.fXSect; diff --git a/PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberNucleus.cxx b/PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberNucleus.cxx index 2fd7ae2..b1271d6 100644 --- a/PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberNucleus.cxx +++ b/PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberNucleus.cxx @@ -85,6 +85,7 @@ AliGlauberNucleus::AliGlauberNucleus(const AliGlauberNucleus& in): AliGlauberNucleus& AliGlauberNucleus::operator=(const AliGlauberNucleus& in) { //assignment + if (&in==this) return *this; fN=in.fN; fR=in.fR; fA=in.fA; diff --git a/PWG2/FLOW/macros/runFlowTaskCentralityPIDTrain.C b/PWG2/FLOW/macros/runFlowTaskCentralityPIDTrain.C index a87d3b5..c871992 100644 --- a/PWG2/FLOW/macros/runFlowTaskCentralityPIDTrain.C +++ b/PWG2/FLOW/macros/runFlowTaskCentralityPIDTrain.C @@ -1,12 +1,4 @@ enum anaModes {mLocal,mPROOF,mGrid}; -//mLocal: Analyze locally files in your computer using aliroot -//mPROOF: Analyze CAF files with PROOF -//mGrid: Analyze files on Grid via AliEn plug-in and using precompiled FLOW libraries - -// CENTRALITY DEFINITION -//Int_t binfirst = 4; //where do we start numbering bins -//Int_t binlast = 6; //where do we stop numbering bins -//const Int_t numberOfCentralityBins = 9; Int_t binfirst = 0; //where do we start numbering bins Int_t binlast = 8; //where do we stop numbering bins const Int_t numberOfCentralityBins = 9; @@ -15,13 +7,9 @@ Float_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,6 TString commonOutputFileName = "outputCentrality"; // e.g.: result for centrality bin 0 will be in the file "outputCentrality0.root", etc -//void runFlowTaskCentralityPIDTrain(Int_t mode=mLocal, Int_t nEvents = 10, -//Bool_t DATA = kFALSE, const Char_t* dataDir="/Users/snelling/alice_data/Therminator_midcentral", Int_t offset = 0) - void runFlowTaskCentralityPIDTrain( Int_t mode = mGrid, Bool_t useFlowParFiles = kTRUE, Bool_t DATA = kTRUE, - //const Char_t* dataDir="/data/alice2/ab/grid/21-16/TEST/data/", const Char_t* dataDir="fileList", Int_t nEvents = 1e4, Int_t offset=0 ) @@ -29,8 +17,6 @@ void runFlowTaskCentralityPIDTrain( Int_t mode = mGrid, // Time: TStopwatch timer; timer.Start(); - // Cross-check user settings before starting: - // CrossCheckUserSettings(DATA); // Load needed libraries: LoadLibraries(mode,useFlowParFiles); @@ -74,6 +60,10 @@ void runFlowTaskCentralityPIDTrain( Int_t mode = mGrid, if (!DATA) centSelTask->SetMCInput(); if (DATA) centSelTask->SetPass(1); + //add the PID response task + gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); + AliAnalysisTaskPIDResponse* pidresponsetask = AddTaskPIDResponse(!DATA) + //Add the TOF tender gROOT->LoadMacro("$ALICE_ROOT/PWG2/FLOW/macros/AddTaskTenderTOF.C"); AddTaskTenderTOF(); @@ -88,73 +78,73 @@ void runFlowTaskCentralityPIDTrain( Int_t mode = mGrid, highCentralityBinEdge, commonOutputFileName, AliPID::kPion, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, -1,2,kTRUE ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kPion, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, 1,2,kTRUE ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kKaon, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, -1,2,kTRUE ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kKaon, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, 1,2,kTRUE ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kProton, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, -1,2,kTRUE ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kProton, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, 1,2,kTRUE ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kPion, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, -1,3 ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kPion, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, 1,3 ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kKaon, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, -1,3 ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kKaon, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, 1,3 ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kProton, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, -1,3 ); AddTaskFlowCentralityPID( lowCentralityBinEdge, highCentralityBinEdge, commonOutputFileName, AliPID::kProton, - AliFlowTrackCuts::kTOFbetaSimple, + AliFlowTrackCuts::kTOFbeta, 1,3 ); } // end of for (Int_t i=0; i