9 |
|
//-------------------------------------------------------------------------------------------------- |
10 |
|
Double_t MCParticle::Charge() const |
11 |
|
{ |
12 |
< |
// Get charge from pdg lookup/ |
12 |
> |
// Get charge from pdg lookup. |
13 |
|
|
14 |
|
TParticlePDG* pdgEntry = PdgEntry(); |
15 |
|
if (pdgEntry) |
21 |
|
} |
22 |
|
|
23 |
|
//-------------------------------------------------------------------------------------------------- |
24 |
+ |
const MCParticle *MCParticle::FindDaughter(Int_t pid, |
25 |
+ |
Bool_t checkCharge, const MCParticle *start) const |
26 |
+ |
{ |
27 |
+ |
// Return daughter with given pid. If checkCharge is false then just the type of particle is |
28 |
+ |
// checked (ie particle and anti-particle). If start is not null, start searching from |
29 |
+ |
// this daughter. |
30 |
+ |
|
31 |
+ |
UInt_t i = 0; |
32 |
+ |
if (start) { |
33 |
+ |
for (; i<NDaughters(); ++i) { |
34 |
+ |
if (Daughter(i)==start) { |
35 |
+ |
++i; |
36 |
+ |
break; |
37 |
+ |
} |
38 |
+ |
} |
39 |
+ |
return 0; |
40 |
+ |
} |
41 |
+ |
|
42 |
+ |
for (UInt_t j=i; j<NDaughters(); ++j) { |
43 |
+ |
if (Daughter(j)->Is(pid,checkCharge)) |
44 |
+ |
return Daughter(j); |
45 |
+ |
} |
46 |
+ |
|
47 |
+ |
return 0; |
48 |
+ |
} |
49 |
+ |
|
50 |
+ |
//-------------------------------------------------------------------------------------------------- |
51 |
+ |
const MCParticle *MCParticle::FindMother(Int_t pid, Bool_t checkCharge) const |
52 |
+ |
{ |
53 |
+ |
// Return mother with given pid. If checkCharge is false then just the type of particle is |
54 |
+ |
// checked (ie particle and anti-particle). |
55 |
+ |
|
56 |
+ |
const MCParticle *mother = Mother(); |
57 |
+ |
if (!mother) |
58 |
+ |
return 0; |
59 |
+ |
|
60 |
+ |
if (checkCharge) { |
61 |
+ |
while (mother && mother->PdgId()!=pid) |
62 |
+ |
mother = mother->Mother(); |
63 |
+ |
return mother; |
64 |
+ |
} |
65 |
+ |
|
66 |
+ |
Int_t apid = pid>0?pid:-pid; |
67 |
+ |
while (mother && mother->AbsPdgId()!=apid) |
68 |
+ |
mother = mother->Mother(); |
69 |
+ |
|
70 |
+ |
return mother; |
71 |
+ |
} |
72 |
+ |
|
73 |
+ |
//-------------------------------------------------------------------------------------------------- |
74 |
|
void MCParticle::Print(Option_t *opt) const |
75 |
|
{ |
76 |
|
// Print particle kinematics. In case option "l" is given then also print info about daughters. |