CbmRoot
Loading...
Searching...
No Matches
PParticle.cxx
Go to the documentation of this file.
1/* Copyright (C) 1998-2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: M.A. Kagarlis, Florian Uhlig [committer] */
4
6// Particle Class implementation file
7//
8// A PParticle is a TLorentzVector with id and weight.
9// Static particle properties from the permanent data
10// base in PStaticData are used. Additional external particles
11// and decay modes may be loaded. See also PData.
12//
13// Author: M.A. Kagarlis
14// Written: 15.11.98
15// Revised: 15.12.2000 R. Holzmann
16// Revised: 22.03.2005 R. Holzmann
17// Revised: 23.07.2007 IF (new framework)
18//
20
21#include "PParticle.h"
22
23#include "TF1.h"
24#include "TMath.h"
25
27{
28
29 SetVertex(0., 0., 0., 0.);
30 pParticle = nullptr;
31 qParticle1 = nullptr;
32 qParticle2 = nullptr;
33 index = -1;
34 parentIndex = -2;
35 decayModeIndex = -1;
37 decayTime = 0.;
38 debug = "";
39 values = nullptr;
41 SetSourceId(-1);
42 SetParentId(-1);
46 SetSibling(nullptr);
47 mult = 1.;
48 spectator = 0;
49 genwt = invgenwt = 1.;
50
52}
53
54PParticle::PParticle(int /*id*/, Double_t /*T*/, Double_t /*w*/) : TLorentzVector() { defaults(); }
55
56/*
57PParticle::PParticle(const char * id, Double_t T, Double_t w):
58 TLorentzVector(0,0,sqrt(T*T+2*T*makeStaticData()->GetParticleMass(id)),
59 T+makeStaticData()->GetParticleMass(makeStaticData()->IsParticleValid(id))),
60 pid( makeStaticData()->IsParticleValid(id) ), wt( (pid)?w:0.), active(kTRUE) {
61 // name, lab kinetic energy (GeV), weight
62 defaults();
63}
64
65
66PParticle::PParticle(int id, Double_t px, Double_t py, Double_t pz, Double_t m, Double_t w):
67 TLorentzVector(px,py,pz,sqrt(px*px+py*py+pz*pz+
68 ( (m>0.)?m*m:makeStaticData()->GetParticleMass(id)*
69 makeStaticData()->GetParticleMass(id) ) )),
70 pid( makeStaticData()->IsParticleValid(id) ), wt( (pid)?w:0.), active(kTRUE) {
71 // id, Px, Py, Pz (GeV/c), mass (GeV/c**2) overrides default, weight
72 defaults();
73}
74
75
76PParticle::PParticle(const char * id, Double_t px, Double_t py, Double_t pz, Double_t m, Double_t w):
77 TLorentzVector(px,py,pz,sqrt(px*px+py*py+pz*pz+
78 ( (m>0.)?m*m:makeStaticData()->GetParticleMass(id)*
79 makeStaticData()->GetParticleMass(id) ) )),
80 pid( makeStaticData()->IsParticleValid(id) ), wt( (pid)?w:0.), active(kTRUE) {
81 // name, Px, Py, Pz (GeV/c), mass (GeV/c**2) overrides default, weight
82 defaults();
83}
84
85
86PParticle::PParticle(int id, const TVector3 & p, Double_t m, Double_t w):
87 TLorentzVector( p, sqrt(p.Mag2()+( (m>0.)?m*m:makeStaticData()->GetParticleMass(id)*
88 makeStaticData()->GetParticleMass(id) ))),
89 pid(makeStaticData()->IsParticleValid(id) ), wt( (pid)?w:0.), active(kTRUE) {
90 // id, 3-momentum vector (GeV/c), mass (GeV/c**2) overrides default, weight
91 defaults();
92}
93
94
95PParticle::PParticle(int id, Double_t * pt, Double_t w):
96 TLorentzVector( pt ), pid( id ), wt( w ), active(kTRUE) {
97 // id, pointer to 4-dim array (Px, Py, Pz, E) (GeV/c, GeV), weight
98 defaults();
99}
100
101
102PParticle::PParticle(int id, float * pt, Double_t w):
103 TLorentzVector( pt ), pid( id ), wt( w ), active(kTRUE) {
104 // id, pointer to 4-dim array (Px, Py, Pz, E) (GeV/c, GeV), weight
105 defaults();
106}
107
108
109PParticle::PParticle(const PParticle & p):
110 TLorentzVector( p.Vect4() ), pid(p.ID() ),
111 sourceId( p.GetSourceId() ),
112 parentId( p.GetParentId() ),
113 parentIndex( p.GetParentIndex() ),
114 daughterIndex( p.GetDaughterIndex() ),
115 siblingIndex( p.GetSiblingIndex() ),
116 decayTime( p.GetProperTime() ),
117 wt( p.W() ), active( p.IsActive() ) {
118 // copy constructor
119 SetVertex(p.X(),p.Y(),p.Z(),p.T());
120 pParticle = nullptr;
121 qParticle1= nullptr;
122 qParticle2= nullptr;
123
124 make_new_qParticle=p.make_new_qParticle;
125 if (p.make_new_qParticle) {
126 qParticle1 = (p.qParticle1 ?
127 new PParticle(p.qParticle1) : nullptr); //Copy, because it will destroy in dtor
128 }
129
130 if (p.make_new_qParticle) {
131 qParticle2 = (p.qParticle2 ?
132 new PParticle(p.qParticle2) : nullptr);
133 }
134
135 sParticle = p.sParticle;
136 // if (p.debug)
137// debug=p.debug;
138// else
139 debug="";
140 values=nullptr;
141 destroyDecayModeIndex= p.destroyDecayModeIndex;
142 decayModeIndex= p.decayModeIndex;
143
144 if (p.values) values=new PValues(*(p.values));
145 mult=p.mult;
146 spectator=p.spectator;
147 genwt=p.genwt;
148 invgenwt=p.invgenwt;
149}
150
151
152PParticle::PParticle(const PParticle * p):
153 TLorentzVector( p->Vect4() ), pid( p->ID() ),
154 sourceId( p->GetSourceId() ),
155 parentId( p->GetParentId() ),
156 parentIndex( p->GetParentIndex() ),
157 daughterIndex( p->GetDaughterIndex() ),
158 siblingIndex( p->GetSiblingIndex() ),
159 decayTime( p->GetProperTime() ),
160 wt( p->W() ), active( p->IsActive() ) {
161 // copy constructor
162 SetVertex(p->X(),p->Y(),p->Z(),p->T());
163 pParticle = nullptr;
164 qParticle1= nullptr;
165 qParticle2= nullptr;
166
167 make_new_qParticle=p->make_new_qParticle;
168 if (p->make_new_qParticle) {
169 qParticle1 = (p->qParticle1 ?
170 new PParticle(p->qParticle1): nullptr); //Copy, because it will destroy in dtor
171 }
172
173 if (p->make_new_qParticle) {
174 qParticle2 = (p->qParticle2 ?
175 new PParticle(p->qParticle2): nullptr);
176 }
177
178 sParticle = p->sParticle;
179
180 // if (p->debug) debug=p->debug;
181// else
182 debug="";
183 values=nullptr;
184 destroyDecayModeIndex= p->destroyDecayModeIndex;
185 decayModeIndex= p->decayModeIndex;
186
187 if (p->values) values=new PValues(*(p->values));
188
189 mult=p->mult;
190 spectator=p->spectator;
191 genwt=p->genwt;
192 invgenwt=p->invgenwt;
193}
194
195*/
196
197
ClassImp(CbmConverterManager)
void SetDaughterIndex(Int_t dInd)
Definition PParticle.h:85
void SetParentIndex(Int_t pInd)
Definition PParticle.h:87
void ResetDaughters(void)
Definition PParticle.h:90
Int_t index
internal activity flag
Definition PParticle.h:118
Double_t mult
inverted generator weight
Definition PParticle.h:113
PParticle * qParticle2
Definition PParticle.h:121
Double_t invgenwt
generator weight
Definition PParticle.h:112
void SetSibling(PParticle *p)
Definition PParticle.h:88
PParticle * qParticle1
pointer to particle object
Definition PParticle.h:120
PParticle * pParticle
index in particle array
Definition PParticle.h:119
PParticle(Int_t id=0, Double_t T=0., Double_t w=1.)
Definition PParticle.cxx:54
TString debug
pointer to daughter array
Definition PParticle.h:124
Double_t decayTime
flag that forces particle to be treated as spectator
Definition PParticle.h:109
Bool_t make_new_qParticle
status of parent particle in PChannel::Decay
Definition PParticle.h:129
Int_t decayModeIndex
Definition PParticle.h:103
Int_t parentIndex
Definition PParticle.h:102
PValues * values
debug string
Definition PParticle.h:126
Double_t genwt
Definition PParticle.h:111
Int_t destroyDecayModeIndex
Definition PParticle.h:104
void SetSiblingIndex(Int_t sInd)
Definition PParticle.h:86
void SetVertex(Double_t x, Double_t y, Double_t z, Double_t t)
Definition PParticle.h:71
void defaults(void)
Definition PParticle.cxx:26
void SetParentId(Int_t pId)
Definition PParticle.h:83
void SetSourceId(Int_t sId)
Definition PParticle.h:84
Int_t spectator
Definition PParticle.h:107