]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/AliRsnMiniParticle.cxx
Added new class for D0 daughter cuts (Massimo)
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnMiniParticle.cxx
CommitLineData
03d23846 1//
2// This object is used as lightweight temporary container
61f275d1 3// of all information needed from any input object and
03d23846 4// useful for resonance analysis.
5// Lists of such objects are stored in a buffer, in order
6// to allow an event mixing.
7//
8
4fb0dfa3 9#include <TDatabasePDG.h>
10#include <TParticlePDG.h>
11
213adb92 12#include "AliAODEvent.h"
13#include "AliRsnEvent.h"
03d23846 14#include "AliRsnMiniParticle.h"
15
16ClassImp(AliRsnMiniParticle)
17
18//__________________________________________________________________________________________________
19void AliRsnMiniParticle::CopyDaughter(AliRsnDaughter *daughter)
20{
21//
22// Sets data members from the passed object
23//
24
25 // reset what could not be initialized
213adb92 26 fDCA = 0.0; //typically used for D0 analysis
03d23846 27 fPDG = 0;
28 fMother = -1;
29 fMotherPDG = 0;
30 fCutBits = 0x0;
31 fPsim[0] = fPrec[0] = fPsim[1] = fPrec[1] = fPsim[2] = fPrec[2] = 0.0;
32
33 // charge
34 if (daughter->IsPos())
35 fCharge = '+';
36 else if (daughter->IsNeg())
37 fCharge = '-';
38 else
39 fCharge = '0';
61f275d1 40
03d23846 41 // rec info
42 if (daughter->GetRef()) {
43 fPrec[0] = daughter->GetRef()->Px();
44 fPrec[1] = daughter->GetRef()->Py();
45 fPrec[2] = daughter->GetRef()->Pz();
46 }
61f275d1 47
03d23846 48 // MC info
49 if (daughter->GetRefMC()) {
50 fPsim[0] = daughter->GetRefMC()->Px();
51 fPsim[1] = daughter->GetRefMC()->Py();
52 fPsim[2] = daughter->GetRefMC()->Pz();
53 fPDG = daughter->GetPDG();
54 fMother = daughter->GetMother();
55 fMotherPDG = daughter->GetMotherPDG();
56 }
213adb92 57
58 AliRsnEvent *event = (AliRsnEvent *) daughter->GetOwnerEvent();
59 if (event && event->IsAOD()){
60 AliAODTrack *track = (AliAODTrack*) daughter->Ref2AODtrack();
61 AliAODEvent *aodEvent = (AliAODEvent*) event->GetRefAOD();
62 if (track && aodEvent) {
63 AliVVertex *vertex = (AliVVertex*) aodEvent->GetPrimaryVertex();
64 Double_t b[2], cov[3];
65 if (vertex) {
66 track->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b, cov);
67 fDCA = b[0];
68 }
69 }
70 } else {
71 AliWarning("DCA not implemented for ESDs");
72 }
73
03d23846 74}
4fb0dfa3 75
4fb0dfa3 76//__________________________________________________________________________________________________
77Double_t AliRsnMiniParticle::Mass()
78{
79 //
80 // return mass of particle
81 //
82
83 TDatabasePDG *db = TDatabasePDG::Instance();
84 TParticlePDG *part = db->GetParticle(PDG());
85 return part->Mass();
86}
87
88//__________________________________________________________________________________________________
89void AliRsnMiniParticle::Set4Vector(TLorentzVector &v, Float_t mass, Bool_t mc)
90{
91 //
92 // return 4 vector of particle
93 //
94
95 if (mass<0.0) mass = Mass();
96 v.SetXYZM(Px(mc), Py(mc), Pz(mc),mass);
97}