1 |
loizides |
1.1 |
// $Id: Muon.cc,v 1.1 2008/06/04 09:08:36 loizides Exp $
|
2 |
|
|
|
3 |
|
|
#include "MitAna/DataTree/interface/CompositeParticle.h"
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
ClassImp(mithep::CompositeParticle)
|
7 |
|
|
|
8 |
|
|
using namespace mithep;
|
9 |
|
|
|
10 |
|
|
Int_t CompositeParticle::Charge() const {
|
11 |
|
|
Int_t charge = 0;
|
12 |
|
|
for (Int_t i=0; i<GetDaughters()->GetEntries(); i++)
|
13 |
|
|
charge += ((Particle*)GetDaughters()->At(i))->Charge();
|
14 |
|
|
|
15 |
|
|
return charge;
|
16 |
|
|
}
|
17 |
|
|
|
18 |
|
|
// Bool_t CompositeParticle::HasDaughter(const Particle* p) {
|
19 |
|
|
// if ( fDaughters.IndexOf(p) >= 0 )
|
20 |
|
|
// return true;
|
21 |
|
|
// else
|
22 |
|
|
// return false;
|
23 |
|
|
// }
|
24 |
|
|
|
25 |
|
|
Bool_t CompositeParticle::HasDaughter(const Particle* p) const {
|
26 |
|
|
if ( fDaughters.GetEntries() == 0 )
|
27 |
|
|
return false;
|
28 |
|
|
|
29 |
|
|
for (UInt_t i=0; i<fDaughters.GetEntries(); i++)
|
30 |
|
|
if (fDaughters.At(i)==p)
|
31 |
|
|
return true;
|
32 |
|
|
|
33 |
|
|
return false;
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
Bool_t CompositeParticle::HasSameDaughters(CompositeParticle* p) const {
|
37 |
|
|
if ( fDaughters.GetEntries() != p->GetDaughters()->GetEntries())
|
38 |
|
|
return false;
|
39 |
|
|
|
40 |
|
|
for (Int_t i=0; i<p->GetDaughters()->GetEntries();i++)
|
41 |
|
|
if (!HasDaughter( (Particle*)p->GetDaughters()->At(i) ) )
|
42 |
|
|
return false;
|
43 |
|
|
|
44 |
|
|
return true;
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
Bool_t CompositeParticle::HasCommonDaughter(CompositeParticle* p) const {
|
48 |
|
|
for (Int_t i=0; i<p->GetDaughters()->GetEntries();i++)
|
49 |
|
|
if (HasDaughter( (Particle*)p->GetDaughters()->At(i) ) )
|
50 |
|
|
return true;
|
51 |
|
|
|
52 |
|
|
return false;
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
FourVector CompositeParticle::Mom() const {
|
56 |
|
|
FourVector mom;
|
57 |
|
|
for (Int_t i=0; i<GetDaughters()->GetEntries(); i++)
|
58 |
|
|
mom += ((Particle*)GetDaughters()->At(i))->Mom();
|
59 |
|
|
|
60 |
|
|
return mom;
|
61 |
|
|
}
|