Protection for momentum conservation in correction framework
authorfprino <prino@to.infn.it>
Thu, 6 Mar 2014 14:21:07 +0000 (15:21 +0100)
committerfprino <prino@to.infn.it>
Thu, 6 Mar 2014 14:33:56 +0000 (15:33 +0100)
PWGHF/vertexingHF/AliCFVertexingHF2Prong.cxx
PWGHF/vertexingHF/AliCFVertexingHF3Prong.cxx
PWGHF/vertexingHF/AliCFVertexingHFCascade.cxx
PWGHF/vertexingHF/AliCFVertexingHFLctoV0bachelor.cxx

index 210e8b1..b5731f1 100644 (file)
@@ -338,6 +338,19 @@ Bool_t AliCFVertexingHF2Prong::CheckMCChannelDecay() const
                AliDebug(2, "The D0 MC doesn't come from a Kpi decay, skipping!!");
                return checkCD;  
        }
+
+       Double_t sumPxDau=mcPartDaughter0->Px()+mcPartDaughter1->Px();
+       Double_t sumPyDau=mcPartDaughter0->Py()+mcPartDaughter1->Py();
+       Double_t sumPzDau=mcPartDaughter0->Pz()+mcPartDaughter1->Pz();
+       Double_t pxMother=fmcPartCandidate->Px();
+       Double_t pyMother=fmcPartCandidate->Py();
+       Double_t pzMother=fmcPartCandidate->Pz();
+       if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>0.00001 ||
+          TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>0.00001 ||
+          TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>0.00001){
+         AliDebug(2, "Momentum conservation violated, skipping!!");
+         return checkCD;  
+       }
        
        checkCD = kTRUE;
        return checkCD;
index c6cd852..99c3141 100644 (file)
@@ -523,6 +523,9 @@ Bool_t AliCFVertexingHF3Prong::CheckMCChannelDecay() const
 
 
   Int_t daughter[3];
+  Double_t sumPxDau=0.;
+  Double_t sumPyDau=0.;
+  Double_t sumPzDau=0.;
 
   Int_t nDau=fmcPartCandidate->GetNDaughters();
   Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0);
@@ -542,6 +545,9 @@ Bool_t AliCFVertexingHF3Prong::CheckMCChannelDecay() const
        return checkCD;
       }
       daughter[iDau]=TMath::Abs(part->GetPdgCode());
+      sumPxDau+=part->Px();
+      sumPyDau+=part->Py();
+      sumPzDau+=part->Pz();
     }
   }else if(nDau==2){
     if(fDecay==kDstoKKpi && fGenDsOption==kCountNonResonant) return checkCD;
@@ -557,6 +563,9 @@ Bool_t AliCFVertexingHF3Prong::CheckMCChannelDecay() const
       if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
        if(nDauFound>=3) return checkCD;
        daughter[nDauFound]=pdgCode;
+       sumPxDau+=part->Px();
+       sumPyDau+=part->Py();
+       sumPzDau+=part->Pz();
        nDauFound++;
       }else{
        if(fDecay==kDstoKKpi && fGenDsOption!=3){
@@ -577,6 +586,9 @@ Bool_t AliCFVertexingHF3Prong::CheckMCChannelDecay() const
          Int_t pdgCodeDR=TMath::Abs(partDR->GetPdgCode());
          if(nDauFound>=3) return checkCD;
          daughter[nDauFound]=pdgCodeDR;
+         sumPxDau+=partDR->Px();
+         sumPyDau+=partDR->Py();
+         sumPzDau+=partDR->Pz();
          nDauFound++;
        }
       }
@@ -600,6 +612,16 @@ Bool_t AliCFVertexingHF3Prong::CheckMCChannelDecay() const
     }
   }
   
+  Double_t pxMother=fmcPartCandidate->Px();
+  Double_t pyMother=fmcPartCandidate->Py();
+  Double_t pzMother=fmcPartCandidate->Pz();
+  if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>0.00001 ||
+     TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>0.00001 ||
+     TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>0.00001){
+    AliDebug(2, "Momentum conservation violated, skipping!!");
+    return checkCD;  
+  }
+
   checkCD = kTRUE;
   return checkCD;
   
index b502744..36e73d0 100644 (file)
@@ -422,6 +422,19 @@ Bool_t AliCFVertexingHFCascade::EvaluateIfD0toKpi(AliAODMCParticle* neutralDaugh
     return isHadronic;  
   }
   
+  Double_t sumPxDau=mcPartDaughterD00->Px()+mcPartDaughterD01->Px();
+  Double_t sumPyDau=mcPartDaughterD00->Py()+mcPartDaughterD01->Py();
+  Double_t sumPzDau=mcPartDaughterD00->Pz()+mcPartDaughterD01->Pz();
+  Double_t pxMother=neutralDaugh->Px();
+  Double_t pyMother=neutralDaugh->Py();
+  Double_t pzMother=neutralDaugh->Pz();
+  if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>0.00001 ||
+     TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>0.00001 ||
+     TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>0.00001){
+    AliDebug(2, "Momentum conservation violated, skipping!!");
+    return isHadronic;  
+  }
+
   Double_t pTD0pi = 0;
   Double_t pTD0K = 0;
   
index 15c5ca1..e806ed7 100644 (file)
@@ -422,7 +422,11 @@ Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
   // check the required decay channel
 
   Bool_t checkCD = kFALSE;
-  
+  Double_t sumPxDau=0.;
+  Double_t sumPyDau=0.;
+  Double_t sumPzDau=0.;
+
   if (fmcPartCandidate->GetNDaughters()!=2) {
     AliDebug(2, Form("The MC particle doesn't decay in 2 particles, skipping!!"));
     return checkCD;
@@ -460,6 +464,10 @@ Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
       AliDebug(2,"Problems in the MC Daughters\n");
       return checkCD;
     }
+    // momentum of the bachelor
+    sumPxDau+=mcPartDaughter0->Px();
+    sumPyDau+=mcPartDaughter0->Py();
+    sumPzDau+=mcPartDaughter0->Pz();
 
     if (mcPartDaughter1->GetNDaughters()!=2) {
       AliDebug(2, "The Lambda MC particle doesn't decay in 2 particles, skipping!!");
@@ -488,6 +496,14 @@ Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
       return checkCD;
     }
 
+    // momentum of the V0 daughters
+    sumPxDau+=mcPartDaughter1D0->Px();
+    sumPyDau+=mcPartDaughter1D0->Py();
+    sumPzDau+=mcPartDaughter1D0->Pz();
+    sumPxDau+=mcPartDaughter1D1->Px();
+    sumPyDau+=mcPartDaughter1D1->Py();
+    sumPzDau+=mcPartDaughter1D1->Pz();
+
   } else if (fGenLcOption==kCountK0Sp) { // Lc -> K0bar + proton AND cc
 
     if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311   &&
@@ -507,6 +523,11 @@ Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
       return checkCD;
     }
 
+    // momentum of the bachelor
+    sumPxDau+=mcPartDaughter0->Px();
+    sumPyDau+=mcPartDaughter0->Py();
+    sumPzDau+=mcPartDaughter0->Pz();
+
     if (mcPartDaughter1->GetNDaughters()!=1) {
       AliDebug(2, "The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
       return checkCD;
@@ -554,8 +575,26 @@ Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
       return checkCD;
     }
 
+    // momentum of the V0 daughters
+    sumPxDau+=mcPartDaughterD0->Px();
+    sumPyDau+=mcPartDaughterD0->Py();
+    sumPzDau+=mcPartDaughterD0->Pz();
+    sumPxDau+=mcPartDaughterD1->Px();
+    sumPyDau+=mcPartDaughterD1->Py();
+    sumPzDau+=mcPartDaughterD1->Pz();
+
   }
   
+  Double_t pxMother=fmcPartCandidate->Px();
+  Double_t pyMother=fmcPartCandidate->Py();
+  Double_t pzMother=fmcPartCandidate->Pz();
+  if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>0.00001 ||
+     TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>0.00001 ||
+     TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>0.00001){
+    AliDebug(2, "Momentum conservation violated, skipping!!");
+    return checkCD;  
+  }
+
   checkCD = kTRUE;
   return checkCD;