]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG3/AliD0toKpiAnalysis.cxx
Initialisation.
[u/mrichter/AliRoot.git] / PWG3 / AliD0toKpiAnalysis.cxx
index e9294d2dd6c455b52076f888f1ae50f32a04c159..80fd461fcf690a7967b9222e66f8d1590c93b1ab 100644 (file)
@@ -26,7 +26,7 @@
 #include <TString.h>
 #include <TSystem.h>
 #include <TParticle.h>
-#include "AliESD.h"
+#include "AliESDEvent.h"
 #include "AliMC.h"
 #include "AliRun.h"
 #include "AliRunLoader.h"
@@ -50,18 +50,19 @@ typedef struct {
 ClassImp(AliD0toKpiAnalysis)
 
 //----------------------------------------------------------------------------
-AliD0toKpiAnalysis::AliD0toKpiAnalysis() {
+AliD0toKpiAnalysis::AliD0toKpiAnalysis():
+fVertexOnTheFly(kFALSE),
+fSim(kFALSE),
+fOnlySignal(kFALSE),
+fPID("TOFparam_PbPb"),
+fPtCut(0.),
+fd0Cut(0.), 
+fMassCut(1000.)
+ {
   // Default constructor
 
-  SetPtCut();
-  Setd0Cut();
-  SetMassCut();
   SetD0Cuts();
   SetVertex1();
-  SetPID();
-  fVertexOnTheFly = kFALSE;
-  fSim = kFALSE;
-  fOnlySignal = kFALSE;
 }
 //----------------------------------------------------------------------------
 AliD0toKpiAnalysis::~AliD0toKpiAnalysis() {}
@@ -162,7 +163,7 @@ void AliD0toKpiAnalysis::FindCandidates(Int_t evFirst,Int_t evLast,
 
   // create the AliVertexerTracks object
   // (it will be used only if fVertexOnTheFly=kTrue)
-  AliVertexerTracks *vertexer1 = new AliVertexerTracks;
+  AliVertexerTracks *vertexer1 = new AliVertexerTracks();
   if(fVertexOnTheFly) {
     // open the mean vertex
     TFile *invtx = new TFile("AliESDVertexMean.root");
@@ -181,13 +182,13 @@ void AliD0toKpiAnalysis::FindCandidates(Int_t evFirst,Int_t evLast,
 
   // open file with tracks
   TFile *esdFile = TFile::Open(esdName.Data());
-  AliESD* event = new AliESD;
+  AliESDEvent* event = new AliESDEvent();
   TTree* tree = (TTree*) esdFile->Get("esdTree");
   if(!tree) {
     Error("FindCandidatesESD", "no ESD tree found");
     return;
   }
-  tree->SetBranchAddress("ESD",&event);
+  event->ReadFromTree(tree);
 
   // loop on events in file
   for(Int_t iEvent = evFirst; iEvent < tree->GetEntries(); iEvent++) {
@@ -264,6 +265,7 @@ void AliD0toKpiAnalysis::FindCandidates(Int_t evFirst,Int_t evLast,
          goodVtx1 = kFALSE;
          if(SelectInvMass(mom)) {
            // primary vertex from *other* tracks in the event
+           vertexer1->SetFieldkG(event->GetMagneticField());
            skipped[0] = trkEntryP[iTrkP];
            skipped[1] = trkEntryN[iTrkN];
            vertexer1->SetSkipTracks(2,skipped);
@@ -425,7 +427,7 @@ Bool_t AliD0toKpiAnalysis::SelectInvMass(const Double_t p[6]) const {
   return kFALSE;
 }
 //-----------------------------------------------------------------------------
-void AliD0toKpiAnalysis::SelectTracks(AliESD *event,
+void AliD0toKpiAnalysis::SelectTracks(AliESDEvent *event,
         TObjArray &trksP,Int_t *trkEntryP,Int_t &nTrksP,
         TObjArray &trksN,Int_t *trkEntryN,Int_t &nTrksN) const {
   // Create two TObjArrays with positive and negative tracks and 
@@ -514,9 +516,9 @@ void AliD0toKpiAnalysis::MakeTracksRefFile(AliRun *gAlice,
   TParticle *mumpart;
   REFTRACK   reftrk;
   
-  AliESD* event = new AliESD;
+  AliESDEvent* event = new AliESDEvent();
   TTree* tree = (TTree*) esdFile->Get("esdTree");
-  tree->SetBranchAddress("ESD",&event);
+  event->ReadFromTree(tree);
   // loop on events in file
   for(Int_t iEvent=evFirst; iEvent<tree->GetEntries(); iEvent++) {
     if(iEvent>evLast) break;