- Proper handling of tuneOnData mask for TPC PID response in case of MC
authorbhess <bhess@cern.ch>
Tue, 11 Mar 2014 08:42:09 +0000 (09:42 +0100)
committermvl <marco.van.leeuwen@cern.ch>
Tue, 11 Mar 2014 11:26:23 +0000 (12:26 +0100)
PWGJE/UserTasks/AliAnalysisTaskIDFragmentationFunction.cxx
PWGJE/UserTasks/AliAnalysisTaskPID.cxx

index 399e146..677d4c0 100644 (file)
@@ -2699,6 +2699,7 @@ void AliAnalysisTaskIDFragmentationFunction::UserExec(Option_t *)
     (char*)__FILE__,__LINE__,nTCutsEfficiency,nRecPartCutsEfficiency);
   
   AliPIDResponse* pidResponse = 0x0;
+  Bool_t tuneOnDataTPC = kFALSE;
   if (fUseJetPIDtask || fUseInclusivePIDtask) {
     if (!inputHandler) {
       AliFatal("Input handler needed");
@@ -2711,6 +2712,10 @@ void AliAnalysisTaskIDFragmentationFunction::UserExec(Option_t *)
         AliFatal("PIDResponse object was not created");
         return;
       }
+      else {
+        tuneOnDataTPC = pidResponse->IsTunedOnData() &&
+                        ((pidResponse->GetTunedOnDataMask() & AliPIDResponse::kDetTPC) == AliPIDResponse::kDetTPC);
+      }
     }
   }
   
@@ -2784,8 +2789,8 @@ void AliAnalysisTaskIDFragmentationFunction::UserExec(Option_t *)
           // fill inclusive tracks XXX, they have the same track cuts!
           AliAODTrack * inclusiveaod  = dynamic_cast<AliAODTrack*>(fTracksRecCutsEfficiency->At(it));
           if(inclusiveaod){
-            Double_t dEdxTPC = pidResponse->IsTunedOnData() ? pidResponse->GetTPCsignalTunedOnData(inclusiveaod) 
-                                                            : inclusiveaod->GetTPCsignal();
+            Double_t dEdxTPC = tuneOnDataTPC ? pidResponse->GetTPCsignalTunedOnData(inclusiveaod) 
+                                             : inclusiveaod->GetTPCsignal();
             
             if (dEdxTPC <= 0)
               continue;
@@ -2860,8 +2865,8 @@ void AliAnalysisTaskIDFragmentationFunction::UserExec(Option_t *)
         AliAODTrack * inclusiveaod  = dynamic_cast<AliAODTrack*>(fTracksRecCuts->At(it));
         if(inclusiveaod){
           if(fUseInclusivePIDtask){
-            Double_t dEdxTPC = pidResponse->IsTunedOnData() ? pidResponse->GetTPCsignalTunedOnData(inclusiveaod)
-                                                            : inclusiveaod->GetTPCsignal();
+            Double_t dEdxTPC = tuneOnDataTPC ? pidResponse->GetTPCsignalTunedOnData(inclusiveaod)
+                                             : inclusiveaod->GetTPCsignal();
             
             if (dEdxTPC <= 0)
               continue;
@@ -3186,8 +3191,8 @@ void AliAnalysisTaskIDFragmentationFunction::UserExec(Option_t *)
       }
          
       if (fUseJetPIDtask) {
-        Double_t dEdxTPC = pidResponse->IsTunedOnData() ? pidResponse->GetTPCsignalTunedOnData(aodtrack)
-                                                        : aodtrack->GetTPCsignal();
+        Double_t dEdxTPC = tuneOnDataTPC ? pidResponse->GetTPCsignalTunedOnData(aodtrack)
+                                         : aodtrack->GetTPCsignal();
         
         if (dEdxTPC <= 0)
           continue;
index 750597f..4c2b20f 100644 (file)
@@ -978,7 +978,9 @@ void AliAnalysisTaskPID::UserExec(Option_t *)
     
     
     // Apply detector level track cuts
-    Double_t dEdxTPC = fPIDResponse->IsTunedOnData() ? fPIDResponse->GetTPCsignalTunedOnData(track) : track->GetTPCsignal();
+    const Bool_t tuneOnDataTPC = fPIDResponse->IsTunedOnData() &&
+                                 ((fPIDResponse->GetTunedOnDataMask() & AliPIDResponse::kDetTPC) == AliPIDResponse::kDetTPC);
+    Double_t dEdxTPC = tuneOnDataTPC ? fPIDResponse->GetTPCsignalTunedOnData(track) : track->GetTPCsignal();
     if (dEdxTPC <= 0)
       continue;
     
@@ -2142,7 +2144,9 @@ Bool_t AliAnalysisTaskPID::ProcessTrack(const AliVTrack* track, Int_t particlePD
   Double_t trackCharge = track->Charge();
   
   // TPC signal
-  Double_t dEdxTPC = fPIDResponse->IsTunedOnData() ? fPIDResponse->GetTPCsignalTunedOnData(track) : track->GetTPCsignal();
+  const Bool_t tuneOnDataTPC = fPIDResponse->IsTunedOnData() &&
+                               ((fPIDResponse->GetTunedOnDataMask() & AliPIDResponse::kDetTPC) == AliPIDResponse::kDetTPC);
+  Double_t dEdxTPC = tuneOnDataTPC ? fPIDResponse->GetTPCsignalTunedOnData(track) : track->GetTPCsignal();
   
   if (dEdxTPC <= 0) {
     Printf("Skipping track with strange dEdx value: dEdx %f, pTPC %f, eta %f, ncl %d\n", track->GetTPCsignal(), pTPC,