1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 //-------------------------------------------------------------------------
17 // Class AliRsnDaughter
18 // ----------------------
19 // A simple object which describes a reconstructed track
20 // with some references to its related generated particle
21 // and some facilities which could help in composing its
22 // 4-momentum, for resonance study.
24 // author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
25 //-------------------------------------------------------------------------
27 #include <TParticle.h>
31 #include "AliESDtrack.h"
32 #include "AliRsnDaughter.h"
34 ClassImp(AliRsnDaughter)
36 //--------------------------------------------------------------------------------------------------------
37 AliRsnDaughter::AliRsnDaughter() :
46 fMotherPDG((Short_t)0)
49 // Default constructor.
50 // Its unique argument defines how many PID weights are allowed.
51 // Actually, it should be the same as AliESDtrack::kSPECIES (=5).
55 for (i = 0; i < AliPID::kSPECIES; i++) {
63 //--------------------------------------------------------------------------------------------------------
64 AliRsnDaughter::AliRsnDaughter(Int_t label, UShort_t index, Double_t *p, Double_t *v, Char_t sign) :
73 fMotherPDG((Short_t)0)
77 // Constructor with arguments.
78 // To create an object with all its standard data members filled (the ones coming from ESD)
81 for (i = 0; i < AliPID::kSPECIES; i++) {
89 //--------------------------------------------------------------------------------------------------------
90 AliRsnDaughter * AliRsnDaughter::Adopt(AliESDtrack* esdTrack, Int_t index)
93 // Copies reconstructed data from an AliESDtrack:
97 // - point of closest approach to primary vertex
99 // - track label (AliESDtrack::GetLabel())
101 // Given that it happened that tracks have exactly zero momentum and DCA point,
102 // these quantities are checked and skipped when caught.
104 Double_t p[3], v[3], pid[AliPID::kSPECIES];
106 esdTrack->GetPxPyPz(p);
108 esdTrack->GetESDpid(pid);
110 if (p[0] == 0.0 || p[1] == 0.0 || p[2] == 0.0) return 0x0;
111 if (v[0] == 0.0 || v[1] == 0.0 || v[2] == 0.0) return 0x0;
113 AliRsnDaughter *out = new AliRsnDaughter(esdTrack->GetLabel(), (UShort_t)index, p, v, (Char_t)esdTrack->GetSign());
116 out->SetPIDweights(pid);
120 //--------------------------------------------------------------------------------------------------------
121 AliRsnDaughter * AliRsnDaughter::Adopt(TParticle* particle, Int_t label)
124 // Copies data from a generated particle:
129 // - production vertex
130 // - GEANT label of mother track
136 // get particle sign form the sign of PDG code
137 pdg = particle->GetPdgCode();
138 if (TMath::Abs(pdg) < 20) {
139 if (pdg > 0) sign = -1; else sign = 1;
141 else if (TMath::Abs(pdg) < 3000) {
142 if (pdg > 0) sign = 1; else sign = -1;
148 p[0] = particle->Px();
149 p[1] = particle->Py();
150 p[2] = particle->Pz();
152 v[0] = particle->Vx();
153 v[1] = particle->Vy();
154 v[2] = particle->Vz();
156 AliRsnDaughter *out = new AliRsnDaughter(label, (UShort_t)TMath::Abs(label), p, v, sign);
158 // set simulation data
159 out->SetPDG(TMath::Abs(pdg));
160 out->SetTruePDG(TMath::Abs(pdg));
161 out->SetMother(particle->GetFirstMother());
165 //--------------------------------------------------------------------------------------------------------
166 void AliRsnDaughter::Print(Option_t *option) const
169 // Print informations about track.
170 // All options are used to add some specifical information as required:
171 // "S" --> charge sign
172 // "L" --> track label
173 // "I" --> assigned PID (PDG code)
174 // "T" --> true PDG code
175 // "V" --> coordinates of track vertex
176 // "P" --> coordinates of track momentum
177 // "M" --> mother label
178 // "N" --> mother PDG code
179 // "W" --> ESD PID weights
182 TString output("Track info: ");
186 if (opt.Contains("S")) {
187 output.Append(Form("sign = %d -- ", (Int_t)fSign));
189 if (opt.Contains("L")) {
190 output.Append(Form("label = %d -- ", fLabel));
192 if (opt.Contains("I")) {
193 output.Append(Form("PDG = %d -- ", fPDG));
195 if (opt.Contains("T")) {
196 output.Append(Form("true PDG = %d -- ", fTruePDG));
198 if (opt.Contains("V")) {
199 output.Append(Form("v = %f, %f, %f -- ", fV[0], fV[1], fV[2]));
201 if (opt.Contains("P")) {
202 output.Append(Form("p = %f, %f, %f -- ", fP[0], fP[1], fP[2]));
204 if (opt.Contains("M")) {
205 output.Append(Form("mum = %d -- ", fMother));
207 if (opt.Contains("N")) {
208 output.Append(Form("mum PDG = %d -- ", fMotherPDG));
210 if (opt.Contains("W")) {
211 output.Append(Form("PID wgts (e, mu, pi, K, p) = %f, %f, %f, %f, %f", fPIDwgt[0], fPIDwgt[1], fPIDwgt[2], fPIDwgt[3], fPIDwgt[4]));
214 AliInfo(output.Data());
216 //--------------------------------------------------------------------------------------------------------
217 AliRsnDaughter AliRsnDaughter::Sum(AliRsnDaughter t1, AliRsnDaughter t2)
220 // Builds a new AliRsnDaughter object with the sum of momenta of two particles.
222 // create new AliRsnDaughter with default useless values for datamembers
225 // if the summed particles are daughters of the same resonance
226 // their common mother label becomes the label of the sum
227 Int_t mum1 = t1.GetMother();
228 Int_t mum2 = t2.GetMother();
231 out.SetMotherPDG(t1.GetMotherPDG());
238 // compute total 4-momentum
239 Double_t etot = t1.GetEnergy() + t2.GetEnergy();
240 Double_t pxTot = t1.GetPx() + t2.GetPx();
241 Double_t pyTot = t1.GetPy() + t2.GetPy();
242 Double_t pzTot = t1.GetPz() + t2.GetPz();
243 Double_t mass = TMath::Sqrt(etot*etot - pxTot*pxTot - pyTot*pyTot - pzTot*pzTot);
245 out.SetPxPyPz(pxTot, pyTot, pzTot);