]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGPP/TRD/AliTRDresolution.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGPP / TRD / AliTRDresolution.cxx
index 7e33ebf39ece89794acc87406331a35ca9e8c423..de5abda7b35cb2acdb2f983c1e50e3f83e630d2d 100644 (file)
@@ -31,8 +31,8 @@
 // 
 // For stand alone usage please refer to the following example: 
 // {  
-//   gSystem->Load("libANALYSIS.so");
-//   gSystem->Load("libTRDqaRec.so");
+//   gSystem->Load("libANALYSIS");
+//   gSystem->Load("libTRDqaRec");
 //   AliTRDresolution *res = new AliTRDresolution();
 //   //res->SetMCdata();
 //   //res->SetVerbose();
@@ -75,6 +75,7 @@
 #include "AliPID.h"
 #include "AliLog.h"
 #include "AliESDtrack.h"
+#include "AliESDHeader.h"
 #include "AliMathBase.h"
 #include "AliTrackPointArray.h"
 
@@ -453,7 +454,6 @@ TH1* AliTRDresolution::PlotCluster(const AliTRDtrackV1 *track)
   return H->Projection(kYrez);
 }
 
-
 //________________________________________________________
 TH1* AliTRDresolution::PlotTracklet(const AliTRDtrackV1 *track)
 {
@@ -635,11 +635,13 @@ TH1* AliTRDresolution::PlotTrackIn(const AliTRDtrackV1 *track)
   if(fkESD->IsElectron()) v0pid = -1;
   else if(fkESD->IsPion()) v0pid = 0;
   else if(fkESD->IsProton()) v0pid = 1;
-  if(DebugLevel()>=1 && v0pid>-2){
+  if(DebugLevel()>=1/* && v0pid>-2*/){
     Float_t tpc(fkESD->GetTPCdedx());
     Float_t tof(fkESD->GetTOFbeta());
+    Int_t ev(fEvent->GetEventHeader()->GetEventNumberInFile());
     AliTRDtrackV1 t(*fkTrack); t.SetOwner();
     (*DebugStream()) << "trackIn"
+      <<"ev="       << ev
       <<"pid="      << v0pid
       <<"tpc="      << tpc
       <<"tof="      << tof
@@ -818,6 +820,20 @@ TH1* AliTRDresolution::PlotMC(const AliTRDtrackV1 *track)
         val[kPrez]        = (TMath::ASin(tin->GetSnp())-TMath::ATan(dydx0))*TMath::RadToDeg();
         val[kNdim+1]      = 0.;//dx;
         if((H = (THnSparseI*)fContainer->At(kMCtrackIn))) H->Fill(val);
+        val[kBC]          = ily; // reset for subsequent components
+
+        if(DebugLevel()>=1 && exactPID>-2){
+          Float_t tpc(fkESD->GetTPCdedx());
+          Float_t tof(fkESD->GetTOFbeta());
+          AliTRDtrackV1 t(*fkTrack); t.SetOwner();
+          (*DebugStream()) << "MCtrackIn"
+            <<"pid="      << exactPID
+            <<"tpc="      << tpc
+            <<"tof="      << tof
+            <<"track.="   << &t
+            <<"trackIn.=" << tin
+            << "\n";
+        }
       }
     }
     //if(bc>1) break; // do nothing for the rest of TRD objects if satellite bunch
@@ -1582,6 +1598,7 @@ Bool_t AliTRDresolution::MakeProjectionCluster(Bool_t mc)
             +npad;
       ioff=isel*4;
     } else {
+      if(mc && ly<0) ly=0; // fix for bug in PlotMC
       isel = ly; ioff = isel;
     }
     if(ioff>=ih){
@@ -1870,6 +1887,7 @@ Bool_t AliTRDresolution::MakeProjectionTracklet(Bool_t mc)
     if(ac) cen = coord[kNdim]-1;
     // global selection
     if(ndim==kNdimTrklt){
+      if(mc && ly<0) ly=0; // fix for bug in PlotMC
       ioff = ly*3/*4*/;
       isel = ly;
     } else {
@@ -2772,6 +2790,7 @@ Bool_t AliTRDresolution::MakeProjectionTrack()
     v = H->GetBinContent(ib, coord);
     if(v<1.) continue;
     ly = coord[kBC]-1; // layer selection
+    if(ly<0) ly=0; // fix for bug in PlotMC
     // charge selection
     ch=0; sp=2;// [pi-] track [dafault]
     if(rcBin>0){ // debug mode in which species are also saved
@@ -2904,7 +2923,8 @@ Bool_t AliTRDresolution::PostProcess()
     AliWarning("Missing/Wrong data @ hTracklet2TRDin needed for infering pt/p segmentation.");
     return kFALSE;
   }
-  fNpt=H->GetAxis(kPt)->GetNbins()+1;
+  // protect for backward compatibility
+  fNpt=H->GetAxis(kPt)?(H->GetAxis(kPt)->GetNbins()+1):1;
   if(!MakeMomSegmentation()) return kFALSE;
 
   //PROCESS EXPERIMENTAL DISTRIBUTIONS