]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGCF/FEMTOSCOPY/K0Analysis/AliFemtoK0Analysis.cxx
New K0 Analysis
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / K0Analysis / AliFemtoK0Analysis.cxx
index a00abdb7dd1ae16877914172c6bf162a7f5e50b0..bdd94b529f06984ed280544b94258fe3b5f25545 100644 (file)
 //     - added new boosting prescription, get q out-side-long for LCMS and PRF (6/24/13)\r
 //             - added histograms and values for LCMS momenta (for simulation)\r
 //     - added random particle order switch in correlations (9/09/13)\r
+//     - added more bins for 3D OSL analysis (9/19/13)\r
+//     - added merit cut choice, pass as argument (10/16/13)\r
+//             - 1-mass, 2-v0dca, 3-dddca, 4-combination (used to be v0dca)\r
+//     - added passable argument for two-track minimum separation (10/16/13)\r
 ////////////////////////////////////////////////////////////////////////////////\r
 \r
 \r
@@ -89,6 +93,8 @@ AliAnalysisTaskSE(),
   fOnlineCase(kTRUE),\r
   fMeritCase(kTRUE),\r
   fMinDecayLength(0.0),\r
+  fMeritCutChoice(0),\r
+  fMinSep(0.0),\r
   fEventCount(0),\r
   fEC(0x0),\r
   fEvt(0X0),\r
@@ -100,12 +106,14 @@ AliAnalysisTaskSE(),
 {\r
 }\r
 //________________________________________________________________________\r
-AliFemtoK0Analysis::AliFemtoK0Analysis(const char *name, bool FieldPositive, bool OnlineCase, bool MeritCase, float MinDL) \r
+AliFemtoK0Analysis::AliFemtoK0Analysis(const char *name, bool FieldPositive, bool OnlineCase, bool MeritCase, float MinDL, int MeritCutChoice, float MinSep\r
 : AliAnalysisTaskSE(name), \r
   fFieldPos(FieldPositive),\r
   fOnlineCase(OnlineCase),\r
   fMeritCase(MeritCase),\r
   fMinDecayLength(MinDL),\r
+  fMeritCutChoice(MeritCutChoice),\r
+  fMinSep(MinSep),\r
   fEventCount(0),\r
   fEC(0x0),\r
   fEvt(0X0),\r
@@ -120,6 +128,8 @@ AliFemtoK0Analysis::AliFemtoK0Analysis(const char *name, bool FieldPositive, boo
   fOnlineCase  = OnlineCase;\r
   fMeritCase   = MeritCase;\r
   fMinDecayLength = MinDL;\r
+  fMeritCutChoice = MeritCutChoice;\r
+  fMinSep              = MinSep;\r
 \r
   // Define output slots here \r
   // Output slot #1\r
@@ -133,6 +143,8 @@ AliFemtoK0Analysis::AliFemtoK0Analysis(const AliFemtoK0Analysis &obj)
   fOnlineCase(obj.fOnlineCase),\r
   fMeritCase(obj.fMeritCase),\r
   fMinDecayLength(obj.fMinDecayLength),\r
+  fMeritCutChoice(obj.fMeritCutChoice),\r
+  fMinSep(obj.fMinSep),\r
   fEventCount(obj.fEventCount),\r
   fEC(obj.fEC),\r
   fEvt(obj.fEvt),\r
@@ -153,6 +165,8 @@ AliFemtoK0Analysis &AliFemtoK0Analysis::operator=(const AliFemtoK0Analysis &obj)
  fOnlineCase   = obj.fOnlineCase;\r
  fMeritCase    = obj.fMeritCase;\r
  fMinDecayLength= obj.fMinDecayLength;\r
+ fMeritCutChoice= obj.fMeritCutChoice;\r
+ fMinSep               = obj.fMinSep;\r
  fEventCount   = obj.fEventCount;\r
  fEC           = obj.fEC;\r
  fEvt          = obj.fEvt;\r
@@ -330,7 +344,7 @@ void AliFemtoK0Analysis::UserCreateOutputObjects()
   \r
 \r
   //3D out-side-long\r
-  TH3F* fHistOSLCentLowKt = new TH3F("fHistOSLCentLowKt","",100,-.5,.5,100,-.5,.5,100,-.5,.5);\r
+  /*TH3F* fHistOSLCentLowKt = new TH3F("fHistOSLCentLowKt","",100,-.5,.5,100,-.5,.5,100,-.5,.5);\r
   fOutputList->Add(fHistOSLCentLowKt);\r
   TH3F* fHistOSLCentLowKtBkg = new TH3F("fHistOSLCentLowKtBkg","",100,-.5,.5,100,-.5,.5,100,-.5,.5);\r
   fOutputList->Add(fHistOSLCentLowKtBkg);\r
@@ -348,7 +362,27 @@ void AliFemtoK0Analysis::UserCreateOutputObjects()
   TH3F* fHistOSLSemiCentHighKt = new TH3F("fHistOSLSemiCentHighKt","",100,-.5,.5,100,-.5,.5,100,-.5,.5);\r
   fOutputList->Add(fHistOSLSemiCentHighKt);\r
   TH3F* fHistOSLSemiCentHighKtBkg = new TH3F("fHistOSLSemiCentHighKtBkg","",100,-.5,.5,100,-.5,.5,100,-.5,.5);\r
-  fOutputList->Add(fHistOSLSemiCentHighKtBkg);\r
+  fOutputList->Add(fHistOSLSemiCentHighKtBkg);*/\r
+\r
+  //3D out-side-long\r
+  TH3F *fHist3DOSLSignal[10][4];\r
+  TH3F *fHist3DOSLBkg[10][4];\r
+  \r
+  for(int i3D=0;i3D<10;i3D++){\r
+   for(int j3D=0;j3D<4;j3D++){\r
+    TString *histname = new TString("fHist3DOSL");\r
+    *histname += i3D;\r
+    *histname += j3D;\r
+    histname->Append("Signal");\r
+    fHist3DOSLSignal[i3D][j3D] = new TH3F(histname->Data(),"",100,-.5,.5,100,-.5,.5,100,-.5,.5);\r
+    fOutputList->Add(fHist3DOSLSignal[i3D][j3D]);\r
+    histname->Replace(12,6,"Bkg");\r
+    fHist3DOSLBkg[i3D][j3D] = new TH3F(histname->Data(),"",100,-.5,.5,100,-.5,.5,100,-.5,.5);\r
+    fOutputList->Add(fHist3DOSLBkg[i3D][j3D]);\r
+   }\r
+  }\r
+    \r
+\r
 \r
   //3D Spherical Harmonics\r
   TH3F* fHistSHCentLowKt = new TH3F("fHistSHCentLowKt","",50,0,.5,ncthetabins,-1,1,nphibins,0,2*PI);\r
@@ -502,7 +536,7 @@ void AliFemtoK0Analysis::Exec(Option_t *)
   const float kEtaCut = 0.8;                       //maximum |pseudorapidity|\r
   const float kMinCosAngle = 0.99;                 //minimum cosine of K0 pointing angle     \r
   \r
-  const float kMinSeparation = 5.0;                //minimum daughter (pair) separation\r
+  const float kMinSeparation = fMinSep;                //minimum daughter (pair) separation\r
                  \r
   const float kTOFLow = 0.8;                       //boundary for TOF usage\r
   const float kMaxTOFSigmaPion = 3.0;              //TOF # of sigmas\r
@@ -613,17 +647,17 @@ void AliFemtoK0Analysis::Exec(Option_t *)
     }\r
     \r
     //K0 cuts\r
-    if(v0->Eta() > kEtaCut)                                continue;    \r
-    if(v0->CosPointingAngle(primaryVertex) < kMinCosAngle) continue;\r
-    if(v0->MassK0Short() < .2 || v0->MassK0Short() > .8)   continue;\r
-    if(v0->DcaNegToPrimVertex() < kMinDCAPrimaryPion)      continue;\r
-    if(v0->DcaPosToPrimVertex() < kMinDCAPrimaryPion)      continue;  \r
-    if(v0->DecayLength(primaryVertex) > kMaxDLK0)          continue;\r
+    if(v0->Eta() > kEtaCut)                                    continue;    \r
+    if(v0->CosPointingAngle(primaryVertex) < kMinCosAngle)     continue;\r
+    if(v0->MassK0Short() < .2 || v0->MassK0Short() > .8)       continue;\r
+    if(v0->DcaNegToPrimVertex() < kMinDCAPrimaryPion)          continue;\r
+    if(v0->DcaPosToPrimVertex() < kMinDCAPrimaryPion)          continue;  \r
+    if(v0->DecayLength(primaryVertex) > kMaxDLK0)              continue;\r
     if(v0->DecayLength(primaryVertex) < kMinDLK0)                      continue;\r
-    if(v0->DcaV0Daughters() > kMaxDCADaughtersK0)          continue;\r
+    if(v0->DcaV0Daughters() > kMaxDCADaughtersK0)              continue;\r
     double v0Dca = v0->DcaV0ToPrimVertex();\r
-    if(v0Dca > kMaxDCAK0)                                 continue;        \r
-    if(!goodPiMinus || !goodPiPlus)                        continue; \r
+    if(v0Dca > kMaxDCAK0)                                                      continue;        \r
+    if(!goodPiMinus || !goodPiPlus)                            continue; \r
     \r
     //EVERYTHING BELOW HERE PASSES SINGLE PARTICLE CUTS, PION PID, and LOOSE MASS CUT\r
 \r
@@ -648,12 +682,16 @@ void AliFemtoK0Analysis::Exec(Option_t *)
     //else continue; //removed, Apr 18\r
      \r
     //Check for shared daughters, using v0 DCA to judge\r
+    bool v0JudgeNew; //true if new v0 beats old\r
     tempK0[v0Count].fSkipShared = kFALSE;\r
+    double newV0Pars[3] = {fabs(v0->MassK0Short()-kMassK0Short),v0Dca,v0->DcaV0Daughters()}; //parameters used in merit cut\r
     if(fMeritCase){\r
      for(int iID = 0; iID<v0Count; iID++){\r
       if(tempK0[iID].fSkipShared == kFALSE){           //if old is already skipped, go to next old\r
        if(tempK0[iID].fDaughterID1 == prongTrackPos->GetID() || tempK0[iID].fDaughterID2 == prongTrackNeg->GetID()){\r
-        if(tempK0[iID].fV0Dca <= v0Dca){               //if old beats new...\r
+        double oldV0Pars[3] = {fabs(tempK0[iID].fMass-kMassK0Short), tempK0[iID].fV0Dca, tempK0[iID].fDDDca}; \r
+        v0JudgeNew = CheckMeritCutWinner(fMeritCutChoice, oldV0Pars, newV0Pars); //true if new wins\r
+        if(!v0JudgeNew){               //if old beats new...\r
          if(!tempK0[iID].fK0 && goodK0) continue;      //if bad old beats new good, do nothing...                              \r
          else{                                         //but if bad old beats new bad, or good old beats anything, skip new\r
           tempK0[v0Count].fSkipShared = kTRUE;         //skip new\r
@@ -663,8 +701,8 @@ void AliFemtoK0Analysis::Exec(Option_t *)
         else{                                          //if new beats old...\r
          if(tempK0[iID].fK0 && !goodK0) continue;      //if bad new beats good old, do nothing...\r
          else{                                         //but if bad new beats bad old, or good new beats anything, skip old\r
-         tempK0[iID].fSkipShared = kTRUE;              //skip old      \r
-         if(tempK0[iID].fK0) k0Count--;                //if good old gets skipped, subtract from number of K0s (new one will be added later, if it succeeds)\r
+             tempK0[iID].fSkipShared = kTRUE;          //skip old      \r
+             if(tempK0[iID].fK0) k0Count--;            //if good old gets skipped, subtract from number of K0s (new one will be added later, if it succeeds)\r
          }\r
         }\r
        }\r
@@ -686,7 +724,7 @@ void AliFemtoK0Analysis::Exec(Option_t *)
         //else tempK0[v0Count].fSideLeft = kFALSE;\r
         //if(v0->MassK0Short() > .515 && v0->MassK0Short() < .545) tempK0[v0Count].fSideRight = kTRUE;\r
         //else tempK0[v0Count].fSideRight = kFALSE;\r
-       //if(!goodK0) continue; //no sides, speed up analysis (REDUNDANT RIGHT NOW)\r
+           //if(!goodK0) continue; //no sides, speed up analysis (REDUNDANT RIGHT NOW)\r
 \r
         tempK0[v0Count].fDaughterID1    = prongTrackPos->GetID();\r
         tempK0[v0Count].fDaughterID2    = prongTrackNeg->GetID();\r
@@ -699,23 +737,23 @@ void AliFemtoK0Analysis::Exec(Option_t *)
 \r
         //for hists\r
         tempK0[v0Count].fDDDca         = v0->DcaV0Daughters();\r
-       tempK0[v0Count].fDecayLength    = v0->DecayLength(primaryVertex);\r
+           tempK0[v0Count].fDecayLength        = v0->DecayLength(primaryVertex);\r
         tempK0[v0Count].fPosPt         = v0->PtProng(pos0or1);\r
         tempK0[v0Count].fNegPt         = v0->PtProng(neg0or1);\r
         tempK0[v0Count].fPosPhi                = v0->PhiProng(pos0or1);\r
         tempK0[v0Count].fNegPhi                = v0->PhiProng(neg0or1);\r
-       if(!orderswitch){\r
+           if(!orderswitch){\r
          tempK0[v0Count].fPosDca       = v0->DcaPosToPrimVertex();\r
          tempK0[v0Count].fNegDca       = v0->DcaNegToPrimVertex();\r
-       }\r
+           }\r
         else{\r
          tempK0[v0Count].fPosDca       = v0->DcaNegToPrimVertex();\r
          tempK0[v0Count].fNegDca       = v0->DcaPosToPrimVertex();\r
-       } \r
+           \r
         \r
         //for separation\r
         GetGlobalPositionAtGlobalRadiiThroughTPC(prongTrackPos, bField, tempK0[v0Count].fPosXYZ, vertex);\r
-       GetGlobalPositionAtGlobalRadiiThroughTPC(prongTrackNeg, bField, tempK0[v0Count].fNegXYZ, vertex);\r
+           GetGlobalPositionAtGlobalRadiiThroughTPC(prongTrackNeg, bField, tempK0[v0Count].fNegXYZ, vertex);\r
         //for DPC\r
         prongTrackPos->GetPxPyPz(tempK0[v0Count].fPPos);\r
         prongTrackNeg->GetPxPyPz(tempK0[v0Count].fPNeg);\r
@@ -889,6 +927,15 @@ void AliFemtoK0Analysis::Exec(Option_t *)
                ((TH1F*)fOutputList->FindObject("fHistPOutLCMS"))->Fill(p2LCMSOut);\r
                ((TH1F*)fOutputList->FindObject("fHistPSideLCMS"))->Fill(p2LCMSSide);\r
                ((TH1F*)fOutputList->FindObject("fHistPLongLCMS"))->Fill(p2LCMSLong);\r
+               //getting bin numbers and names for 3D histogram\r
+        TString *histname3D = new TString("fHist3DOSL");\r
+        int ktBin;\r
+        if(pairKt < 0.6) ktBin = 0;\r
+               else if(pairKt < 0.8) ktBin = 1;\r
+               else if(pairKt < 1.0) ktBin = 2;\r
+               else ktBin = 3;\r
+               *histname3D += centBin-6; //centBins: [6,15] -> array bins: [0,9]\r
+               *histname3D += ktBin;\r
 \r
         //Spherical harmonics\r
         qLength = sqrt(qLong*qLong + qSide*qSide + qOutPRF*qOutPRF);\r
@@ -982,7 +1029,7 @@ void AliFemtoK0Analysis::Exec(Option_t *)
 \r
         //Fill Histograms\r
         bool center1K0   = kFALSE;  //accepted mass K0\r
-       bool center2K0   = kFALSE;\r
+           bool center2K0   = kFALSE;\r
         if((fEvt)->fK0Particle[i].fK0) center1K0=kTRUE;\r
         if((fEvt+evnum)->fK0Particle[j].fK0) center2K0=kTRUE;\r
         //bool CL1 = kFALSE;\r
@@ -1027,7 +1074,12 @@ void AliFemtoK0Analysis::Exec(Option_t *)
            //else ((TH3F*)fOutputList->FindObject("fHistCRCRSignal"))->Fill(centBin+1, pairKt, qinv);\r
 \r
            //3D\r
-           if(pairKt < 1.0){\r
+           if(pairKt > 0.2 && pairKt < 1.5 && centBin > 5){\r
+                   histname3D->Append("Signal");\r
+                       ((TH3F*)fOutputList->FindObject(histname3D->Data()))->Fill(qOutPRF,qSide,qLong);\r
+                  }\r
+             \r
+           /*if(pairKt < 1.0){\r
             if(centBin > 13){\r
              ((TH3F*)fOutputList->FindObject("fHistOSLCentLowKt"))->Fill(qOutPRF,qSide,qLong);\r
              ((TH3F*)fOutputList->FindObject("fHistSHCentLowKt"))->Fill(qLength,thetaSHCos,phiSH);}\r
@@ -1040,8 +1092,10 @@ void AliFemtoK0Analysis::Exec(Option_t *)
              ((TH3F*)fOutputList->FindObject("fHistSHCentHighKt"))->Fill(qLength,thetaSHCos, phiSH);}\r
             else if(centBin > 9){\r
              ((TH3F*)fOutputList->FindObject("fHistOSLSemiCentHighKt"))->Fill(qOutPRF,qSide,qLong);\r
-             ((TH3F*)fOutputList->FindObject("fHistSHSemiCentHighKt"))->Fill(qLength, thetaSHCos, phiSH);}}\r
-          }\r
+\r
+             ((TH3F*)fOutputList->FindObject("fHistSHSemiCentHighKt"))->Fill(qLength, thetaSHCos, phiSH);}}*/                  \r
+\r
+          }//centercenter\r
 \r
           //side-side correlations\r
           //if(!splitK0sides){\r
@@ -1069,7 +1123,11 @@ void AliFemtoK0Analysis::Exec(Option_t *)
            //else ((TH3F*)fOutputList->FindObject("fHistCRCRBkg"))->Fill(centBin+1, pairKt, qinv);\r
 \r
            //3D\r
-           if(pairKt < 1.0){\r
+           if(pairKt > 0.2 && pairKt < 1.5 && centBin > 5){\r
+                   histname3D->Replace(12,6,"Bkg");\r
+                       ((TH3F*)fOutputList->FindObject(histname3D->Data()))->Fill(qOutPRF,qSide,qLong);\r
+                  }\r
+           /*if(pairKt < 1.0){\r
             if(centBin > 13){\r
              ((TH3F*)fOutputList->FindObject("fHistOSLCentLowKtBkg"))->Fill(qOutPRF,qSide,qLong);\r
              ((TH3F*)fOutputList->FindObject("fHistSHCentLowKtBkg"))->Fill(qLength,thetaSHCos,phiSH);}\r
@@ -1082,7 +1140,7 @@ void AliFemtoK0Analysis::Exec(Option_t *)
              ((TH3F*)fOutputList->FindObject("fHistSHCentHighKtBkg"))->Fill(qLength, thetaSHCos, phiSH);}\r
             else if(centBin > 9){\r
              ((TH3F*)fOutputList->FindObject("fHistOSLSemiCentHighKtBkg"))->Fill(qOutPRF,qSide,qLong);\r
-             ((TH3F*)fOutputList->FindObject("fHistSHSemiCentHighKtBkg"))->Fill(qLength, thetaSHCos, phiSH);}}\r
+             ((TH3F*)fOutputList->FindObject("fHistSHSemiCentHighKtBkg"))->Fill(qLength, thetaSHCos, phiSH);}}*/\r
           }\r
 \r
           //side-side correlations\r
@@ -1181,3 +1239,24 @@ void AliFemtoK0Analysis::GetGlobalPositionAtGlobalRadiiThroughTPC(const AliAODTr
   }\r
 }\r
 \r
+bool AliFemtoK0Analysis::CheckMeritCutWinner(int cutChoice, double oldPars[3], double newPars[3]){\r
+ //performs "merit cut" judgement check on v0s with shared daughters, using one of three criteria.\r
+ //if cutChoice = 4, it uses all three criteria, needed 2 of 3 'points'\r
+\r
+ bool newV0Wins = kFALSE;\r
+ double pardiff[3] = {newPars[0]-oldPars[0],\r
+                      newPars[1]-oldPars[1],\r
+                      newPars[2]-oldPars[2]};\r
+ if(cutChoice > 0 && cutChoice < 4){\r
+  if(pardiff[cutChoice] <= 0.) newV0Wins = kTRUE;\r
+ }\r
+ else if(cutChoice == 4){\r
+  int newWinCount = 0;\r
+  for(int i=0;i<3;i++){if(pardiff[i+1] <= 0) newWinCount++;}\r
+  if(newWinCount > 1) newV0Wins = kTRUE;  \r
+ }\r
+ else{};\r
+ return newV0Wins;\r
+}\r
+\r
+\r