coverity + some patch for pp
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Dec 2011 10:14:08 +0000 (10:14 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Dec 2011 10:14:08 +0000 (10:14 +0000)
PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.cxx
PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx
PWG2/FLOW/AliFlowCommon/AliFlowVector.cxx
PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx
PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberMC.cxx
PWG2/FLOW/AliFlowTools/glauberMC/AliGlauberNucleus.cxx
PWG2/FLOW/macros/runFlowTaskCentralityPIDTrain.C

index 221537d..285a583 100644 (file)
@@ -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
index 005507b..a3d69f3 100644 (file)
@@ -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;
index 121a35b..483446b 100644 (file)
@@ -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();
index 537095c..63602a8 100644 (file)
@@ -384,7 +384,7 @@ Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event)
         nselected++;
       }
     }
-    meanpt=meanpt/nselected;
+    if (nselected) meanpt=meanpt/nselected;
     if (meanpt<fMeanPtMin || meanpt >= fMeanPtMax) pass=kFALSE;
   }
   if (fQA&&pass) 
index 69300f9..8096831 100644 (file)
@@ -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;
index 2fd7ae2..b1271d6 100644 (file)
@@ -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;
index a87d3b5..c871992 100644 (file)
@@ -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<numberOfCentralityBins; i++)