]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
coverity + TPC label (David Rohr)
authorjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Mar 2013 11:04:41 +0000 (11:04 +0000)
committerjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Mar 2013 11:04:41 +0000 (11:04 +0000)
PWGPP/TPC/AliPerformanceEff.cxx
PWGPP/TPC/AliPerformanceRes.cxx

index 3167a2a0ee86f0ae5a0421ae20c94537c18b3d1d..eeb3b936ee3ed30f254c8dd31be97df7dffa446a 100644 (file)
@@ -231,7 +231,7 @@ void AliPerformanceEff::ProcessTPC(AliMCEvent* const mcEvent, AliESDEvent *const
     if(!fUseKinkDaughters && track->GetKinkIndex(0) > 0) continue;
 
     //Int_t label = TMath::Abs(track->GetLabel()); 
-       Int_t label = track->GetLabel();
+       Int_t label = track->GetTPCLabel(); //Use TPC-only label for TPC-only efficiency analysis
     labelsAllRec[iTrack]=label;
 
     // TPC only
@@ -357,7 +357,7 @@ void AliPerformanceEff::ProcessTPCSec(AliMCEvent* const mcEvent, AliESDEvent *co
     if(!fUseKinkDaughters && track->GetKinkIndex(0) > 0) continue;
 
     //Int_t label = TMath::Abs(track->GetLabel());
-       Int_t label = track->GetLabel();
+       Int_t label = track->GetTPCLabel(); //Use TPC-only label for TPC-only efficiency analysis
     labelsAllRecSec[multAll]=label;
     multAll++;
 
@@ -508,7 +508,7 @@ void AliPerformanceEff::ProcessTPCITS(AliMCEvent* const mcEvent, AliESDEvent *co
     if(!fUseKinkDaughters && track->GetKinkIndex(0) > 0) continue;
 
     //Int_t label = TMath::Abs(track->GetLabel()); 
-       Int_t label = track->GetLabel(); 
+       Int_t label = track->GetLabel();  //Use global label for combined efficiency analysis
     labelsAllRecTPCITS[iTrack]=label;
 
     // iTPC+ITS
@@ -1386,8 +1386,11 @@ TH1D* AliPerformanceEff::AddHistoEff(Int_t axis, const Char_t *name, const Char_
       TH1D *rec = EffHisto->Projection(axis);
       recc = (TH1D*)rec->Clone();
 
-      recc->Divide(rec,all,1,1,"B");
-      recc->GetYaxis()->SetTitle("efficiency");
+      if(recc) 
+      {
+        recc->Divide(rec,all,1,1,"B");
+        recc->GetYaxis()->SetTitle("efficiency");
+      }
   }
   else if (type == 1) // Clone Rate
   {
@@ -1398,8 +1401,11 @@ TH1D* AliPerformanceEff::AddHistoEff(Int_t axis, const Char_t *name, const Char_
       TH1D *clone = WeightedProjection(EffHisto, axis, 1, &axis_clone);
       recc = (TH1D*) clone->Clone();
 
-      recc->Divide(clone,all,1,1,"B");
-      recc->GetYaxis()->SetTitle("clone rate");
+      if(recc) 
+      {
+        recc->Divide(clone,all,1,1,"B");
+        recc->GetYaxis()->SetTitle("clone rate");
+      }
   }
   else if (type == 2) // Fake Rate
   {
@@ -1410,8 +1416,11 @@ TH1D* AliPerformanceEff::AddHistoEff(Int_t axis, const Char_t *name, const Char_
       TH1D *fake = WeightedProjection(EffHisto, axis, 1, &axis_fake);
       recc = (TH1D*) fake->Clone();
 
-      recc->Divide(fake,all,1,1,"B");
-      recc->GetYaxis()->SetTitle("fake rate");
+      if(recc) 
+      {
+        recc->Divide(fake,all,1,1,"B");
+        recc->GetYaxis()->SetTitle("fake rate");
+      }
   }
 
   EffHisto->GetAxis(4)->SetRange(1,0);                         //Reset Range
index 7d6afbd28982687d823a1e8e9f14aea098993969..2357f95dd655abc41fb4de9ae415713b34122d83 100644 (file)
@@ -239,7 +239,8 @@ void AliPerformanceRes::ProcessTPC(AliStack* const stack, AliESDtrack *const esd
   // Fill rec vs MC information
   //
   if(!stack) return;
-  Int_t label = TMath::Abs(esdTrack->GetLabel()); 
+  Int_t label = esdTrack->GetTPCLabel(); //Use TPC-only label for TPC-only resolution analysis
+  if (label <= 0) return;
   TParticle* particle = stack->Particle(label);
   if(!particle) return;
   if(!particle->GetPDG()) return;
@@ -348,7 +349,7 @@ void AliPerformanceRes::ProcessTPCITS(AliStack* const stack, AliESDtrack *const
   //
   if(!stack) return;
 
-  Int_t label = TMath::Abs(esdTrack->GetLabel()); 
+  Int_t label = TMath::Abs(esdTrack->GetLabel()); //Use global label for combined resolution analysis
   TParticle* particle = stack->Particle(label);
   if(!particle) return;
   if(!particle->GetPDG()) return;
@@ -605,7 +606,8 @@ void AliPerformanceRes::ProcessInnerTPC(AliMCEvent *const mcEvent, AliESDtrack *
   //
   if(!mcEvent) return;
 
-  Int_t label = TMath::Abs(esdTrack->GetLabel()); 
+  Int_t label = esdTrack->GetTPCLabel(); //Use TPC-only label for TPC-only resolution analysis
+  if (label <= 0) return;
   AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(label);
   if(!mcParticle) return;
 
@@ -636,7 +638,7 @@ void AliPerformanceRes::ProcessInnerTPC(AliMCEvent *const mcEvent, AliESDtrack *
 
   Double_t xyz[3] = {ref0->X(),ref0->Y(),ref0->Z()};
   // propagate track to the radius of the first track reference within TPC
-  Double_t trRadius = TMath::Sqrt(xyz[1] * xyz[1] + xyz[0] * xyz[0]);
+  //Double_t trRadius = TMath::Sqrt(xyz[1] * xyz[1] + xyz[0] * xyz[0]);
   Double_t field[3]; track->GetBxByBz(field);
   if (TGeoGlobalMagField::Instance()->GetField() == NULL) {
     Error("ProcessInnerTPC", "Magnetic Field not set");
@@ -748,7 +750,8 @@ void AliPerformanceRes::ProcessOuterTPC(AliMCEvent *const mcEvent, AliESDtrack *
   //
   if(!mcEvent) return;
 
-  Int_t label = TMath::Abs(esdTrack->GetLabel()); 
+  Int_t label = esdTrack->GetTPCLabel(); //Use TPC-only label for TPC-only resolution analysis
+  if (label <= 0) return;
   AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(label);
   if(!mcParticle) return;