X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliCascadeVertexer.cxx;h=be8cacd30000318b3301a47744b1f913383be9ca;hb=a9459f9c42e5fcf385d754fb674cbb9dd2d4733d;hp=29977eb9cd4d581488f018e187d7f00832f82ead;hpb=5d390eda0348c8ea5c63953200c852c30a0acf8d;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliCascadeVertexer.cxx b/ITS/AliCascadeVertexer.cxx index 29977eb9cd4..be8cacd3000 100644 --- a/ITS/AliCascadeVertexer.cxx +++ b/ITS/AliCascadeVertexer.cxx @@ -15,35 +15,173 @@ //------------------------------------------------------------------------- // Implementation of the cascade vertexer class -// +// Reads V0s and tracks, writes out cascade vertices +// Fills the ESD with the cascades // Origin: Christian Kuhn, IReS, Strasbourg, christian.kuhn@ires.in2p3.fr //------------------------------------------------------------------------- -#include -#include #include -#include +#include +#include "AliESD.h" +#include "AliESDv0.h" #include "AliCascadeVertex.h" #include "AliCascadeVertexer.h" -#include "AliV0vertex.h" #include "AliITStrackV2.h" +#include "AliV0vertex.h" ClassImp(AliCascadeVertexer) -Int_t -AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) { - +Int_t AliCascadeVertexer::V0sTracks2CascadeVertices(AliESD *event) { //-------------------------------------------------------------------- - //This function reconstructs cascade vertices + // This function reconstructs cascade vertices + // Adapted to the ESD by I.Belikov (Jouri.Belikov@cern.ch) //-------------------------------------------------------------------- - TFile *in=(TFile*)inp; - TDirectory *savedir=gDirectory; - // Tree for vertices(V0's) + Int_t nV0=(Int_t)event->GetNumberOfV0s(); + TObjArray vtcs(nV0); + Int_t i; + for (i=0; iGetV0(i); + vtcs.AddLast(new AliV0vertex(*esdV0)); + } + + + Int_t ntr=(Int_t)event->GetNumberOfTracks(); + TObjArray trks(ntr); + for (i=0; iGetTrack(i); + UInt_t status=esdtr->GetStatus(); + UInt_t flags=AliESDtrack::kITSin|AliESDtrack::kTPCin; + + if ((status&AliESDtrack::kITSrefit)==0) + if ((status&flags)!=status) continue; + + AliITStrackV2 *iotrack=new AliITStrackV2(*esdtr); + iotrack->SetLabel(i); // now it is the index in array of ESD tracks + if ((status&AliESDtrack::kITSrefit)==0) //correction for the beam pipe + if (!iotrack->PropagateTo(3.,0.0023,65.19)) continue; + if (!iotrack->PropagateTo(2.5,0.,0.)) continue; + trks.AddLast(iotrack); + } + ntr=trks.GetEntriesFast(); + + Double_t massLambda=1.11568; + Int_t ncasc=0; + + // Looking for the cascades... + for (i=0; iChangeMassHypothesis(kLambda0); // the v0 must be Lambda + if (TMath::Abs(v->GetEffMass()-massLambda)>fMassWin) continue; + if (v->GetD(0,0,0)GetD())Get1Pt()<0.) continue; // bachelor's charge + + AliV0vertex v0(*v), *pv0=&v0; + AliITStrackV2 bt(*b), *pbt=&bt; + + Double_t dca=PropagateToDCA(pv0,pbt); + if (dca > fDCAmax) continue; + + AliCascadeVertex cascade(*pv0,*pbt); + if (cascade.GetChi2() > fChi2max) continue; + + Double_t x,y,z; cascade.GetXYZ(x,y,z); + Double_t r2=x*x + y*y; + if (r2 > fRmax*fRmax) continue; // condition on fiducial zone + if (r2 < fRmin*fRmin) continue; + + { + Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1); + if (r2 > (x1*x1+y1*y1)) continue; + if (z*z > z1*z1) continue; + } + + Double_t px,py,pz; cascade.GetPxPyPz(px,py,pz); + Double_t p2=px*px+py*py+pz*pz; + Double_t cost=(x*px+y*py+z*pz)/TMath::Sqrt(p2*(r2+z*z)); + + if (costAddCascade(&cascade); + + ncasc++; - TTree *vtxTree=(TTree*)gDirectory->Get("TreeV0"); - TBranch *branch=vtxTree->GetBranch("vertices"); - Int_t nentrV0=(Int_t)vtxTree->GetEntries(); + } + } + + // Looking for the anti-cascades... + for (i=0; iChangeMassHypothesis(kLambda0Bar); //the v0 must be anti-Lambda + if (TMath::Abs(v->GetEffMass()-massLambda)>fMassWin) continue; + if (v->GetD(0,0,0)GetD())Get1Pt()>0.) continue; // bachelor's charge + + AliV0vertex v0(*v), *pv0=&v0; + AliITStrackV2 bt(*b), *pbt=&bt; + + Double_t dca=PropagateToDCA(pv0,pbt); + if (dca > fDCAmax) continue; + + AliCascadeVertex cascade(*pv0,*pbt); + if (cascade.GetChi2() > fChi2max) continue; + + Double_t x,y,z; cascade.GetXYZ(x,y,z); + Double_t r2=x*x + y*y; + if (r2 > fRmax*fRmax) continue; // condition on fiducial zone + if (r2 < fRmin*fRmin) continue; + + { + Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1); + if (r2 > (x1*x1+y1*y1)) continue; + if (z*z > z1*z1) continue; + } + + Double_t px,py,pz; cascade.GetPxPyPz(px,py,pz); + Double_t p2=px*px+py*py+pz*pz; + Double_t cost=(x*px+y*py+z*pz)/TMath::Sqrt(p2*(r2+z*z)); + + if (costAddCascade(&cascade); + + ncasc++; + + } + } + +Info("V0sTracks2CascadeVertices","Number of reconstructed cascades: %d",ncasc); + + trks.Delete(); + vtcs.Delete(); + + return 0; +} + +Int_t AliCascadeVertexer:: +V0sTracks2CascadeVertices(TTree *vTree,TTree *tTree, TTree *xTree) { + //-------------------------------------------------------------------- + // This function reconstructs cascade vertices + //-------------------------------------------------------------------- + Warning("V0sTracks2CascadeVertices(TTree*,TTree*,TTree*)", + "Will be removed soon ! Use V0sTracks2CascadeVertices(AliESD*) instead"); + + TBranch *branch=vTree->GetBranch("vertices"); + if (!branch) { + Error("V0sTracks2CascadeVertices","Can't get the V0 branch !"); + return 1; + } + Int_t nentrV0=(Int_t)vTree->GetEntries(); TObjArray vtxV0(nentrV0); @@ -54,20 +192,18 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) { AliV0vertex *ioVertex=new AliV0vertex; branch->SetAddress(&ioVertex); - vtxTree->GetEvent(i); + vTree->GetEvent(i); nV0++; vtxV0.AddLast(ioVertex); } - - in->cd(); - - // Tree for tracks - - TTree *trkTree=(TTree*)in->Get("TreeT_ITS_0"); - branch=trkTree->GetBranch("tracks"); - Int_t nentr=(Int_t)trkTree->GetEntries(); + branch=tTree->GetBranch("tracks"); + if (!branch) { + Error("V0sTracks2CascadeVertices","Can't get the track branch !"); + return 2; + } + Int_t nentr=(Int_t)tTree->GetEntries(); TObjArray trks(nentr); @@ -79,21 +215,19 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) { AliITStrackV2 *iotrack=new AliITStrackV2; branch->SetAddress(&iotrack); - trkTree->GetEvent(i); + tTree->GetEvent(i); - iotrack->PropagateTo(3.,0.0023,65.19); iotrack->PropagateTo(2.5,0.,0.); + if (!iotrack->PropagateTo(3.,0.0023,65.19)) continue; + if (!iotrack->PropagateTo(2.5,0.,0.)) continue; ntrack++; trks.AddLast(iotrack); } - // create Tree for cascades - - out->cd(); - - TTree cascTree("TreeCasc","Tree with cascades"); - AliCascadeVertex *ioCascade=0; - cascTree.Branch("cascades","AliCascadeVertex",&ioCascade,32000,0); + AliCascadeVertex *ioCascade=0; + branch=xTree->GetBranch("cascades"); + if (!branch) xTree->Branch("cascades","AliCascadeVertex",&ioCascade,32000,3); + else branch->SetAddress(&ioCascade); // loop on all vertices @@ -102,14 +236,14 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) { for (i=0; iChangeMassHypothesis(kLambda0); //I.B. + lV0ver->ChangeMassHypothesis(kLambda0); //I.B. - if (V0ver->GetEffMass()GetEffMass()>massLambda+fMassWin) continue; + if (lV0ver->GetEffMass()GetEffMass()>massLambda+fMassWin) continue; - if (V0ver->GetD(0,0,0)GetD(0,0,0)GetD())GetPdgCode()==kLambda0 && bachtrk->Get1Pt()<0.) continue; // condition on V0 label - if (V0ver->GetPdgCode()==kLambda0Bar && bachtrk->Get1Pt()>0.) continue; // + good sign for bachelor + if (lV0ver->GetPdgCode()==kLambda0 && bachtrk->Get1Pt()<0.) continue; // condition on V0 label + if (lV0ver->GetPdgCode()==kLambda0Bar && bachtrk->Get1Pt()>0.) continue; // + good sign for bachelor - AliV0vertex V0(*V0ver), *pV0=&V0; + AliV0vertex lV0(*lV0ver), *pV0=&lV0; AliITStrackV2 bt(*bachtrk), *pbt=&bt; // calculation of the distance of closest approach between the V0 and the bachelor @@ -145,7 +279,7 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) { { //I.B. - Double_t x1,y1,z1; V0ver->GetXYZ(x1,y1,z1); + Double_t x1,y1,z1; lV0ver->GetXYZ(x1,y1,z1); if (r2 > (x1*x1+y1*y1)) continue; if (z*z > z1*z1) continue; } @@ -161,22 +295,18 @@ AliCascadeVertexer::V0sTracks2CascadeVertices(const TFile *inp, TFile *out) { //cascade.ChangeMassHypothesis(); //default is Xi - ioCascade=&cascade; cascTree.Fill(); + ioCascade=&cascade; xTree->Fill(); ncasc++; } } - cerr<<"Number of reconstructed cascades: "<cd(); - return 0; } @@ -242,7 +372,7 @@ AliCascadeVertexer::PropagateToDCA(AliV0vertex *v, AliITStrackV2 *t) { x1=x1*cs1 + y1*sn1; if (!t->PropagateTo(x1,0.,0.)) { - cerr<<"AliV0vertexer::PropagateToDCA: propagation failed !\n"; + Error("PropagateToDCA","Propagation failed !"); return 1.e+33; }