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.2 by loizides, Tue Jul 1 08:56:50 2008 UTC vs.
Revision 1.6 by bendavid, Wed Feb 18 08:18:36 2009 UTC

# Line 7 | Line 7 | ClassImp(mithep::CompositeParticle)
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;
# Line 39 | Line 49 | Bool_t CompositeParticle::HasSameDaughte
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines