7 |
|
using namespace mithep; |
8 |
|
|
9 |
|
//-------------------------------------------------------------------------------------------------- |
10 |
< |
Int_t CompositeParticle::Charge() const |
10 |
> |
Double_t CompositeParticle::Charge() const |
11 |
|
{ |
12 |
|
// Return sum of charge of daughter particles. |
13 |
|
|
14 |
< |
Int_t charge = 0; |
15 |
< |
for (UInt_t i=0; i<GetNDaughters(); ++i) |
16 |
< |
charge += GetDaughter(i)->Charge(); |
14 |
> |
Double_t charge = 0; |
15 |
> |
for (UInt_t i=0; i<NDaughters(); ++i) |
16 |
> |
charge += Daughter(i)->Charge(); |
17 |
|
|
18 |
|
return charge; |
19 |
|
} |
20 |
|
|
21 |
|
//-------------------------------------------------------------------------------------------------- |
22 |
+ |
Bool_t CompositeParticle::HasDaughter(const Particle* p) const |
23 |
+ |
{ |
24 |
+ |
// Return true if given particle is among daughters. |
25 |
+ |
|
26 |
+ |
if(!p) return kFALSE; |
27 |
+ |
|
28 |
+ |
return fDaughters.HasObject(p); |
29 |
+ |
} |
30 |
+ |
|
31 |
+ |
//-------------------------------------------------------------------------------------------------- |
32 |
|
Bool_t CompositeParticle::HasCommonDaughter(const CompositeParticle *p) const |
33 |
|
{ |
34 |
|
// Return true if a common daughter exists. |
35 |
|
|
36 |
|
if(!p) return kFALSE; |
37 |
|
|
38 |
< |
for (UInt_t i=0; i<p->GetNDaughters(); ++i) |
39 |
< |
if (IsDaughter(p->GetDaughter(i))) |
38 |
> |
for (UInt_t i=0; i<p->NDaughters(); ++i) |
39 |
> |
if (HasDaughter(p->Daughter(i))) |
40 |
|
return kTRUE; |
41 |
|
|
42 |
|
return kFALSE; |
49 |
|
|
50 |
|
if(!p) return kFALSE; |
51 |
|
|
52 |
< |
if (GetNDaughters()!= p->GetNDaughters()) |
52 |
> |
if (NDaughters()!= p->NDaughters()) |
53 |
|
return kFALSE; |
54 |
|
|
55 |
< |
for (UInt_t i=0; i<p->GetNDaughters(); ++i) |
56 |
< |
if (!IsDaughter(p->GetDaughter(i))) |
55 |
> |
for (UInt_t i=0; i<p->NDaughters(); ++i) |
56 |
> |
if (!HasDaughter(p->Daughter(i))) |
57 |
|
return kFALSE; |
58 |
|
|
59 |
|
return kTRUE; |
60 |
|
} |
61 |
|
|
62 |
|
//-------------------------------------------------------------------------------------------------- |
53 |
– |
Bool_t CompositeParticle::IsDaughter(const Particle* p) const |
54 |
– |
{ |
55 |
– |
// Return true if given particle is among daughters. |
56 |
– |
|
57 |
– |
if(!p) return kFALSE; |
58 |
– |
|
59 |
– |
if (!GetNDaughters()) |
60 |
– |
return kFALSE; |
61 |
– |
|
62 |
– |
for (UInt_t i=0; i<GetNDaughters(); ++i) |
63 |
– |
if (GetDaughter(i)==p) |
64 |
– |
return kTRUE; |
65 |
– |
|
66 |
– |
return kFALSE; |
67 |
– |
} |
68 |
– |
|
69 |
– |
//-------------------------------------------------------------------------------------------------- |
63 |
|
FourVector CompositeParticle::Mom() const |
64 |
|
{ |
65 |
|
// Return the vector sum of the momenta of the daughters. |
66 |
|
|
67 |
|
FourVector mom; |
68 |
< |
for (UInt_t i=0; i<GetNDaughters(); ++i) |
69 |
< |
mom += (GetDaughter(i))->Mom(); |
68 |
> |
for (UInt_t i=0; i<NDaughters(); ++i) |
69 |
> |
mom += (Daughter(i))->Mom(); |
70 |
|
|
71 |
|
return mom; |
72 |
|
} |