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.5 by loizides, Wed Jul 16 18:56:49 2008 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 +  if (!NDaughters())
29 +    return kFALSE;
30 +
31 +  for (UInt_t i=0; i<NDaughters(); ++i)
32 +    if (Daughter(i)==p)
33 +      return kTRUE;
34 +  
35 +  return kFALSE;
36 + }
37 +
38 + //--------------------------------------------------------------------------------------------------
39   Bool_t CompositeParticle::HasCommonDaughter(const CompositeParticle *p) const
40   {
41    // Return true if a common daughter exists.
42  
43    if(!p) return kFALSE;
44  
45 <  for (UInt_t i=0; i<p->GetNDaughters(); ++i)
46 <    if (IsDaughter(p->GetDaughter(i)))
45 >  for (UInt_t i=0; i<p->NDaughters(); ++i)
46 >    if (HasDaughter(p->Daughter(i)))
47        return kTRUE;
48          
49    return kFALSE;
# Line 39 | Line 56 | Bool_t CompositeParticle::HasSameDaughte
56  
57    if(!p) return kFALSE;
58  
59 <  if (GetNDaughters()!= p->GetNDaughters())
59 >  if (NDaughters()!= p->NDaughters())
60      return kFALSE;
61                  
62 <  for (UInt_t i=0; i<p->GetNDaughters(); ++i)
63 <    if (!IsDaughter(p->GetDaughter(i)))
62 >  for (UInt_t i=0; i<p->NDaughters(); ++i)
63 >    if (!HasDaughter(p->Daughter(i)))
64          return kFALSE;
65          
66    return kTRUE;
67   }
68  
69   //--------------------------------------------------------------------------------------------------
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 //--------------------------------------------------------------------------------------------------
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<GetNDaughters(); ++i)
76 <    mom += (GetDaughter(i))->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