]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGPP/TPC/AliPerformanceRes.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGPP / TPC / AliPerformanceRes.cxx
index 6f9b941f9d8def4433aa62b91e27518a29b153b4..5c780b535eed4a189e8c75eefbec35622b11e982 100644 (file)
@@ -62,23 +62,7 @@ ClassImp(AliPerformanceRes)
 Double_t          AliPerformanceRes::fgkMergeEntriesCut=5000000.; //5*10**6 tracks (small default to keep default memory foorprint low)
 
 //_____________________________________________________________________________
-AliPerformanceRes::AliPerformanceRes():
-  AliPerformanceObject("AliPerformanceRes"),
-  fResolHisto(0),
-  fPullHisto(0),
-
-  // Cuts 
-  fCutsRC(0),  
-  fCutsMC(0),  
-
-  // histogram folder 
-  fAnalysisFolder(0)
-{
-  Init();
-}
-
-//_____________________________________________________________________________
-AliPerformanceRes::AliPerformanceRes(Char_t* name="AliPerformanceRes", Char_t* title="AliPerformanceRes",Int_t analysisMode=0,Bool_t hptGenerator=kFALSE):
+AliPerformanceRes::AliPerformanceRes(const Char_t* name, const Char_t* title, Int_t analysisMode, Bool_t hptGenerator):
   AliPerformanceObject(name,title),
   fResolHisto(0),
   fPullHisto(0),
@@ -118,7 +102,7 @@ void AliPerformanceRes::Init(){
 
   // set pt bins
   Int_t nPtBins = 50;
-  Double_t ptMin = 1.e-2, ptMax = 20.;
+  Double_t ptMin = 1.e-1, ptMax = 20.;
 
   Double_t *binsPt = 0;
 
@@ -140,7 +124,9 @@ void AliPerformanceRes::Init(){
   Double_t maxResolHisto[10]={ 1., 1., 0.03, 0.03, 0.2, yMax, zMax, 2.*TMath::Pi(), 1.5, ptMax};
 
   fResolHisto = new THnSparseF("fResolHisto","res_y:res_z:res_phi:res_lambda:res_pt:y:z:phi:eta:pt",10,binsResolHisto,minResolHisto,maxResolHisto);
-  fResolHisto->SetBinEdges(9,binsPt);
+
+  //fResolHisto->SetBinEdges(9,binsPt);
+  fResolHisto->GetAxis(9)->Set(nPtBins,binsPt);
 
   fResolHisto->GetAxis(0)->SetTitle("y-y_{mc} (cm)");
   fResolHisto->GetAxis(1)->SetTitle("z-z_{mc} (cm)");
@@ -161,9 +147,12 @@ void AliPerformanceRes::Init(){
   //fPullHisto = new THnSparseF("fPullHisto","pull_y:pull_z:pull_phi:pull_lambda:pull_1pt:y:z:eta:phi:pt",10,binsPullHisto,minPullHisto,maxPullHisto);
 
   //pull_y:pull_z:pull_snp:pull_tgl:pull_1pt:y:z:snp:tgl:1pt
-  Int_t binsPullHisto[10]={100,100,100,100,100,50,50,50,50,nPtBins};
-  Double_t minPullHisto[10]={-5.,-5.,-5.,-5.,-5.,yMin, zMin,-1., -2.0, ptMin};
-  Double_t maxPullHisto[10]={ 5., 5., 5., 5., 5., yMax, zMax, 1., 2.0, ptMax};
+  //Int_t binsPullHisto[10]={100,100,100,100,100,50,50,50,50,nPtBins};
+  //Double_t minPullHisto[10]={-5.,-5.,-5.,-5.,-5.,yMin, zMin,-1., -2.0, ptMin};
+  //Double_t maxPullHisto[10]={ 5., 5., 5., 5., 5., yMax, zMax, 1., 2.0, ptMax};
+  Int_t binsPullHisto[10]={100,100,100,100,100,50,50,50,50,20};
+  Double_t minPullHisto[10]={-5.,-5.,-5.,-5.,-5.,yMin, zMin,-1., -2.0, 0.};
+  Double_t maxPullHisto[10]={ 5., 5., 5., 5., 5., yMax, zMax, 1., 2.0, 10.};
   fPullHisto = new THnSparseF("fPullHisto","pull_y:pull_z:pull_y:pull_z:pull_snp:pull_tgl:pull_1pt:y:z:snp:tgl:1pt",10,binsPullHisto,minPullHisto,maxPullHisto);
 
   /*
@@ -181,6 +170,8 @@ void AliPerformanceRes::Init(){
   fPullHisto->Sumw2();
   */
 
+  fPullHisto->GetAxis(9)->Set(nPtBins,binsPt);
+
   fPullHisto->GetAxis(0)->SetTitle("(y-y_{mc})/#sigma");
   fPullHisto->GetAxis(1)->SetTitle("(z-z_{mc})/#sigma");
   fPullHisto->GetAxis(2)->SetTitle("(sin#phi-sin#phi_{mc})/#sigma");
@@ -239,7 +230,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 +340,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 +597,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;
 
@@ -634,9 +627,9 @@ void AliPerformanceRes::ProcessInnerTPC(AliMCEvent *const mcEvent, AliESDtrack *
   mclocal[2] = px*c + py*s;
   mclocal[3] =-px*s + py*c;
 
-  Double_t xyz[3] = {ref0->X(),ref0->Y(),ref0->Z()};
+  //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 +741,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;
 
@@ -936,10 +930,11 @@ void AliPerformanceRes::Exec(AliMCEvent* const mcEvent, AliESDEvent *const esdEv
     vtxESD = esdEvent->GetPrimaryVertexTracks();
        if(vtxESD && (vtxESD->GetStatus()<=0)) return;
   }
-  else {
-    // TPC track vertex
-    vtxESD = esdEvent->GetPrimaryVertexTPC();
-  }
+  // Coverity - removed else branch as vtxESD is not further used in method
+  //  else {  
+  //    // TPC track vertex
+  //    vtxESD = esdEvent->GetPrimaryVertexTPC();
+  //  }
  
 
 
@@ -1035,8 +1030,7 @@ void AliPerformanceRes::Analyse() {
       if(j!=8) fResolHisto->GetAxis(8)->SetRangeUser(-0.9,0.89); // eta window
       //if(j!=8) fResolHisto->GetAxis(8)->SetRangeUser(0.0,0.89); // eta window
       else fResolHisto->GetAxis(8)->SetRangeUser(-1.5,1.49);
-      fResolHisto->GetAxis(9)->SetRangeUser(0.16,100.); // pt threshold
-      if(GetAnalysisMode() == 3) fResolHisto->GetAxis(5)->SetRangeUser(-80.,80.); // y range
+      if(GetAnalysisMode() == 3) fResolHisto->GetAxis(5)->SetRangeUser(-80.,79.99); // y range
 
       h2D = (TH2F*)fResolHisto->Projection(i,j);
 
@@ -1069,14 +1063,14 @@ void AliPerformanceRes::Analyse() {
       aFolderObj->Add(h);
 
       fResolHisto->GetAxis(8)->SetRangeUser(-1.5,1.5);
-      fResolHisto->GetAxis(9)->SetRangeUser(0.0,10.);
+      fResolHisto->GetAxis(9)->SetRangeUser(0.1,100.);
 
       //
-      //if(j!=8) fPullHisto->GetAxis(8)->SetRangeUser(-0.9,0.89); // eta window
-      if(j!=8) fPullHisto->GetAxis(8)->SetRangeUser(0.0,0.89);    // eta window
+      if(j!=8) fPullHisto->GetAxis(8)->SetRangeUser(-0.9,0.89); // eta window
+      //if(j!=8) fPullHisto->GetAxis(8)->SetRangeUser(0.0,0.89);    // eta window
       else  fPullHisto->GetAxis(8)->SetRangeUser(-1.5,1.49);      // eta window
-      fPullHisto->GetAxis(9)->SetRangeUser(0.16,100.);            // pt threshold
-      if(GetAnalysisMode() == 3) fPullHisto->GetAxis(5)->SetRangeUser(-80.,80.); // y range
+      fPullHisto->GetAxis(9)->SetRangeUser(0.,9.99);            // 1./pt threshold
+      if(GetAnalysisMode() == 3) fPullHisto->GetAxis(5)->SetRangeUser(-80.,79.99); // y range
 
       h2D = (TH2F*)fPullHisto->Projection(i,j);