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
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 <Riostream.h>
29 #include <TParticle.h>
30 #include <TParticlePDG.h>
32 #include "AliESDtrack.h"
33 #include "AliRsnDaughter.h"
35 ClassImp(AliRsnDaughter)
37 //--------------------------------------------------------------------------------------------------------
38 AliRsnDaughter::AliRsnDaughter()
40 // Default constructor.
41 // Its unique argument defines how many PID weights are allowed.
42 // Actually, it should be the same as AliESDtrack::kSPECIES (=5).
49 fP[0] = fP[1] = fP[2] = 0.0;
50 fV[0] = fV[1] = fV[2] = 0.0;
54 for (i = 0; i < AliPID::kSPECIES; i++) {
63 //--------------------------------------------------------------------------------------------------------
64 AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter ©) : TObject(copy)
74 for (i = 0; i < 3; i++) {
80 for (i = 0; i < AliPID::kSPECIES; i++) {
81 fPIDwgt[i] = copy.fPIDwgt[i];
85 fTruePDG = copy.fTruePDG;
86 fMother = copy.fMother;
87 fMotherPDG = copy.fMotherPDG;
89 //--------------------------------------------------------------------------------------------------------
90 Bool_t AliRsnDaughter::Adopt(const AliESDtrack* esdTrack, Bool_t checkITSRefit)
92 // Copies reconstructed data from an AliESDtrack:
96 // - point of closest approach to primary vertex
98 // - track label (AliESDtrack::GetLabel())
100 // Makes the following checks:
102 // - if argument 'checkITSRefit' is TRUE and the "ITS refit" flag is FALSE
103 // in the track, the "fIsOK" flag of (this) is set to "false" (track should be rejected)
104 // - if the passed label is negative, track is considered as "fake", and
105 // this info is kept to allow fake tracks exclusion when doing analysis
108 // check for refit in the ITS (if requested)
110 if ( !(esdTrack->GetStatus() & AliESDtrack::kITSrefit) ) {
115 // get sign and number of species allowed for PID
116 fSign = (Char_t)esdTrack->GetSign();
118 // get (and check) momentum
119 esdTrack->GetPxPyPz(fP);
120 if (fP[0] == 0.0 || fP[1] == 0.0 || fP[2] == 0.0) {
124 // get (and check) vertex
125 esdTrack->GetXYZ(fV);
126 if (fV[0] == 0.0 || fV[1] == 0.0 || fV[2] == 0.0) {
131 // (other kinematics informations are set to default and meaningless values)
132 fLabel = esdTrack->GetLabel();
135 esdTrack->GetESDpid(fPIDwgt);
139 //--------------------------------------------------------------------------------------------------------
140 Bool_t AliRsnDaughter::Adopt(TParticle* particle)
142 // Copies data from a generated particle:
147 // - production vertex
148 // - GEANT label of mother track
150 // When an AliRsnDaughter is copied from a TParticle, it is
151 // considered always good for analysis and never fake.
154 // get particle sign form the sign of PDG code
155 Int_t pdg = particle->GetPdgCode();
156 if (TMath::Abs(pdg) < 20) {
157 if (pdg > 0) fSign = -1; else fSign = 1;
159 else if (TMath::Abs(pdg) < 3000) {
160 if (pdg > 0) fSign = 1; else fSign = -1;
164 fP[0] = particle->Px();
165 fP[1] = particle->Py();
166 fP[2] = particle->Pz();
169 fV[0] = particle->Vx();
170 fV[1] = particle->Vy();
171 fV[2] = particle->Vz();
173 // set simulation data
174 fPDG = fTruePDG = (Short_t)particle->GetPdgCode();
175 fMother = particle->GetFirstMother();
180 //--------------------------------------------------------------------------------------------------------
181 AliRsnDaughter operator+(AliRsnDaughter t1, AliRsnDaughter t2)
183 // Sum operator overloading.
184 // Builds a new AliRsnDaughter object with the sum of momenta of two particles.
187 // create new AliRsnDaughter with default useless values for datamembers
190 // if the summed particles are daughters of the same resonance
191 // their common mother label becomes the label of the sum
192 Int_t mum1 = t1.GetMother();
193 Int_t mum2 = t2.GetMother();
196 out.SetMotherPDG(t1.GetMotherPDG());
203 // compute total 4-momentum
204 Double_t Etot = t1.GetEnergy() + t2.GetEnergy();
205 Double_t pxTot = t1.GetPx() + t2.GetPx();
206 Double_t pyTot = t1.GetPy() + t2.GetPy();
207 Double_t pzTot = t1.GetPz() + t2.GetPz();
208 Double_t mass = TMath::Sqrt(Etot*Etot - pxTot*pxTot - pyTot*pyTot - pzTot*pzTot);
210 //TLorentzVector v1 = track1.Get4Momentum();
211 //TLorentzVector v2 = track2.Get4Momentum();
212 //TLorentzVector sm = v1 + v2;
213 //Double_t pxTot = sum.X();
214 //Double_t pyTot = sum.Y();
215 //Double_t pzTot = sum.Z();
216 //Double_t mass = sm.M();
218 out.SetPxPyPz(pxTot, pyTot, pzTot);