]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Some fixes and cleanup (Andrea)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 Apr 2008 15:36:04 +0000 (15:36 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 Apr 2008 15:36:04 +0000 (15:36 +0000)
PWG3/AliAnalysisTaskSESelectHF.cxx
PWG3/AliAnalysisTaskSESelectHFTest.C
PWG3/ReadAODVertexingHF.C

index c98ffba783a2d9e0874409ac9d3446594337424f..c559e783f6aac0881872475620364af9369c7eaa 100644 (file)
@@ -98,13 +98,17 @@ void AliAnalysisTaskSESelectHF::UserExec(Option_t */*option*/)
   // load D0->Kpi candidates                                                   
   TClonesArray *inputArrayD0toKpi =
     (TClonesArray*)aodIn->GetList()->FindObject("D0toKpi");
+  if(!inputArrayD0toKpi) {
+    printf("AliAnalysisTaskSESelectHF::UserExec: D0toKpi branch not found!\n");
+    return;
+  }
 
   //print event info
-  aodIn->GetHeader()->Print();
+  //aodIn->GetHeader()->Print();
   
   // primary vertex
   AliAODVertex *vtx1 = (AliAODVertex*)aodIn->GetPrimaryVertex();
-  vtx1->Print();
+  //vtx1->Print();
     
   // make trkIDtoEntry register (temporary)
   Int_t trkIDtoEntry[100000];
@@ -142,7 +146,7 @@ void AliAnalysisTaskSESelectHF::UserExec(Option_t */*option*/)
       //AliAODTrack *trk0 = (AliAODTrack*)(dIn->GetSecondaryVtx()->GetDaughter(0));
       printf("pt of positive track: %f\n",trk0->Pt());
       printf("pt of negative track: %f\n",trk1->Pt());
-
+      // HERE ONE COULD RECALCULATE THE VERTEX USING THE KF PACKAGE
 
       // clone candidate for output AOD
       AliAODVertex *v = new(verticesHFRef[iOutVerticesHF++]) 
@@ -154,11 +158,13 @@ void AliAnalysisTaskSESelectHF::UserExec(Option_t */*option*/)
       Double_t d0err[2]={dIn->Getd0errProng(0),dIn->Getd0errProng(1)};
       AliAODRecoDecayHF2Prong *dOut=new(aodD0toKpiRef[iOutD0toKpi++]) 
        AliAODRecoDecayHF2Prong(v,px,py,pz,d0,d0err,dIn->GetDCA());
-      dOut->SetOwnPrimaryVtx(dIn->GetOwnPrimaryVtx());
+      dOut->SetOwnPrimaryVtx((AliAODVertex*)((dIn->GetOwnPrimaryVtx())->Clone()));
     }
     if(unsetvtx) dIn->UnsetOwnPrimaryVtx();
   } // end loop on D0->Kpi
 
+  printf("Number of selected D0->Kpi: %d\n",iOutD0toKpi);
+
 
   return;
 }
index 3ab1b9ea46e0d32b863d37de57bc813fa45d167b..a0e870c9e72d724d825f107d973ed5c3f681beef 100644 (file)
@@ -83,7 +83,7 @@ void AliAnalysisTaskSESelectHFTest()
                      100000.,\r
                      100000.,\r
                      100000000.,\r
-                     0.9}; \r
+                     -0.9}; \r
   hfTask->SetD0toKpiCuts(cutsD0);\r
   \r
   mgr->AddTask(hfTask);\r
index 0e33f79343c124315375bd97cb95861efccfd820..efbece7182413f003876beadb30be49f1117fcbc 100644 (file)
@@ -2,7 +2,8 @@ void ReadAODVertexingHF(const char *aodFileName="AliAOD.root",
                        const char *aodHFFileName="AliAOD.VertexingHF.root") 
 {
   //
-  // Example macro to read D0->Kpi candidates from AOD and apply cuts
+  // Example macro to read D0->Kpi candidates from AOD (having the
+  // standard AOD + a friend heavy-flavour AOD) and apply cuts
   // Origin: A.Dainese
   //
   gSystem->Load("libANALYSIS.so");
@@ -121,7 +122,6 @@ void ReadAODVertexingHF(const char *aodFileName="AliAOD.root",
       }
       if(unsetvtx) d->UnsetOwnPrimaryVtx();
     }
-    // Instanciates vHF and loads its parameters
     
     // count 3prong candidates
     Int_t n3Prong = array3Prong->GetEntriesFast();
@@ -157,3 +157,115 @@ void ReadAODVertexingHF(const char *aodFileName="AliAOD.root",
 
   return;
 }
+//------------------------------------------------------------------------
+void ReadAODVertexingHFsa(const char *aodHFFileName="AliAOD.VertexingHF.sa.root") 
+{
+  //
+  // Example macro to read D0->Kpi candidates from a stand-alone
+  // heavy-flavour AOD (i.e. without standard AOD) and apply cuts
+  // Origin: A.Dainese
+  //
+  gSystem->Load("libANALYSIS.so");
+  gSystem->Load("libANALYSISalice.so");
+  gSystem->Load("libAOD.so");
+  gSystem->Load("libPWG3base.so");
+
+  // create a test histogram
+  TH2F *hCPtaVSd0d0 = new TH2F("hCPtaVSd0d0","D^{0} correlation plot",1000,-50000,50000,1000,-1,1);
+  hCPtaVSd0d0->SetXTitle("Product of impact parameters [#mu m^{2}]");
+  hCPtaVSd0d0->SetYTitle("Cosine of pointing angle");
+  TH1F *hMass = new TH1F("hMass","D^{0} mass plot",100,1.7,2);
+  hMass->SetXTitle("Invariant mass [GeV]");
+  hMass->SetYTitle("Entries");
+  TH1F *hSecVtxZ = new TH1F("hSecVtxZ","D^{0} decay vertex z",1000,-10,10);
+  hSecVtxZ->SetXTitle("z of decay vertex [cm]");
+  hSecVtxZ->SetYTitle("Entries");
+
+  // open input file and get the TTree
+  TFile inFile(aodHFFileName,"READ");
+  if (!inFile.IsOpen()) return;
+
+  TTree *aodTree = (TTree*)inFile.Get("aodTree");
+
+  AliAODEvent *aod = new AliAODEvent();
+
+  aod->ReadFromTree(aodTree);
+
+  // load heavy flavour vertices
+  TClonesArray *arrayVerticesHF = 
+    (TClonesArray*)aod->GetList()->FindObject("VerticesHF"); 
+  
+  // load D0->Kpi candidates
+  TClonesArray *arrayD0toKpi = 
+    (TClonesArray*)aod->GetList()->FindObject("D0toKpi"); 
+     
+
+  Double_t cutsD0[9]=
+  // cutsD0[0] = inv. mass half width [GeV]
+  // cutsD0[1] = dca [cm]
+  // cutsD0[2] = cosThetaStar
+  // cutsD0[3] = pTK [GeV/c]
+  // cutsD0[4] = pTPi [GeV/c]
+  // cutsD0[5] = d0K [cm]   upper limit!
+  // cutsD0[6] = d0Pi [cm]  upper limit!
+  // cutsD0[7] = d0d0 [cm^2]
+  // cutsD0[8] = cosThetaPoint
+                     {1000.,
+                     100000.,
+                     1.1,
+                     0.,
+                     0.,
+                     100000.,
+                     100000.,
+                     100000000.,
+                     -1.1}; 
+
+  Int_t nTotHF=0,nTotD0toKpi=0;
+  AliAODVertex *vtx1=0;
+
+  // loop over events
+  Int_t nEvents = aodTree->GetEntries();
+  for (Int_t nEv = 0; nEv < nEvents; nEv++) {
+    cout<<"\n------------ Event: "<<nEv<<" ------------------"<<endl;
+
+    // read event
+    aodTree->GetEvent(nEv);
+    //aodTree->BranchRef();
+
+    
+    // loop over D0->Kpi candidates
+    Int_t nD0toKpi = arrayD0toKpi->GetEntriesFast();
+    nTotD0toKpi += nD0toKpi;
+    cout<<"Number of D0->Kpi: "<<nD0toKpi<<endl;
+    
+    for (Int_t iD0toKpi = 0; iD0toKpi < nD0toKpi; iD0toKpi++) {
+      AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)arrayD0toKpi->UncheckedAt(iD0toKpi);
+      Int_t okD0=0,okD0bar=0; 
+      if(d->SelectD0(cutsD0,okD0,okD0bar)) {
+       //cout<<1e8*d->Prodd0d0()<<endl;
+       hMass->Fill(d->InvMassD0(),0.5);
+       hMass->Fill(d->InvMassD0bar(),0.5);
+       hCPtaVSd0d0->Fill(1e8*d->Prodd0d0(),d->CosPointingAngle());
+       hSecVtxZ->Fill(d->GetSecVtxZ());
+       //cout<<d->GetSecVtxZ() <<endl;
+
+      }
+    }
+    
+  }
+  
+  printf("\n Total D0->Kpi: %d\n",nTotD0toKpi);
+
+  TCanvas *c = new TCanvas("c","c",0,0,1000,1000);
+  c->Divide(2,2);
+  c->cd(1);
+  hCPtaVSd0d0->Draw("colz");
+  c->cd(2);
+  hMass->SetFillColor(4);
+  hMass->Draw();
+  c->cd(3);
+  hSecVtxZ->SetFillColor(2);
+  hSecVtxZ->Draw();
+
+  return;
+}