]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliD0toKpiAnalysis.cxx
Change in the signature of base class method Use to avoid compilation warnings (icc)
[u/mrichter/AliRoot.git] / ANALYSIS / AliD0toKpiAnalysis.cxx
index be83cb5c76e78368282b3bb7e0876a4d250e671e..4da29ecd1367fa1f47258165ce2b1afd9be0c701 100644 (file)
 
 //----------------------------------------------------------------------------
 //    Implementation of the D0toKpi reconstruction and analysis class
-//
 // Note: the two decay tracks are labelled: 0 (positive track)
 //                                          1 (negative track)
-//
+// An example of usage can be found in the macro AliD0toKpiTest.C
 //            Origin: A. Dainese    andrea.dainese@pd.infn.it            
 //----------------------------------------------------------------------------
-#include <Riostream.h>
-#include <TH1.h>
-#include <TH2.h>
 #include <TKey.h>
 #include <TFile.h>
 #include <TTree.h>
@@ -40,6 +36,7 @@
 #include "AliV0vertex.h"
 #include "AliD0toKpi.h"
 #include "AliD0toKpiAnalysis.h"
+#include "AliLog.h"
 
 typedef struct {
   Int_t lab;
@@ -56,7 +53,7 @@ ClassImp(AliD0toKpiAnalysis)
 AliD0toKpiAnalysis::AliD0toKpiAnalysis() {
   // Default constructor
 
-  SetBz();
+  fBz=-9999;
   SetPtCut();
   Setd0Cut();
   SetMassCut();
@@ -66,7 +63,6 @@ AliD0toKpiAnalysis::AliD0toKpiAnalysis() {
   fVertexOnTheFly = kFALSE;
   fSim = kFALSE;
   fOnlySignal = kFALSE;
-  fDebug = kFALSE;
 }
 //----------------------------------------------------------------------------
 AliD0toKpiAnalysis::~AliD0toKpiAnalysis() {}
@@ -148,7 +144,6 @@ void AliD0toKpiAnalysis::FindCandidates(Int_t evFirst,Int_t evLast,
     printf("AliD0toKpiAnalysis::FindCandidates():  Set B!\n");
     return;
   }
-  AliKalmanTrack::SetConvConst(100/0.299792458/fBz);
 
   TString trkName("AliITStracksV2.root");
   if(gSystem->AccessPathName(trkName.Data(),kFileExists)) {
@@ -176,7 +171,6 @@ void AliD0toKpiAnalysis::FindCandidates(Int_t evFirst,Int_t evLast,
   // (it will be used only if fVertexOnTheFly=kTrue)
   AliITSVertexerTracks *vertexer1 = new AliITSVertexerTracks;
   vertexer1->SetMinTracks(2);
-  vertexer1->SetDebug(0);
   Int_t  skipped[2];
   Bool_t goodVtx1;
   
@@ -380,7 +374,6 @@ void AliD0toKpiAnalysis::FindCandidatesESD(Int_t evFirst,Int_t evLast,
     printf("AliD0toKpiAnalysis::FindCandidatesESD():  Set B!\n");
     return;
   }
-  AliKalmanTrack::SetConvConst(100/0.299792458/fBz);
 
   TString esdName("AliESDs.root");
   if(gSystem->AccessPathName(esdName.Data(),kFileExists)) {
@@ -391,7 +384,6 @@ void AliD0toKpiAnalysis::FindCandidatesESD(Int_t evFirst,Int_t evLast,
   TString outName1=outName;
   TString outName2("nTotEvents.dat");
 
-  Double_t covV1[6];
   Int_t    nTotEv=0,nD0rec=0,nD0rec1ev=0;
   Double_t dca;
   Double_t v2[3],mom[6],d0[2];
@@ -408,7 +400,6 @@ void AliD0toKpiAnalysis::FindCandidatesESD(Int_t evFirst,Int_t evLast,
   // (it will be used only if fVertexOnTheFly=kTrue)
   AliITSVertexerTracks *vertexer1 = new AliITSVertexerTracks;
   vertexer1->SetMinTracks(2);
-  vertexer1->SetDebug(0);
   Int_t  skipped[2];
   Bool_t goodVtx1;
   
@@ -432,14 +423,19 @@ void AliD0toKpiAnalysis::FindCandidatesESD(Int_t evFirst,Int_t evLast,
 
   // open file with tracks
   TFile *esdFile = TFile::Open(esdName.Data());
+  AliESD* event = new AliESD;
+  TTree* tree = (TTree*) esdFile->Get("esdTree");
+  if (!tree) {
+    Error("FindCandidatesESD", "no ESD tree found");
+    return;
+  }
+  tree->SetBranchAddress("ESD", &event);
 
-  TKey *key=0;
-  TIter next(esdFile->GetListOfKeys());
   // loop on events in file
-  while ((key=(TKey*)next())!=0) {
-    AliESD *event=(AliESD*)key->ReadObj();
+  for (Int_t iEvent = evFirst; iEvent < tree->GetEntries(); iEvent++) {
+    if (iEvent > evLast) break;
+    tree->GetEvent(iEvent);
     Int_t ev = (Int_t)event->GetEventNumber();
-    if(ev<evFirst || ev>evLast) { delete event; continue; }
     printf("--- Finding D0 -> Kpi in event %d\n",ev);
 
     // retrieve primary vertex from file
@@ -447,7 +443,7 @@ void AliD0toKpiAnalysis::FindCandidatesESD(Int_t evFirst,Int_t evLast,
     //AliESDVertex *vertex1stored = (AliESDVertex*)trkFile->Get(vtxName);
     //vertex1stored->GetXYZ(fV1);
     //delete vertex1stored;
-    event->GetVertex(fV1,covV1);
+    event->GetVertex()->GetXYZ(fV1);
 
     trkEntries = event->GetNumberOfTracks();
     printf(" Number of tracks: %d\n",trkEntries);
@@ -470,13 +466,13 @@ void AliD0toKpiAnalysis::FindCandidatesESD(Int_t evFirst,Int_t evLast,
                             trksN,trkEntryN,nTrksN);
     }      
 
-    if(fDebug) printf(" pos. tracks: %d    neg .tracks: %d\n",nTrksP,nTrksN);
+    AliDebugClass(1,Form(" pos. tracks: %d    neg .tracks: %d",nTrksP,nTrksN));
 
     nD0rec1ev = 0;
 
     // loop on positive tracks
     for(iTrkP=0; iTrkP<nTrksP; iTrkP++) {
-      if((iTrkP%10==0) || fDebug) printf("  Processing positive track number %d of %d\n",iTrkP,nTrksP);
+      if(iTrkP%10==0) AliDebugClass(1,Form("  Processing positive track number %d of %d",iTrkP,nTrksP));
          
       // get track from track array
       postrack = (AliITStrackV2*)trksP.UncheckedAt(iTrkP);
@@ -592,7 +588,6 @@ void AliD0toKpiAnalysis::FindCandidatesESD(Int_t evFirst,Int_t evLast,
     delete [] trkEntryP;
     delete [] trkEntryN;
     delete trkTree;
-    delete event;
 
 
     printf(" Number of D0 candidates: %d\n",nD0rec1ev);
@@ -748,7 +743,6 @@ void AliD0toKpiAnalysis::SelectTracksESD(AliESD &event,
  
   // transfer ITS tracks from ESD to arrays and to a tree
   for(Int_t i=0; i<entr; i++) {
-    //if(fDebug) printf(" SelectTracksESD: %d/%d\n",i,entr);
 
     AliESDtrack *esdtrack = (AliESDtrack*)event.GetTrack(i);
     UInt_t status = esdtrack->GetStatus();