]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGHF/hfe/AliHFEdebugTreeTask.cxx
Fix of sigmaZ for crossing tracklets from Alex
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEdebugTreeTask.cxx
index 194441cd44d52739dc42103adbb961e7c5f37f7a..bc15d26c0585a64e6fd2c7db0fd82d1fc29af2ab 100644 (file)
@@ -34,6 +34,7 @@
 #include "AliMCEvent.h"
 #include "AliMCEventHandler.h"
 #include "AliMCParticle.h"
+#include "AliStack.h"
 #include "AliPIDResponse.h"
 #include "AliTrackReference.h"
 #include "AliVEvent.h"
@@ -165,6 +166,13 @@ void AliHFEdebugTreeTask::UserExec(Option_t *){
     fSignalCuts->SetMCEvent(fMCEvent);
   }
 
+  // MC get stack
+  AliStack* stack = 0x0;
+  if(mcthere){
+      stack = fMCEvent->Stack();
+      if(!stack) AliError("No Stack");
+  }
+
   // Get Primary Vertex
   const AliVVertex *vertex = fInputEvent->GetPrimaryVertex();
   Double_t vtx[3];
@@ -194,6 +202,7 @@ void AliHFEdebugTreeTask::UserExec(Option_t *){
                 << "Centrality="              << centrality
                 << "VertexZ="                 << vtx[2]
                 << "NumberOfContributors="    << ncontrib
+                << "run="                     << run
                 << "\n";
 
   // Common variables
@@ -462,11 +471,16 @@ void AliHFEdebugTreeTask::UserExec(Option_t *){
     Double_t chi2PerClusterITS = 0.0;
     if (nclustersITS != 0) chi2PerClusterITS = track->GetITSchi2() / Float_t(nclustersITS);
     // TPC number of clusters (different definitions)
-    UChar_t nclustersTPC = track->GetTPCncls();
+    UChar_t nclustersTPCfit = track->GetTPCNcls();
+    UChar_t nclustersTPCall = 0;
+    const TBits &clusterTPC = track->GetTPCClusterMap();
+    nclustersTPCall = clusterTPC.CountBits();
     UChar_t nclustersTPCPID = track->GetTPCsignalN();
     UChar_t nfindableTPC =  track->GetTPCNclsF();
-    Double_t clusterRatioTPC = 0.0;
-    if((static_cast<Double_t>(nfindableTPC))>0.0) clusterRatioTPC = static_cast<Double_t>(nclustersTPC)/static_cast<Double_t>(nfindableTPC);
+    Double_t clusterRatioTPCfit = 0.0;
+    if((static_cast<Double_t>(nfindableTPC))>0.0) clusterRatioTPCfit = static_cast<Double_t>(nclustersTPCfit)/static_cast<Double_t>(nfindableTPC);
+    Double_t clusterRatioTPCall = 0.0;
+    if((static_cast<Double_t>(nfindableTPC))>0.0) clusterRatioTPCall = static_cast<Double_t>(nclustersTPCall)/static_cast<Double_t>(nfindableTPC);
     UChar_t nclustersTPCshared = 0;
     Float_t ncrossedRowsTPC = track->GetTPCCrossedRows();
     const TBits &sharedTPC = track->GetTPCSharedMap();
@@ -475,7 +489,7 @@ void AliHFEdebugTreeTask::UserExec(Option_t *){
     UChar_t nclustersTRD = track->GetTRDncls();
     UChar_t ntrackletsTRDPID = track->GetTRDntrackletsPID();
     // ITS and TRD acceptance maps
-    UChar_t hasClusterITS[6], statusITS[5], hasTrackletTRD[6];
+    UChar_t hasClusterITS[6], statusITS[6], hasTrackletTRD[6];
     UChar_t itsPixel = track->GetITSClusterMap();
     for(Int_t icl = 0; icl < 6; icl++){ 
       hasClusterITS[icl] = TESTBIT(itsPixel, icl) ? 1 : 0;
@@ -520,6 +534,34 @@ void AliHFEdebugTreeTask::UserExec(Option_t *){
     tofdx=track->GetTOFsignalDx();
     tofdz=track->GetTOFsignalDz();
 
+    // TOF track status
+    UInt_t status = 0;
+    status = track->GetStatus();
+    Bool_t hasTOFout  = status&AliESDtrack::kTOFout; 
+    Bool_t hasTOFtime = status&AliESDtrack::kTIME;
+    Bool_t hasTOFpid  = status&AliESDtrack::kTOFpid;
+    Bool_t hasgoodTOF     = kFALSE;
+    if (hasTOFout && hasTOFtime && hasTOFpid) hasgoodTOF = kTRUE;
+
+    // TRD track status
+    Bool_t hasTRDin = status&AliESDtrack::kTRDin;
+
+
+    // TOF mismatch (particle spectra group)
+    Int_t mismatchlevel=0; // default value; in data always 0
+    if(mcthere){
+       Int_t tofLabel[3];
+       track->GetTOFLabel(tofLabel);
+        if(TMath::Abs(track->GetLabel()) != TMath::Abs(tofLabel[0]) || tofLabel[1] > 0) mismatchlevel=1;
+       TParticle *matchedTrack = stack->Particle(TMath::Abs(tofLabel[0]));
+       if(TMath::Abs(matchedTrack->GetFirstMother()) == TMath::Abs(track->GetLabel()))
+       {
+           if(mismatchlevel==1) mismatchlevel=3;
+            else mismatchlevel=2;
+       }
+    }
+
+
     // Fill Tree
     (*fDebugTree) << "PIDdebug"
                   << "centrality="          << centrality
@@ -545,11 +587,13 @@ void AliHFEdebugTreeTask::UserExec(Option_t *){
                   << "eta="                 << eta
                   << "phi="                 << phi
                   << "ntracklets="          << ntrackletsTRDPID
-                  << "nclustersTPC="        << nclustersTPC
+                  << "nclustersTPC="        << nclustersTPCfit
+                 << "nclustersTPCall="     << nclustersTPCall
                   << "nclustersTPCPID="     << nclustersTPCPID
                   << "nclustersTPCshared="  << nclustersTPCshared
                   << "ncrossedRowsTPC="     << ncrossedRowsTPC
-                  << "clusterRatioTPC="     << clusterRatioTPC
+                  << "clusterRatioTPC="     << clusterRatioTPCfit
+                  << "clusterRatioTPCall="  << clusterRatioTPCall
                   << "nclustersITS="        << nclustersITS
                   << "nclusters="           << nclustersTRD
                   << "chi2matching="        << chi2matching
@@ -599,7 +643,10 @@ void AliHFEdebugTreeTask::UserExec(Option_t *){
                   << "vy="                  << vtx[1]
                   << "vz="                  << vtx[2]
                   << "tofdx="                << tofdx
-                  << "tofdz="                << tofdz
+                 << "tofdz="                << tofdz
+                  << "statusTOFtracking="   << hasgoodTOF
+                  << "TOFmismatchlevel="    << mismatchlevel
+                  << "statusTRDtracking="   << hasTRDin
                   << "ncontrib="            << ncontrib
                   << "mesonID="             << mesonID
                   << "eR="                  << eR