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