Added functionality to check the efficiency of the V0 finder
authorkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 May 2009 14:05:31 +0000 (14:05 +0000)
committerkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 May 2009 14:05:31 +0000 (14:05 +0000)
PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx
PWG4/GammaConv/AliAnalysisTaskGammaConversion.h

index c1b7ab1b0429d9cd3cbac819af212b1f8c5092d9..d1c7f6410a1e04b28638ad8fce95bdc0a589ea7e 100644 (file)
@@ -183,6 +183,8 @@ void AliAnalysisTaskGammaConversion::Exec(Option_t */*option*/)
   \r
   // Process reconstructed gammas\r
   ProcessGammasForNeutralMesonAnalysis();\r
+\r
+  CheckV0Efficiency();\r
   \r
   PostData(1, fOutputContainer);\r
        \r
@@ -893,6 +895,7 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
          fHistograms->FillHistogram("ESD_Mother_ZR", twoGammaCandidate->GetZ(), spaceVectorTwoGammaCandidate.Pt());\r
          fHistograms->FillHistogram("ESD_Mother_XY", twoGammaCandidate->GetX(), twoGammaCandidate->GetY());\r
          fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());\r
+         fHistograms->FillHistogram("ESD_Mother_InvMass",massTwoGammaCandidate);\r
        }\r
       }\r
       delete twoGammaCandidate;\r
@@ -950,6 +953,7 @@ void AliAnalysisTaskGammaConversion::CalculateBackground(){
          fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), SpaceVectorbackgroundCandidate.Pt());\r
          fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());\r
          fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,MomentumVectorbackgroundCandidate.Pt());\r
+         fHistograms->FillHistogram("ESD_Background_InvMass",massBG);\r
        }\r
       }\r
       delete backgroundCandidate;   \r
@@ -1003,3 +1007,75 @@ Double_t AliAnalysisTaskGammaConversion::GetMCOpeningAngle(TParticle* const daug
   TVector3 v3D1(daughter1->Px(),daughter1->Py(),daughter1->Pz());\r
   return v3D0.Angle(v3D1);\r
 }\r
+\r
+void AliAnalysisTaskGammaConversion::CheckV0Efficiency(){\r
+\r
+  vector<Int_t> indexOfGammaParticle;\r
+\r
+  fStack = fV0Reader->GetMCStack();\r
+\r
+  if(fV0Reader->CheckForPrimaryVertex() == kFALSE){\r
+    return; // aborts if the primary vertex does not have contributors.\r
+  }\r
+\r
+  for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {\r
+    TParticle* particle = (TParticle *)fStack->Particle(iTracks);\r
+    if(particle->GetPdgCode()==22){     //Gamma\r
+      if(particle->GetNDaughters() >= 2){\r
+       TParticle* electron=NULL;\r
+       TParticle* positron=NULL; \r
+       for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){\r
+         TParticle *tmpDaughter = fStack->Particle(daughterIndex);\r
+         if(tmpDaughter->GetUniqueID() == 5){\r
+           if(tmpDaughter->GetPdgCode() == 11){\r
+             electron = tmpDaughter;\r
+           }\r
+           else if(tmpDaughter->GetPdgCode() == -11){\r
+             positron = tmpDaughter;\r
+           }\r
+         }\r
+       }\r
+       if(electron!=NULL && positron!=0){\r
+         if(electron->R()<160){\r
+           indexOfGammaParticle.push_back(iTracks);\r
+         }\r
+       }\r
+      }\r
+    }\r
+  }\r
+\r
+  Int_t nFoundGammas=0;\r
+  Int_t nNotFoundGammas=0;\r
+\r
+  Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();\r
+  for(Int_t i=0;i<numberOfV0s;i++){\r
+    fV0Reader->GetV0(i);\r
+    \r
+    if(fV0Reader->HasSameMCMother() == kFALSE){\r
+      continue;\r
+    }\r
+    \r
+    TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();\r
+    TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();\r
+    \r
+    if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){\r
+      continue;\r
+    }\r
+    if(negativeMC->GetPdgCode()==positiveMC->GetPdgCode()){\r
+      continue;\r
+    }\r
+    \r
+    if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){\r
+      //TParticle * v0Gamma = fV0Reader->GetMotherMCParticle();\r
+      for(UInt_t mcIndex=0;mcIndex<indexOfGammaParticle.size();mcIndex++){\r
+       if(negativeMC->GetFirstMother()==indexOfGammaParticle[mcIndex]){\r
+         nFoundGammas++;\r
+       }\r
+       else{\r
+         nNotFoundGammas++;\r
+       }\r
+      }\r
+    }\r
+  }\r
+  //  cout<<"Found: "<<nFoundGammas<<"  of: "<<indexOfGammaParticle.size()<<endl;\r
+}\r
index 3be9301ef60cc461fec062b7c605ceab1880b8f5..482ad4858ff58fbb169fb6ae413c500f9a74594d 100644 (file)
@@ -59,6 +59,7 @@ class AliAnalysisTaskGammaConversion : public AliAnalysisTaskSE
   void SetWriteNtuple(Bool_t writeNtuple){fWriteNtuple = writeNtuple;}\r
   void FillNtuple();\r
   Double_t GetMCOpeningAngle(TParticle* const daughter0, TParticle* const daughter1) const;\r
+  void CheckV0Efficiency();\r
 \r
  private:\r
   AliAnalysisTaskGammaConversion(const AliAnalysisTaskGammaConversion&); // Not implemented\r