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

Comparing UserCode/MitAna/DataTree/src/DecayParticle.cc (file contents):
Revision 1.2 by loizides, Thu Jul 3 08:22:18 2008 UTC vs.
Revision 1.5 by bendavid, Wed Oct 29 17:02:55 2008 UTC

# Line 3 | Line 3
3   #include "MitAna/DataTree/interface/DecayParticle.h"
4  
5   ClassImp(mithep::DecayParticle)
6 +
7 + using namespace mithep;
8 +
9 + //--------------------------------------------------------------------------------------------------
10 + Double_t DecayParticle::Charge() const
11 + {
12 +  // Return sum of charge of daughter particles.
13 +
14 +  Double_t charge = 0;
15 +  for (UInt_t i=0; i<NDaughters(); ++i)
16 +    charge += DaughterDat(i)->Charge();
17 +  
18 +  return charge;
19 + }
20 +
21 + //--------------------------------------------------------------------------------------------------
22 + Double_t DecayParticle::PdgMass() const
23 + {
24 +  // Get Mass from Pdg Lookup
25 +
26 +  TParticlePDG* pdgEntry = ParticlePdgEntry();
27 +  if (pdgEntry)
28 +    return pdgEntry->Mass();
29 +  else {
30 +    return -99.0;
31 +    printf("Absolute Pdg Code %i not found in table, returning Mass=-99.0 GeV", fAbsPdgId);
32 +  }
33 + }
34 +
35 + //--------------------------------------------------------------------------------------------------
36 + Bool_t DecayParticle::HasDaughter(const Particle* p) const
37 + {
38 +  // Return true if given particle is among daughters.
39 +
40 +  if(!p) return kFALSE;
41 +
42 +  if (!NDaughters())
43 +    return kFALSE;
44 +
45 +  for (UInt_t i=0; i<NDaughters(); ++i)
46 +    if (Daughter(i)==p)
47 +      return kTRUE;
48 +  
49 +  return kFALSE;
50 + }
51 +
52 + //--------------------------------------------------------------------------------------------------
53 + Bool_t DecayParticle::HasCommonDaughter(const DecayParticle *p) const
54 + {
55 +  // Return true if a common daughter exists.
56 +
57 +  if(!p) return kFALSE;
58 +
59 +  for (UInt_t i=0; i<p->NDaughters(); ++i)
60 +    if (HasDaughter(p->Daughter(i)))
61 +      return kTRUE;
62 +        
63 +  return kFALSE;
64 + }
65 +
66 + //--------------------------------------------------------------------------------------------------
67 + Bool_t DecayParticle::HasSameDaughters(const DecayParticle* p) const
68 + {
69 +  // Return true if daughters are the same.
70 +
71 +  if(!p) return kFALSE;
72 +
73 +  if (NDaughters()!= p->NDaughters())
74 +    return kFALSE;
75 +                
76 +  for (UInt_t i=0; i<p->NDaughters(); ++i)
77 +    if (!HasDaughter(p->Daughter(i)))
78 +        return kFALSE;
79 +        
80 +  return kTRUE;
81 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines