ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/src/DecayParticle.cc
Revision: 1.6
Committed: Wed Feb 18 15:38:55 2009 UTC (16 years, 2 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_008pre2, Mit_008pre1
Changes since 1.5: +16 -27 lines
Log Message:
Reworked particle interface to cache FourVectorM

File Contents

# User Rev Content
1 loizides 1.6 // $Id: DecayParticle.cc,v 1.5 2008/10/29 17:02:55 bendavid Exp $
2 loizides 1.1
3     #include "MitAna/DataTree/interface/DecayParticle.h"
4    
5     ClassImp(mithep::DecayParticle)
6 bendavid 1.3
7     using namespace mithep;
8    
9     //--------------------------------------------------------------------------------------------------
10 bendavid 1.5 Bool_t DecayParticle::HasDaughter(const Particle* p) const
11     {
12     // Return true if given particle is among daughters.
13    
14     if(!p) return kFALSE;
15    
16     if (!NDaughters())
17     return kFALSE;
18    
19     for (UInt_t i=0; i<NDaughters(); ++i)
20     if (Daughter(i)==p)
21     return kTRUE;
22    
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 loizides 1.6
57     //--------------------------------------------------------------------------------------------------
58     Double_t DecayParticle::PdgMass() const
59     {
60     // Get mass from pdg lookup.
61    
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;
69     }
70     }