]>
Commit | Line | Data |
---|---|---|
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" | |
088ca370 | 14 | #include "AliRsnMiniEvent.h" |
03d23846 | 15 | #include "AliRsnMiniParticle.h" |
16 | ||
17 | ClassImp(AliRsnMiniParticle) | |
18 | ||
19 | //__________________________________________________________________________________________________ | |
20 | void AliRsnMiniParticle::CopyDaughter(AliRsnDaughter *daughter) | |
21 | { | |
22 | // | |
23 | // Sets data members from the passed object | |
24 | // | |
25 | ||
26 | // reset what could not be initialized | |
213adb92 | 27 | fDCA = 0.0; //typically used for D0 analysis |
03d23846 | 28 | fPDG = 0; |
29 | fMother = -1; | |
30 | fMotherPDG = 0; | |
088ca370 | 31 | fNTotSisters = -1; |
03d23846 | 32 | fCutBits = 0x0; |
35b36c39 | 33 | fPsim[0] = fPrec[0] = fPmother[0] = fPsim[1] = fPrec[1] = fPmother[1] = fPsim[2] = fPrec[2] = fPmother[2] = 0.0; |
03d23846 | 34 | |
35 | // charge | |
36 | if (daughter->IsPos()) | |
37 | fCharge = '+'; | |
38 | else if (daughter->IsNeg()) | |
39 | fCharge = '-'; | |
40 | else | |
41 | fCharge = '0'; | |
61f275d1 | 42 | |
03d23846 | 43 | // rec info |
44 | if (daughter->GetRef()) { | |
45 | fPrec[0] = daughter->GetRef()->Px(); | |
46 | fPrec[1] = daughter->GetRef()->Py(); | |
47 | fPrec[2] = daughter->GetRef()->Pz(); | |
48 | } | |
61f275d1 | 49 | |
03d23846 | 50 | // MC info |
51 | if (daughter->GetRefMC()) { | |
52 | fPsim[0] = daughter->GetRefMC()->Px(); | |
53 | fPsim[1] = daughter->GetRefMC()->Py(); | |
54 | fPsim[2] = daughter->GetRefMC()->Pz(); | |
55 | fPDG = daughter->GetPDG(); | |
56 | fMother = daughter->GetMother(); | |
57 | fMotherPDG = daughter->GetMotherPDG(); | |
58 | } | |
213adb92 | 59 | |
60 | AliRsnEvent *event = (AliRsnEvent *) daughter->GetOwnerEvent(); | |
088ca370 | 61 | if (!event) { |
62 | AliWarning("Invalid reference event: cannot copy DCA nor Nsisters."); | |
63 | return; | |
64 | } | |
65 | if (event->IsAOD()){ | |
66 | // DCA to Primary Vertex for AOD | |
213adb92 | 67 | AliAODTrack *track = (AliAODTrack*) daughter->Ref2AODtrack(); |
68 | AliAODEvent *aodEvent = (AliAODEvent*) event->GetRefAOD(); | |
69 | if (track && aodEvent) { | |
70 | AliVVertex *vertex = (AliVVertex*) aodEvent->GetPrimaryVertex(); | |
71 | Double_t b[2], cov[3]; | |
72 | if (vertex) { | |
670857a6 | 73 | if ( !((track->GetStatus() & AliESDtrack::kTPCin) == 0) && !((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) && !((track->GetStatus() & AliESDtrack::kITSrefit) == 0) ){ |
f8c54226 | 74 | if (track->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b, cov)) |
75 | fDCA = b[0]; | |
670857a6 | 76 | } |
213adb92 | 77 | } |
78 | } | |
35b36c39 | 79 | // Number of Daughters from MC and Momentum of the Mother |
088ca370 | 80 | if (event->GetRefMC()) { |
81 | TClonesArray * list = event->GetAODList(); | |
82 | AliAODMCParticle *part = (AliAODMCParticle *)list->At(fMother); | |
35b36c39 | 83 | if (part) { |
84 | fNTotSisters = part->GetNDaughters(); | |
85 | fPmother[0] = part->Px(); | |
86 | fPmother[1] = part->Py(); | |
87 | fPmother[2] = part->Pz(); | |
88 | } | |
088ca370 | 89 | } |
213adb92 | 90 | } else { |
088ca370 | 91 | if (event->IsESD()){ |
92 | //DCA to Primary Vertex for ESD | |
93 | AliESDtrack *track = (AliESDtrack*) daughter->Ref2ESDtrack(); | |
94 | AliESDEvent *esdEvent = (AliESDEvent*) event->GetRefESD(); | |
95 | if (track && esdEvent) { | |
96 | AliVVertex *vertex = (AliVVertex*) esdEvent->GetPrimaryVertex(); | |
97 | Double_t b[2], cov[3]; | |
98 | if (vertex) { | |
670857a6 | 99 | if ( !((track->GetStatus() & AliESDtrack::kTPCin) == 0) && !((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) && !((track->GetStatus() & AliESDtrack::kITSrefit) == 0) ){ |
f8c54226 | 100 | if (track->PropagateToDCA(vertex, esdEvent->GetMagneticField(), kVeryBig, b, cov)) |
101 | fDCA = b[0]; | |
670857a6 | 102 | } |
088ca370 | 103 | } |
104 | } | |
35b36c39 | 105 | // Number of Daughters from MC and Momentum of the Mother |
088ca370 | 106 | if (event->GetRefMC()) { |
107 | AliMCParticle *part = (AliMCParticle *)event->GetRefMC()->GetTrack(fMother); | |
35b36c39 | 108 | if(part){ |
109 | fNTotSisters = part->Particle()->GetNDaughters(); | |
110 | fPmother[0] = part->Px(); | |
111 | fPmother[1] = part->Py(); | |
112 | fPmother[2] = part->Pz(); | |
113 | } | |
088ca370 | 114 | } |
115 | } | |
213adb92 | 116 | } |
03d23846 | 117 | } |
4fb0dfa3 | 118 | |
4fb0dfa3 | 119 | //__________________________________________________________________________________________________ |
120 | Double_t AliRsnMiniParticle::Mass() | |
121 | { | |
122 | // | |
123 | // return mass of particle | |
124 | // | |
125 | ||
126 | TDatabasePDG *db = TDatabasePDG::Instance(); | |
127 | TParticlePDG *part = db->GetParticle(PDG()); | |
128 | return part->Mass(); | |
129 | } | |
130 | ||
131 | //__________________________________________________________________________________________________ | |
132 | void AliRsnMiniParticle::Set4Vector(TLorentzVector &v, Float_t mass, Bool_t mc) | |
133 | { | |
134 | // | |
135 | // return 4 vector of particle | |
136 | // | |
137 | ||
138 | if (mass<0.0) mass = Mass(); | |
139 | v.SetXYZM(Px(mc), Py(mc), Pz(mc),mass); | |
140 | } |