1 |
bendavid |
1.4 |
// $Id: CompositeParticle.cc,v 1.3 2008/07/14 20:55:19 loizides Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitAna/DataTree/interface/CompositeParticle.h"
|
4 |
|
|
|
5 |
|
|
ClassImp(mithep::CompositeParticle)
|
6 |
|
|
|
7 |
|
|
using namespace mithep;
|
8 |
|
|
|
9 |
loizides |
1.2 |
//--------------------------------------------------------------------------------------------------
|
10 |
bendavid |
1.4 |
Double_t CompositeParticle::Charge() const
|
11 |
loizides |
1.2 |
{
|
12 |
|
|
// Return sum of charge of daughter particles.
|
13 |
|
|
|
14 |
bendavid |
1.4 |
Double_t charge = 0;
|
15 |
loizides |
1.3 |
for (UInt_t i=0; i<NDaughters(); ++i)
|
16 |
|
|
charge += Daughter(i)->Charge();
|
17 |
loizides |
1.2 |
|
18 |
|
|
return charge;
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
//--------------------------------------------------------------------------------------------------
|
22 |
|
|
Bool_t CompositeParticle::HasCommonDaughter(const CompositeParticle *p) const
|
23 |
|
|
{
|
24 |
|
|
// Return true if a common daughter exists.
|
25 |
|
|
|
26 |
|
|
if(!p) return kFALSE;
|
27 |
|
|
|
28 |
loizides |
1.3 |
for (UInt_t i=0; i<p->NDaughters(); ++i)
|
29 |
|
|
if (IsDaughter(p->Daughter(i)))
|
30 |
loizides |
1.2 |
return kTRUE;
|
31 |
loizides |
1.1 |
|
32 |
loizides |
1.2 |
return kFALSE;
|
33 |
loizides |
1.1 |
}
|
34 |
|
|
|
35 |
loizides |
1.2 |
//--------------------------------------------------------------------------------------------------
|
36 |
|
|
Bool_t CompositeParticle::HasSameDaughters(const CompositeParticle* p) const
|
37 |
|
|
{
|
38 |
|
|
// Return true if daughters are the same.
|
39 |
loizides |
1.1 |
|
40 |
loizides |
1.2 |
if(!p) return kFALSE;
|
41 |
loizides |
1.1 |
|
42 |
loizides |
1.3 |
if (NDaughters()!= p->NDaughters())
|
43 |
loizides |
1.2 |
return kFALSE;
|
44 |
loizides |
1.1 |
|
45 |
loizides |
1.3 |
for (UInt_t i=0; i<p->NDaughters(); ++i)
|
46 |
|
|
if (!IsDaughter(p->Daughter(i)))
|
47 |
loizides |
1.2 |
return kFALSE;
|
48 |
loizides |
1.1 |
|
49 |
loizides |
1.2 |
return kTRUE;
|
50 |
loizides |
1.1 |
}
|
51 |
|
|
|
52 |
loizides |
1.2 |
//--------------------------------------------------------------------------------------------------
|
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 |
loizides |
1.3 |
if (!NDaughters())
|
60 |
loizides |
1.2 |
return kFALSE;
|
61 |
|
|
|
62 |
loizides |
1.3 |
for (UInt_t i=0; i<NDaughters(); ++i)
|
63 |
|
|
if (Daughter(i)==p)
|
64 |
loizides |
1.2 |
return kTRUE;
|
65 |
|
|
|
66 |
|
|
return kFALSE;
|
67 |
loizides |
1.1 |
}
|
68 |
|
|
|
69 |
loizides |
1.2 |
//--------------------------------------------------------------------------------------------------
|
70 |
|
|
FourVector CompositeParticle::Mom() const
|
71 |
|
|
{
|
72 |
|
|
// Return the vector sum of the momenta of the daughters.
|
73 |
|
|
|
74 |
|
|
FourVector mom;
|
75 |
loizides |
1.3 |
for (UInt_t i=0; i<NDaughters(); ++i)
|
76 |
|
|
mom += (Daughter(i))->Mom();
|
77 |
loizides |
1.2 |
|
78 |
|
|
return mom;
|
79 |
loizides |
1.1 |
}
|