New K0 Analysis
authorakisiel <akisiel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Oct 2013 15:05:41 +0000 (15:05 +0000)
committerakisiel <akisiel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Oct 2013 15:05:41 +0000 (15:05 +0000)
PWGCF/FEMTOSCOPY/K0Analysis/AliFemtoK0Analysis.cxx
PWGCF/FEMTOSCOPY/K0Analysis/AliFemtoK0Analysis.h

index 2db8d80..bdd94b5 100644 (file)
@@ -42,6 +42,9 @@
 //             - 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
@@ -90,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
@@ -101,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
@@ -121,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
@@ -134,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
@@ -154,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
@@ -523,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
@@ -634,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
@@ -669,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
@@ -684,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
@@ -707,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
@@ -720,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
@@ -793,8 +810,7 @@ void AliFemtoK0Analysis::Exec(Option_t *)
   float pairPt, pairMt, pairKt;                        //pair momentum values\r
   float pairMInv, pairPDotQ;\r
   float qinv, q0, qx, qy, qz;                          //pair q values\r
-  //float qLength, thetaSHCos;            //Spherical Harmonics values\r
-  //float phiSH, thetaSH;\r
+  float qLength, thetaSH, thetaSHCos, phiSH;            //Spherical Harmonics values\r
   float am12, epm, h1, p12, p112, ppx, ppy, ppz, ks;   //PRF\r
   //float qOutLCMS;\r
   float qOutPRF, qSide, qLong;                         //relative momentum in LCMS/PRF frame\r
@@ -922,10 +938,10 @@ void AliFemtoK0Analysis::Exec(Option_t *)
                *histname3D += ktBin;\r
 \r
         //Spherical harmonics\r
-        //qLength = sqrt(qLong*qLong + qSide*qSide + qOutPRF*qOutPRF);\r
-        //thetaSHCos = qLong/qLength;\r
-        //thetaSH = acos(thetaSHCos);\r
-        //phiSH = acos(qOutPRF/(qLength*sin(thetaSH)));\r
+        qLength = sqrt(qLong*qLong + qSide*qSide + qOutPRF*qOutPRF);\r
+        thetaSHCos = qLong/qLength;\r
+        thetaSH = acos(thetaSHCos);\r
+        phiSH = acos(qOutPRF/(qLength*sin(thetaSH)));\r
 \r
         //Finding average separation of daughters throughout TPC - two-track cut\r
         float posPositions1[9][3] = {{0}};\r
@@ -1076,6 +1092,7 @@ 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
+\r
              ((TH3F*)fOutputList->FindObject("fHistSHSemiCentHighKt"))->Fill(qLength, thetaSHCos, phiSH);}}*/                  \r
 \r
           }//centercenter\r
@@ -1222,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
index e4d5163..6f86550 100644 (file)
@@ -30,7 +30,7 @@ class AliESDpid;
 class AliFemtoK0Analysis : public AliAnalysisTaskSE {
  public:
   AliFemtoK0Analysis();
-  AliFemtoK0Analysis(const char *name, bool FieldPositive = kTRUE, bool OnlineCase = kTRUE, bool MeritCase = kTRUE, float MinDL = 0.0);
+  AliFemtoK0Analysis(const char *name, bool FieldPositive = kTRUE, bool OnlineCase = kTRUE, bool MeritCase = kTRUE, float MinDL = 0.0, int MeritCutChoice = 2, float MinSep = 5.0);
   virtual ~AliFemtoK0Analysis();
   AliFemtoK0Analysis(const AliFemtoK0Analysis&);
   AliFemtoK0Analysis& operator=(const AliFemtoK0Analysis&);
@@ -43,7 +43,7 @@ class AliFemtoK0Analysis : public AliAnalysisTaskSE {
 
   void MyInit();
   void GetGlobalPositionAtGlobalRadiiThroughTPC(const AliAODTrack *track, const Float_t bfield, Float_t globalPositionsAtRadii[9][3], double PrimaryVertex[3]);
-  void GetGlobalPositionAtGlobalRadiiThroughTPCTEST(const AliAODTrack *track, const Float_t bfield, double PrimaryVertex[3]);
+  bool CheckMeritCutWinner(int cutChoice, double oldPars[3], double newPars[3]);
   
   enum 
   {
@@ -59,7 +59,9 @@ class AliFemtoK0Analysis : public AliAnalysisTaskSE {
   bool fFieldPos;
   bool fOnlineCase;
   bool fMeritCase;
-  double fMinDecayLength;
+  float fMinDecayLength;
+  int fMeritCutChoice;
+  float fMinSep;
   int fEventCount;
 
   AliFemtoK0EventCollection ***fEC; //!