ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/src/CompositeParticle.cc
(Generate patch)

Comparing UserCode/MitAna/DataTree/src/CompositeParticle.cc (file contents):
Revision 1.3 by loizides, Mon Jul 14 20:55:19 2008 UTC vs.
Revision 1.8 by loizides, Fri Mar 20 18:23:27 2009 UTC

# Line 7 | Line 7 | ClassImp(mithep::CompositeParticle)
7   using namespace mithep;
8  
9   //--------------------------------------------------------------------------------------------------
10 < Int_t CompositeParticle::Charge() const
10 > Bool_t CompositeParticle::HasDaughter(const Particle *p) const
11   {
12 <  // Return sum of charge of daughter particles.
12 >  // Return true if given particle is among daughters.
13 >
14 >  if(!p) return kFALSE;
15  
16 <  Int_t charge = 0;
15 <  for (UInt_t i=0; i<NDaughters(); ++i)
16 <    charge += Daughter(i)->Charge();
17 <  
18 <  return charge;
16 >  return fDaughters.HasObject(p);
17   }
18  
19   //--------------------------------------------------------------------------------------------------
# Line 26 | Line 24 | Bool_t CompositeParticle::HasCommonDaugh
24    if(!p) return kFALSE;
25  
26    for (UInt_t i=0; i<p->NDaughters(); ++i)
27 <    if (IsDaughter(p->Daughter(i)))
27 >    if (HasDaughter(p->Daughter(i)))
28        return kTRUE;
29          
30    return kFALSE;
31   }
32  
33   //--------------------------------------------------------------------------------------------------
34 < Bool_t CompositeParticle::HasSameDaughters(const CompositeParticle* p) const
34 > Bool_t CompositeParticle::HasSameDaughters(const CompositeParticle *p) const
35   {
36    // Return true if daughters are the same.
37  
# Line 43 | Line 41 | Bool_t CompositeParticle::HasSameDaughte
41      return kFALSE;
42                  
43    for (UInt_t i=0; i<p->NDaughters(); ++i)
44 <    if (!IsDaughter(p->Daughter(i)))
44 >    if (!HasDaughter(p->Daughter(i)))
45          return kFALSE;
46          
47    return kTRUE;
48   }
51
52 //--------------------------------------------------------------------------------------------------
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 (!NDaughters())
60    return kFALSE;
61
62  for (UInt_t i=0; i<NDaughters(); ++i)
63    if (Daughter(i)==p)
64      return kTRUE;
65  
66  return kFALSE;
67 }
68
69 //--------------------------------------------------------------------------------------------------
70 FourVector CompositeParticle::Mom() const
71 {
72  // Return the vector sum of the momenta of the daughters.
73
74  FourVector mom;
75  for (UInt_t i=0; i<NDaughters(); ++i)
76    mom += (Daughter(i))->Mom();
77  
78  return mom;
79 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines