ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/CompositeParticle.h
Revision: 1.22
Committed: Mon Jul 13 11:00:18 2009 UTC (15 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_025c_branch2, Mit_025c_branch1, Mit_025c_branch0, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010
Branch point for: Mit_025c_branch
Changes since 1.21: +1 -2 lines
Log Message:
Include files checked.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.22 // $Id: CompositeParticle.h,v 1.21 2009/06/11 04:44:46 loizides Exp $
3 loizides 1.1 //
4 loizides 1.21 // CompositeParticle
5 loizides 1.1 //
6 loizides 1.4 // A composite particle class that holds other (daughter) particles.
7 loizides 1.1 //
8 loizides 1.2 // Authors: J.Bendavid, C.Loizides
9 loizides 1.1 //--------------------------------------------------------------------------------------------------
10    
11 loizides 1.12 #ifndef MITANA_DATATREE_COMPOSITEPARTICLE_H
12     #define MITANA_DATATREE_COMPOSITEPARTICLE_H
13 loizides 1.1
14     #include "MitAna/DataTree/interface/Particle.h"
15 loizides 1.11 #include "MitAna/DataCont/interface/RefArray.h"
16 loizides 1.1
17     namespace mithep
18     {
19     class CompositeParticle : public Particle
20     {
21     public:
22 loizides 1.10 CompositeParticle() {}
23 loizides 1.1
24 loizides 1.20 void AddDaughter(const Particle *p)
25     { fDaughters.Add(p); ClearMom(); ClearCharge(); }
26     void Clear(Option_t *opt="")
27     { fDaughters.Clear(opt); ClearMom(); ClearCharge(); }
28 loizides 1.17 const Particle *Daughter(UInt_t i) const { return fDaughters.At(i); }
29     UInt_t NDaughters() const { return fDaughters.Entries(); }
30 loizides 1.9 Bool_t HasDaughter(const Particle *p) const;
31 loizides 1.2 Bool_t HasCommonDaughter(const CompositeParticle *p) const;
32     Bool_t HasSameDaughters(const CompositeParticle *p) const;
33 loizides 1.17 EObjType ObjType() const { return kCompositeParticle; }
34 loizides 1.5
35 loizides 1.1 protected:
36 loizides 1.18 Double_t GetCharge() const;
37     void GetMom() const;
38    
39 bendavid 1.19 RefArray<Particle> fDaughters; //references to daughter particles
40 loizides 1.1
41 loizides 1.2 ClassDef(CompositeParticle, 1) // Composite particle class
42 loizides 1.1 };
43     }
44 loizides 1.18
45     //--------------------------------------------------------------------------------------------------
46     inline Double_t mithep::CompositeParticle::GetCharge() const
47     {
48     // Return sum of charge of daughter particles.
49    
50     Double_t charge = 0;
51     for (UInt_t i=0; i<NDaughters(); ++i)
52     charge += Daughter(i)->Charge();
53    
54     return charge;
55     }
56    
57     //--------------------------------------------------------------------------------------------------
58     inline void mithep::CompositeParticle::GetMom() const
59     {
60     // Calculate the vector sum of the momenta of the daughters.
61    
62     FourVector mom;
63     for (UInt_t i=0; i<NDaughters(); ++i)
64     mom += (Daughter(i))->Mom();
65    
66     fCachedMom.SetCoordinates(mom.Pt(),mom.Eta(),mom.Phi(),mom.M());
67     }
68 loizides 1.1 #endif