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.4 by bendavid, Tue Sep 30 12:53:59 2008 UTC vs.
Revision 1.7 by loizides, Fri Mar 20 18:23:27 2009 UTC

# Line 7 | Line 7 | ClassImp(mithep::DecayParticle)
7   using namespace mithep;
8  
9   //--------------------------------------------------------------------------------------------------
10 < Double_t DecayParticle::Charge() const
10 > Bool_t DecayParticle::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 >  if (!NDaughters())
17 >    return kFALSE;
18  
14  Double_t charge = 0;
19    for (UInt_t i=0; i<NDaughters(); ++i)
20 <    charge += DaughterDat(i)->Charge();
20 >    if (Daughter(i)==p)
21 >      return kTRUE;
22    
23 <  return charge;
23 >  return kFALSE;
24 > }
25 >
26 > //--------------------------------------------------------------------------------------------------
27 > Bool_t DecayParticle::HasCommonDaughter(const DecayParticle *p) const
28 > {
29 >  // Return true if a common daughter exists.
30 >
31 >  if(!p) return kFALSE;
32 >
33 >  for (UInt_t i=0; i<p->NDaughters(); ++i)
34 >    if (HasDaughter(p->Daughter(i)))
35 >      return kTRUE;
36 >        
37 >  return kFALSE;
38 > }
39 >
40 > //--------------------------------------------------------------------------------------------------
41 > Bool_t DecayParticle::HasSameDaughters(const DecayParticle *p) const
42 > {
43 >  // Return true if daughters are the same.
44 >
45 >  if(!p) return kFALSE;
46 >
47 >  if (NDaughters()!= p->NDaughters())
48 >    return kFALSE;
49 >                
50 >  for (UInt_t i=0; i<p->NDaughters(); ++i)
51 >    if (!HasDaughter(p->Daughter(i)))
52 >        return kFALSE;
53 >        
54 >  return kTRUE;
55   }
56  
57   //--------------------------------------------------------------------------------------------------
58   Double_t DecayParticle::PdgMass() const
59   {
60 <  // Get Mass from Pdg Lookup
60 >  // Get mass from pdg lookup.
61  
62 <  TParticlePDG* pdgEntry = ParticlePdgEntry();
62 >  TParticlePDG *pdgEntry = ParticlePdgEntry();
63    if (pdgEntry)
64      return pdgEntry->Mass();
65    else {
66 +    Error("PdgMass",
67 +          "Absolute pdg code %i not found in table, returning mass=-99.0 GeV", fAbsPdgId);
68      return -99.0;
31    printf("Absolute Pdg Code %i not found in table, returning Mass=-99.0 GeV", fAbsPdgId);
69    }
70   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines