]>
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" |
31dbef4e | 13 | #include "AliMCEvent.h" |
213adb92 | 14 | #include "AliRsnEvent.h" |
088ca370 | 15 | #include "AliRsnMiniEvent.h" |
03d23846 | 16 | #include "AliRsnMiniParticle.h" |
17 | ||
18 | ClassImp(AliRsnMiniParticle) | |
19 | ||
20 | //__________________________________________________________________________________________________ | |
21 | void AliRsnMiniParticle::CopyDaughter(AliRsnDaughter *daughter) | |
22 | { | |
23 | // | |
24 | // Sets data members from the passed object | |
25 | // | |
26 | ||
27 | // reset what could not be initialized | |
213adb92 | 28 | fDCA = 0.0; //typically used for D0 analysis |
03d23846 | 29 | fPDG = 0; |
30 | fMother = -1; | |
31 | fMotherPDG = 0; | |
088ca370 | 32 | fNTotSisters = -1; |
31dbef4e | 33 | fIsFromB = kFALSE; |
34 | fIsQuarkFound = kFALSE; | |
03d23846 | 35 | fCutBits = 0x0; |
35b36c39 | 36 | fPsim[0] = fPrec[0] = fPmother[0] = fPsim[1] = fPrec[1] = fPmother[1] = fPsim[2] = fPrec[2] = fPmother[2] = 0.0; |
03d23846 | 37 | |
38 | // charge | |
39 | if (daughter->IsPos()) | |
40 | fCharge = '+'; | |
41 | else if (daughter->IsNeg()) | |
42 | fCharge = '-'; | |
43 | else | |
44 | fCharge = '0'; | |
61f275d1 | 45 | |
03d23846 | 46 | // rec info |
47 | if (daughter->GetRef()) { | |
48 | fPrec[0] = daughter->GetRef()->Px(); | |
49 | fPrec[1] = daughter->GetRef()->Py(); | |
50 | fPrec[2] = daughter->GetRef()->Pz(); | |
51 | } | |
61f275d1 | 52 | |
03d23846 | 53 | // MC info |
54 | if (daughter->GetRefMC()) { | |
55 | fPsim[0] = daughter->GetRefMC()->Px(); | |
56 | fPsim[1] = daughter->GetRefMC()->Py(); | |
57 | fPsim[2] = daughter->GetRefMC()->Pz(); | |
58 | fPDG = daughter->GetPDG(); | |
59 | fMother = daughter->GetMother(); | |
60 | fMotherPDG = daughter->GetMotherPDG(); | |
61 | } | |
213adb92 | 62 | |
63 | AliRsnEvent *event = (AliRsnEvent *) daughter->GetOwnerEvent(); | |
088ca370 | 64 | if (!event) { |
65 | AliWarning("Invalid reference event: cannot copy DCA nor Nsisters."); | |
66 | return; | |
67 | } | |
68 | if (event->IsAOD()){ | |
69 | // DCA to Primary Vertex for AOD | |
213adb92 | 70 | AliAODTrack *track = (AliAODTrack*) daughter->Ref2AODtrack(); |
71 | AliAODEvent *aodEvent = (AliAODEvent*) event->GetRefAOD(); | |
72 | if (track && aodEvent) { | |
73 | AliVVertex *vertex = (AliVVertex*) aodEvent->GetPrimaryVertex(); | |
74 | Double_t b[2], cov[3]; | |
75 | if (vertex) { | |
670857a6 | 76 | if ( !((track->GetStatus() & AliESDtrack::kTPCin) == 0) && !((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) && !((track->GetStatus() & AliESDtrack::kITSrefit) == 0) ){ |
f8c54226 | 77 | if (track->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b, cov)) |
78 | fDCA = b[0]; | |
670857a6 | 79 | } |
213adb92 | 80 | } |
81 | } | |
35b36c39 | 82 | // Number of Daughters from MC and Momentum of the Mother |
088ca370 | 83 | if (event->GetRefMC()) { |
84 | TClonesArray * list = event->GetAODList(); | |
85 | AliAODMCParticle *part = (AliAODMCParticle *)list->At(fMother); | |
35b36c39 | 86 | if (part) { |
87 | fNTotSisters = part->GetNDaughters(); | |
88 | fPmother[0] = part->Px(); | |
89 | fPmother[1] = part->Py(); | |
90 | fPmother[2] = part->Pz(); | |
31dbef4e | 91 | Int_t istep = 0; |
92 | Int_t pdgGranma = 0; | |
93 | Int_t abspdgGranma =0; | |
94 | Int_t mother_temp = daughter->GetMother(); | |
95 | while (mother_temp >=0 ){ | |
96 | istep++; | |
97 | AliDebug(2,Form("mother at step %d = %d", istep, mother_temp)); | |
98 | AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(list->At(mother_temp)); | |
99 | if (mcGranma){ | |
100 | pdgGranma = mcGranma->GetPdgCode(); | |
101 | AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma)); | |
102 | abspdgGranma = TMath::Abs(pdgGranma); | |
103 | if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){ | |
104 | fIsFromB=kTRUE; | |
105 | } | |
106 | if(abspdgGranma==4 || abspdgGranma==5) fIsQuarkFound=kTRUE; | |
107 | mother_temp = mcGranma->GetMother(); | |
108 | }else{ | |
109 | AliError("Failed casting the mother particle!"); | |
110 | break; | |
111 | } | |
112 | } | |
35b36c39 | 113 | } |
088ca370 | 114 | } |
213adb92 | 115 | } else { |
088ca370 | 116 | if (event->IsESD()){ |
117 | //DCA to Primary Vertex for ESD | |
118 | AliESDtrack *track = (AliESDtrack*) daughter->Ref2ESDtrack(); | |
119 | AliESDEvent *esdEvent = (AliESDEvent*) event->GetRefESD(); | |
120 | if (track && esdEvent) { | |
121 | AliVVertex *vertex = (AliVVertex*) esdEvent->GetPrimaryVertex(); | |
122 | Double_t b[2], cov[3]; | |
123 | if (vertex) { | |
670857a6 | 124 | if ( !((track->GetStatus() & AliESDtrack::kTPCin) == 0) && !((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) && !((track->GetStatus() & AliESDtrack::kITSrefit) == 0) ){ |
f8c54226 | 125 | if (track->PropagateToDCA(vertex, esdEvent->GetMagneticField(), kVeryBig, b, cov)) |
126 | fDCA = b[0]; | |
670857a6 | 127 | } |
088ca370 | 128 | } |
129 | } | |
35b36c39 | 130 | // Number of Daughters from MC and Momentum of the Mother |
088ca370 | 131 | if (event->GetRefMC()) { |
132 | AliMCParticle *part = (AliMCParticle *)event->GetRefMC()->GetTrack(fMother); | |
31dbef4e | 133 | AliMCEvent * MCEvent = event->GetRefMCESD(); |
35b36c39 | 134 | if(part){ |
135 | fNTotSisters = part->Particle()->GetNDaughters(); | |
136 | fPmother[0] = part->Px(); | |
137 | fPmother[1] = part->Py(); | |
138 | fPmother[2] = part->Pz(); | |
31dbef4e | 139 | Int_t istep = 0; |
140 | Int_t pdgGranma = 0; | |
141 | Int_t abspdgGranma =0; | |
142 | Int_t mother_temp = daughter->GetMother(); | |
143 | while (mother_temp >=0 ){ | |
144 | istep++; | |
145 | AliDebug(2,Form("mother at step %d = %d", istep, mother_temp)); | |
146 | AliMCParticle* mcGranma = dynamic_cast<AliMCParticle*>(MCEvent->GetTrack(mother_temp)); | |
147 | if (mcGranma){ | |
148 | pdgGranma = mcGranma->PdgCode(); | |
149 | AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma)); | |
150 | abspdgGranma = TMath::Abs(pdgGranma); | |
151 | if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)){ | |
152 | fIsFromB=kTRUE; | |
153 | } | |
154 | if(abspdgGranma==4 || abspdgGranma==5) fIsQuarkFound=kTRUE; | |
155 | mother_temp = mcGranma->GetMother(); | |
156 | }else{ | |
157 | AliError("Failed casting the mother particle!"); | |
158 | break; | |
159 | } | |
160 | } | |
35b36c39 | 161 | } |
088ca370 | 162 | } |
163 | } | |
213adb92 | 164 | } |
03d23846 | 165 | } |
4fb0dfa3 | 166 | |
4fb0dfa3 | 167 | //__________________________________________________________________________________________________ |
168 | Double_t AliRsnMiniParticle::Mass() | |
169 | { | |
170 | // | |
171 | // return mass of particle | |
172 | // | |
173 | ||
174 | TDatabasePDG *db = TDatabasePDG::Instance(); | |
175 | TParticlePDG *part = db->GetParticle(PDG()); | |
176 | return part->Mass(); | |
177 | } | |
178 | ||
179 | //__________________________________________________________________________________________________ | |
180 | void AliRsnMiniParticle::Set4Vector(TLorentzVector &v, Float_t mass, Bool_t mc) | |
181 | { | |
182 | // | |
183 | // return 4 vector of particle | |
184 | // | |
185 | ||
186 | if (mass<0.0) mass = Mass(); | |
187 | v.SetXYZM(Px(mc), Py(mc), Pz(mc),mass); | |
188 | } |