]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG3/vertexingHF/AliCFHeavyFlavourTaskMultiVarMultiStep.cxx
Removed compilation warning; Added saving container projections to a file (Chiara Z)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliCFHeavyFlavourTaskMultiVarMultiStep.cxx
index 5ddbaea360bb546b2c8af74af747ff66731a20a8..0596b682f511648e8800c31df42a36d118c41d65 100644 (file)
@@ -28,6 +28,7 @@
 #include <TParticle.h>
 #include <TH1I.h>
 #include <TStyle.h>
+#include <TFile.h>
 
 #include "AliCFHeavyFlavourTaskMultiVarMultiStep.h"
 #include "AliStack.h"
@@ -249,17 +250,25 @@ void AliCFHeavyFlavourTaskMultiVarMultiStep::UserExec(Option_t *)
        fCountMC += icountMC;
        fCountAcc += icountAcc;
 
+       // AOD primary vertex
+       AliAODVertex *vtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
+
        // load heavy flavour vertices
-       TClonesArray *arrayVerticesHF = (TClonesArray*)((aodEvent->GetList())->FindObject("D0toKpi"));  
-       if (!arrayVerticesHF) AliError("Could not find array of HF vertices");
-       AliDebug(2, Form("Found %d vertices",arrayVerticesHF->GetEntriesFast()));
+       TClonesArray *arrayD0toKpi = (TClonesArray*)((aodEvent->GetList())->FindObject("D0toKpi"));     
+       if (!arrayD0toKpi) AliError("Could not find array of HF vertices");
+       AliDebug(2, Form("Found %d vertices",arrayD0toKpi->GetEntriesFast()));
        
-       for (Int_t iVertex = 0; iVertex<arrayVerticesHF->GetEntriesFast(); iVertex++) {
-               
-               AliAODRecoDecayHF2Prong* vtx = (AliAODRecoDecayHF2Prong*)arrayVerticesHF->At(iVertex);
+       for (Int_t iD0toKpi = 0; iD0toKpi<arrayD0toKpi->GetEntriesFast(); iD0toKpi++) {
                
+               AliAODRecoDecayHF2Prong* d0tokpi = (AliAODRecoDecayHF2Prong*)arrayD0toKpi->At(iD0toKpi);
+               Bool_t unsetvtx=kFALSE;
+               if(!d0tokpi->GetOwnPrimaryVtx()) {
+                 d0tokpi->SetOwnPrimaryVtx(vtx1); // needed to compute all variables
+                 unsetvtx=kTRUE;
+               }
+
                // find associated MC particle
-               Int_t mcLabel = vtx->MatchToMC(421, mcArray) ;
+               Int_t mcLabel = d0tokpi->MatchToMC(421, mcArray) ;
                if (mcLabel == -1) 
                        {
                                AliDebug(2,"No MC particle found");
@@ -279,34 +288,34 @@ void AliCFHeavyFlavourTaskMultiVarMultiStep::UserExec(Option_t *)
 
 
                        // fill the container...
-                       Double_t pt = vtx->Pt();
-                       Double_t rapidity = vtx->YD0();
+                       Double_t pt = d0tokpi->Pt();
+                       Double_t rapidity = d0tokpi->YD0();
                        
                        Double_t cosThetaStar = 9999.;
                        Double_t pTpi = 0.;
                        Double_t pTK = 0.;
-                       Double_t dca = vtx->GetDCA();
+                       Double_t dca = d0tokpi->GetDCA();
                        Double_t d0pi = 0.;
                        Double_t d0K = 0.;
-                       Double_t d0xd0 = vtx->Prodd0d0();
-                       Double_t cosPointingAngle = vtx->CosPointingAngle();
+                       Double_t d0xd0 = d0tokpi->Prodd0d0();
+                       Double_t cosPointingAngle = d0tokpi->CosPointingAngle();
                        Int_t pdgCode = mcVtxHF->GetPdgCode();
                        if (pdgCode > 0){
-                               cosThetaStar = vtx->CosThetaStarD0();
-                               pTpi = vtx->PtProng(0);
-                               pTK = vtx->PtProng(1);
-                               d0pi = vtx->Getd0Prong(0);
-                               d0K = vtx->Getd0Prong(1);
+                               cosThetaStar = d0tokpi->CosThetaStarD0();
+                               pTpi = d0tokpi->PtProng(0);
+                               pTK = d0tokpi->PtProng(1);
+                               d0pi = d0tokpi->Getd0Prong(0);
+                               d0K = d0tokpi->Getd0Prong(1);
                        }
                        else {
-                               cosThetaStar = vtx->CosThetaStarD0bar();
-                               pTpi = vtx->PtProng(1);
-                               pTK = vtx->PtProng(0);
-                               d0pi = vtx->Getd0Prong(1);
-                               d0K = vtx->Getd0Prong(0);
+                               cosThetaStar = d0tokpi->CosThetaStarD0bar();
+                               pTpi = d0tokpi->PtProng(1);
+                               pTK = d0tokpi->PtProng(0);
+                               d0pi = d0tokpi->Getd0Prong(1);
+                               d0K = d0tokpi->Getd0Prong(0);
                        }
 
-                       Double_t cT = vtx->CtD0();
+                       Double_t cT = d0tokpi->CtD0();
 
                        if (!fFillFromGenerated){
                                // ...either with reconstructed values....
@@ -348,8 +357,8 @@ void AliCFHeavyFlavourTaskMultiVarMultiStep::UserExec(Option_t *)
                        fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructed) ;   
 
                        // cut in acceptance
-                       Bool_t acceptanceProng0 = (TMath::Abs(vtx->EtaProng(0))< 0.9 && vtx->PtProng(0) > 0.1);
-                       Bool_t acceptanceProng1 = (TMath::Abs(vtx->EtaProng(1))< 0.9 && vtx->PtProng(1) > 0.1);
+                       Bool_t acceptanceProng0 = (TMath::Abs(d0tokpi->EtaProng(0))< 0.9 && d0tokpi->PtProng(0) > 0.1);
+                       Bool_t acceptanceProng1 = (TMath::Abs(d0tokpi->EtaProng(1))< 0.9 && d0tokpi->PtProng(1) > 0.1);
                        if (acceptanceProng0 && acceptanceProng1) {
                                AliDebug(2,"D0 reco daughters in acceptance");
                                fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoAcceptance) ;
@@ -357,7 +366,7 @@ void AliCFHeavyFlavourTaskMultiVarMultiStep::UserExec(Option_t *)
 
                                // cut on the min n. of clusters in ITS
                                Int_t ncls0=0;
-                               for(Int_t l=0;l<6;l++) if(TESTBIT(vtx->GetITSClusterMap(),l)) ncls0++;
+                               for(Int_t l=0;l<6;l++) if(TESTBIT(d0tokpi->GetITSClusterMap(),l)) ncls0++;
                                AliDebug(2, Form("n clusters = %d", ncls0));
                                if (ncls0 >= fMinITSClusters){
                                        fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoITSClusters) ;
@@ -365,7 +374,7 @@ void AliCFHeavyFlavourTaskMultiVarMultiStep::UserExec(Option_t *)
                                        AliDebug(2,Form("pT = %f, dca = %f, cosThetaStar = %f, pTpi = %f, pTK = %f, d0pi = %f, d0K = %f, d0xd0 = %f, cosPointingAngle = %f", pt, dca, cosThetaStar,pTpi, pTK, d0pi*1E4, d0K*1E4, d0xd0*1E8, cosPointingAngle));
 
                                        // PPR cuts 
-                                       Double_t cuts[6];
+                                       Double_t cuts[6] = {9999999., 1.1, 0., 9999999., 9999999., 0.};
                                        if (pt <= 1){
                                                cuts[0] = 400;
                                                cuts[1] = 0.8;
@@ -450,7 +459,8 @@ void AliCFHeavyFlavourTaskMultiVarMultiStep::UserExec(Option_t *)
                                }
                        }
                }
-       }
+               if(unsetvtx) d0tokpi->UnsetOwnPrimaryVtx();
+       } // end loop on D0->Kpi
 
        AliDebug(2, Form("Found %i Reco particles that are D0!!",icountReco));
 
@@ -831,6 +841,45 @@ void AliCFHeavyFlavourTaskMultiVarMultiStep::Terminate(Option_t*)
        c4->cd(6);
        c4->cd();
 
+       TFile* file_projection = new TFile("file_projection.root","RECREATE");
+       h00->Write("pT_D0_step0");
+       h10->Write("rapidity_step0");
+       h20->Write("cosThetaStar_step0");
+       h30->Write("pT_pi_step0");
+       h40->Write("pT_K_step0");
+       h50->Write("cT_step0");
+       h60->Write("dca_step0");
+       h70->Write("d0_pi_step0");
+       h80->Write("d0_K_step0");
+       h90->Write("d0xd0_step0");
+       h100->Write("cosPointingAngle_step0");
+
+       h01->Write("pT_D0_step1");
+       h11->Write("rapidity_step1");
+       h21->Write("cosThetaStar_step1");
+       h31->Write("pT_pi_step1");
+       h41->Write("pT_K_step1");
+       h51->Write("cT_step1");
+       h61->Write("dca_step1");
+       h71->Write("d0_pi_step1");
+       h81->Write("d0_K_step1");
+       h91->Write("d0xd0_step1");
+       h101->Write("cosPointingAngle_step1");
+
+       h02->Write("pT_D0_step2");
+       h12->Write("rapidity_step2");
+       h22->Write("cosThetaStar_step2");
+       h32->Write("pT_pi_step2");
+       h42->Write("pT_K_step2");
+       h52->Write("cT_step2");
+       h62->Write("dca_step2");
+       h72->Write("d0_pi_step2");
+       h80->Write("d0_K_step2");
+       h92->Write("d0xd0_step2");
+       h102->Write("cosPointingAngle_step2");
+
+       file_projection->Close();
+
        /*
        c1->SaveAs("Plots/pT_rapidity_cosThetaStar.eps");
        c2->SaveAs("Plots/pTpi_pTK_cT.eps");