Proper usage of the bayesian approach (Alis Rodriguez Manso)
authorpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Feb 2012 14:19:30 +0000 (14:19 +0000)
committerpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Feb 2012 14:19:30 +0000 (14:19 +0000)
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBF.cxx
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBF.h

index 6e75e91..72ef420 100755 (executable)
@@ -70,12 +70,14 @@ AliAnalysisTaskBF::AliAnalysisTaskBF(const char *name)
   fHistBetavsPTOFbeforePID(NULL), \r
   fHistProbTPCvsPtbeforePID(NULL), \r
   fHistProbTOFvsPtbeforePID(NULL), \r
+  fHistProbTPCTOFvsPtbeforePID(NULL),\r
   fHistNSigmaTPCvsPtbeforePID(NULL), \r
   fHistNSigmaTOFvsPtbeforePID(NULL), \r
   fHistdEdxVsPTPCafterPID(NULL),\r
   fHistBetavsPTOFafterPID(NULL), \r
   fHistProbTPCvsPtafterPID(NULL), \r
   fHistProbTOFvsPtafterPID(NULL), \r
+  fHistProbTPCTOFvsPtafterPID(NULL),\r
   fHistNSigmaTPCvsPtafterPID(NULL), \r
   fHistNSigmaTOFvsPtafterPID(NULL),  \r
   fPIDResponse(0x0),\r
@@ -301,11 +303,14 @@ void AliAnalysisTaskBF::UserCreateOutputObjects() {
     fHistBetavsPTOFbeforePID = new TH2D ("BetavsPTOFbefore","BetavsPTOFbefore", 1000, -10.0, 10., 1000, 0, 1.2); \r
     fHistListPIDQA->Add(fHistBetavsPTOFbeforePID); //addition\r
     \r
-    fHistProbTPCvsPtbeforePID = new TH2D ("ProbTPCvsPtbefore","ProbTPCvsPtbefore", 1000, -10.0,10.0, 1000, 0, 100); \r
+    fHistProbTPCvsPtbeforePID = new TH2D ("ProbTPCvsPtbefore","ProbTPCvsPtbefore", 1000, -10.0,10.0, 1000, 0, 2.0); \r
     fHistListPIDQA->Add(fHistProbTPCvsPtbeforePID); //addition \r
     \r
-    fHistProbTOFvsPtbeforePID = new TH2D ("ProbTOFvsPtbefore","ProbTOFvsPtbefore", 1000, -50, 50, 1000, 0, 100); \r
+    fHistProbTOFvsPtbeforePID = new TH2D ("ProbTOFvsPtbefore","ProbTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0); \r
     fHistListPIDQA->Add(fHistProbTOFvsPtbeforePID); //addition \r
+\r
+    fHistProbTPCTOFvsPtbeforePID =new TH2D ("ProbTPCTOFvsPtbefore","ProbTPCTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0); \r
+    fHistListPIDQA->Add(fHistProbTPCTOFvsPtbeforePID); //addition \r
     \r
     fHistNSigmaTPCvsPtbeforePID = new TH2D ("NSigmaTPCvsPtbefore","NSigmaTPCvsPtbefore", 1000, -10, 10, 1000, 0, 500); \r
     fHistListPIDQA->Add(fHistNSigmaTPCvsPtbeforePID); //addition \r
@@ -325,6 +330,9 @@ void AliAnalysisTaskBF::UserCreateOutputObjects() {
     fHistProbTOFvsPtafterPID = new TH2D ("ProbTOFvsPtafter","ProbTOFvsPtafter", 1000,  -10, 10, 1000, 0, 2); \r
     fHistListPIDQA->Add(fHistProbTOFvsPtafterPID); //addition  \r
     \r
+    fHistProbTPCTOFvsPtafterPID =new TH2D ("ProbTPCTOFvsPtafter","ProbTPCTOFvsPtafter", 1000, -50, 50, 1000, 0, 2.0); \r
+    fHistListPIDQA->Add(fHistProbTPCTOFvsPtafterPID); //addition \r
+\r
     fHistNSigmaTPCvsPtafterPID = new TH2D ("NSigmaTPCvsPtafter","NSigmaTPCvsPtafter", 1000, -10, 10, 1000, 0, 500); \r
     fHistListPIDQA->Add(fHistNSigmaTPCvsPtafterPID); //addition  \r
     \r
@@ -457,26 +465,41 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
                    //===========================PID===============================//               \r
                    if(fUsePID) {\r
                      Double_t prob[AliPID::kSPECIES]={0.};\r
+                     Double_t probTPC[AliPID::kSPECIES]={0.};\r
+                     Double_t probTOF[AliPID::kSPECIES]={0.};\r
+                     Double_t probTPCTOF[AliPID::kSPECIES]={0.};\r
+\r
                      Double_t nSigma = 0.;\r
+                      UInt_t detUsedTPC = 0;\r
+                     UInt_t detUsedTOF = 0;\r
+                      UInt_t detUsedTPCTOF = 0;\r
+\r
                      //Decide what detector configuration we want to use\r
                      switch(fPidDetectorConfig) {\r
                      case kTPCpid:\r
                        fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC);\r
                        nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)fParticleOfInterest));\r
+                       detUsedTPC = fPIDCombined->ComputeProbabilities(track, fPIDResponse, probTPC);\r
+                       for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)\r
+                         prob[iSpecies] = probTPC[iSpecies];\r
                        break;\r
                      case kTOFpid:\r
                        fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF);\r
                        nSigma = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)fParticleOfInterest));\r
+                       detUsedTOF = fPIDCombined->ComputeProbabilities(track, fPIDResponse, probTOF);\r
+                       for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)\r
+                         prob[iSpecies] = probTOF[iSpecies];\r
                        break;\r
                      case kTPCTOF:\r
                        fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF|AliPIDResponse::kDetTPC);\r
+                       detUsedTPCTOF = fPIDCombined->ComputeProbabilities(track, fPIDResponse, probTPCTOF);\r
+                       for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)\r
+                         prob[iSpecies] = probTPCTOF[iSpecies];\r
                        break;\r
                      default:\r
                        break;\r
                      }//end switch: define detector mask\r
                      \r
-                     UInt_t detUsed = fPIDCombined->ComputeProbabilities(track, fPIDResponse, prob);\r
-                     \r
                      //Filling the PID QA\r
                      Double_t tofTime = -999., length = 999., tof = -999.;\r
                      Double_t c = TMath::C()*1.E-9;// m/ns\r
@@ -503,18 +526,19 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
                        \r
                        nSigmaTOFForParticleOfInterest = fPIDResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)fParticleOfInterest);\r
                        fHistBetavsPTOFbeforePID ->Fill(track->P()*track->Charge(),beta);\r
-                       fHistProbTOFvsPtbeforePID ->Fill(track->Pt(),prob[fParticleOfInterest]);\r
+                       fHistProbTOFvsPtbeforePID ->Fill(track->Pt(),probTOF[fParticleOfInterest]);\r
                        fHistNSigmaTOFvsPtbeforePID ->Fill(track->Pt(),nSigmaTOFForParticleOfInterest);\r
                      }//TOF signal \r
                      \r
                      \r
                      Double_t  nSigmaTPCForParticleOfInterest = fPIDResponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)fParticleOfInterest);\r
                      fHistdEdxVsPTPCbeforePID -> Fill(track->P()*track->Charge(),track->GetTPCsignal());\r
-                     fHistProbTPCvsPtbeforePID -> Fill(track->Pt(),prob[fParticleOfInterest]); \r
+                     fHistProbTPCvsPtbeforePID -> Fill(track->Pt(),probTPC[fParticleOfInterest]); \r
                      fHistNSigmaTPCvsPtbeforePID -> Fill(track->Pt(),nSigmaTPCForParticleOfInterest); \r
+                     fHistProbTPCTOFvsPtbeforePID -> Fill(track->Pt(),probTPCTOF[fParticleOfInterest]);\r
                      //end of QA-before pid\r
                      \r
-                     if (detUsed != 0) {\r
+                     if ((detUsedTPC != 0)||(detUsedTOF != 0)||(detUsedTPCTOF != 0)) {\r
                        //Make the decision based on the n-sigma\r
                        if(fUsePIDnSigma) {\r
                          if(nSigma > fPIDNSigma) continue;}\r
@@ -527,11 +551,12 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
                        \r
                        //Fill QA after the PID\r
                        fHistBetavsPTOFafterPID ->Fill(track->P()*track->Charge(),beta);\r
-                       fHistProbTOFvsPtafterPID ->Fill(track->Pt(),prob[fParticleOfInterest]);\r
+                       fHistProbTOFvsPtafterPID ->Fill(track->Pt(),probTOF[fParticleOfInterest]);\r
                        fHistNSigmaTOFvsPtafterPID ->Fill(track->Pt(),nSigmaTOFForParticleOfInterest);\r
                        \r
                        fHistdEdxVsPTPCafterPID -> Fill(track->P()*track->Charge(),track->GetTPCsignal());\r
-                       fHistProbTPCvsPtafterPID -> Fill(track->Pt(),prob[fParticleOfInterest]); \r
+                       fHistProbTPCvsPtafterPID -> Fill(track->Pt(),probTPC[fParticleOfInterest]); \r
+                       fHistProbTPCTOFvsPtafterPID -> Fill(track->Pt(),probTPCTOF[fParticleOfInterest]);\r
                        fHistNSigmaTPCvsPtafterPID -> Fill(track->Pt(),nSigmaTPCForParticleOfInterest); \r
                      }\r
                      \r
index 3c3dac6..e822c0f 100755 (executable)
@@ -117,11 +117,11 @@ class AliAnalysisTaskBF : public AliAnalysisTaskSE {
   enum kParticleOfInterest { kMuon, kElectron, kPion, kKaon, kProton };  \r
 \r
   void SetUseBayesianPID(Double_t gMinProbabilityValue) {\r
-    fUsePID = kTRUE; fUsePIDPropabilities = kTRUE;\r
+    fUsePID = kTRUE; fUsePIDnSigma = kFALSE; fUsePIDPropabilities = kTRUE;\r
     fMinAcceptedPIDProbability = gMinProbabilityValue; }\r
 \r
   void SetUseNSigmaPID(Double_t gMaxNSigma) {\r
-    fUsePID = kTRUE; fUsePIDnSigma = kTRUE;\r
+    fUsePID = kTRUE; fUsePIDPropabilities = kFALSE; fUsePIDnSigma = kTRUE;\r
     fPIDNSigma = gMaxNSigma; }\r
 \r
   void SetParticleOfInterest(kParticleOfInterest poi) {\r
@@ -162,12 +162,14 @@ class AliAnalysisTaskBF : public AliAnalysisTaskSE {
   TH2D *fHistBetavsPTOFbeforePID;//\r
   TH2D *fHistProbTPCvsPtbeforePID; //\r
   TH2D *fHistProbTOFvsPtbeforePID;//\r
+  TH2D *fHistProbTPCTOFvsPtbeforePID;//\r
   TH2D *fHistNSigmaTPCvsPtbeforePID;//\r
   TH2D *fHistNSigmaTOFvsPtbeforePID;//\r
   TH2D *fHistdEdxVsPTPCafterPID;//\r
   TH2D *fHistBetavsPTOFafterPID;//\r
   TH2D *fHistProbTPCvsPtafterPID;//\r
   TH2D *fHistProbTOFvsPtafterPID;//\r
+  TH2D *fHistProbTPCTOFvsPtafterPID;//\r
   TH2D *fHistNSigmaTPCvsPtafterPID;//\r
   TH2D *fHistNSigmaTOFvsPtafterPID; //\r
 \r