2 // This object is used as lightweight temporary container
3 // of all information needed from any input object and
4 // useful for resonance analysis.
5 // Lists of such objects are stored in a buffer, in order
6 // to allow an event mixing.
9 #include <TDatabasePDG.h>
10 #include <TParticlePDG.h>
12 #include "AliAODEvent.h"
13 #include "AliMCEvent.h"
14 #include "AliRsnEvent.h"
15 #include "AliRsnMiniEvent.h"
16 #include "AliRsnMiniParticle.h"
18 ClassImp(AliRsnMiniParticle)
20 //__________________________________________________________________________________________________
21 void AliRsnMiniParticle::CopyDaughter(AliRsnDaughter *daughter)
24 // Sets data members from the passed object
27 // reset what could not be initialized
28 fDCA = 0.0; //typically used for D0 analysis
34 fIsQuarkFound = kFALSE;
36 fPsim[0] = fPrec[0] = fPmother[0] = fPsim[1] = fPrec[1] = fPmother[1] = fPsim[2] = fPrec[2] = fPmother[2] = 0.0;
39 if (daughter->IsPos())
41 else if (daughter->IsNeg())
47 if (daughter->GetRef()) {
48 fPrec[0] = daughter->GetRef()->Px();
49 fPrec[1] = daughter->GetRef()->Py();
50 fPrec[2] = daughter->GetRef()->Pz();
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();
63 AliRsnEvent *event = (AliRsnEvent *) daughter->GetOwnerEvent();
65 AliWarning("Invalid reference event: cannot copy DCA nor Nsisters.");
69 // DCA to Primary Vertex for AOD
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];
76 if ( !((track->GetStatus() & AliESDtrack::kTPCin) == 0) && !((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) && !((track->GetStatus() & AliESDtrack::kITSrefit) == 0) ){
77 if (track->PropagateToDCA(vertex, aodEvent->GetMagneticField(), kVeryBig, b, cov))
82 // Number of Daughters from MC and Momentum of the Mother
83 if (event->GetRefMC()) {
84 TClonesArray * list = event->GetAODList();
85 AliAODMCParticle *part = (AliAODMCParticle *)list->At(fMother);
87 fNTotSisters = part->GetNDaughters();
88 fPmother[0] = part->Px();
89 fPmother[1] = part->Py();
90 fPmother[2] = part->Pz();
93 Int_t abspdgGranma =0;
94 Int_t mother_temp = daughter->GetMother();
95 while (mother_temp >=0 ){
97 AliDebug(2,Form("mother at step %d = %d", istep, mother_temp));
98 AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(list->At(mother_temp));
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)){
106 if(abspdgGranma==4 || abspdgGranma==5) fIsQuarkFound=kTRUE;
107 mother_temp = mcGranma->GetMother();
109 AliError("Failed casting the mother particle!");
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];
124 if ( !((track->GetStatus() & AliESDtrack::kTPCin) == 0) && !((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) && !((track->GetStatus() & AliESDtrack::kITSrefit) == 0) ){
125 if (track->PropagateToDCA(vertex, esdEvent->GetMagneticField(), kVeryBig, b, cov))
130 // Number of Daughters from MC and Momentum of the Mother
131 if (event->GetRefMC()) {
132 AliMCParticle *part = (AliMCParticle *)event->GetRefMC()->GetTrack(fMother);
133 AliMCEvent * MCEvent = event->GetRefMCESD();
135 fNTotSisters = part->Particle()->GetNDaughters();
136 fPmother[0] = part->Px();
137 fPmother[1] = part->Py();
138 fPmother[2] = part->Pz();
141 Int_t abspdgGranma =0;
142 Int_t mother_temp = daughter->GetMother();
143 while (mother_temp >=0 ){
145 AliDebug(2,Form("mother at step %d = %d", istep, mother_temp));
146 AliMCParticle* mcGranma = dynamic_cast<AliMCParticle*>(MCEvent->GetTrack(mother_temp));
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)){
154 if(abspdgGranma==4 || abspdgGranma==5) fIsQuarkFound=kTRUE;
155 mother_temp = mcGranma->GetMother();
157 AliError("Failed casting the mother particle!");
167 //__________________________________________________________________________________________________
168 Double_t AliRsnMiniParticle::Mass()
171 // return mass of particle
174 TDatabasePDG *db = TDatabasePDG::Instance();
175 TParticlePDG *part = db->GetParticle(PDG());
179 //__________________________________________________________________________________________________
180 void AliRsnMiniParticle::Set4Vector(TLorentzVector &v, Float_t mass, Bool_t mc)
183 // return 4 vector of particle
186 if (mass<0.0) mass = Mass();
187 v.SetXYZM(Px(mc), Py(mc), Pz(mc),mass);