Revision: | 1.3 |
Committed: | Mon Jul 13 11:00:19 2009 UTC (15 years, 9 months ago) by loizides |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, 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, HEAD |
Branch point for: | Mit_025c_branch |
Changes since 1.2: | +1 -2 lines |
Log Message: | Include files checked. |
# | User | Rev | Content |
---|---|---|---|
1 | loizides | 1.1 | //-------------------------------------------------------------------------------------------------- |
2 | loizides | 1.3 | // $Id: CompoundParticle.h,v 1.2 2009/06/15 15:00:11 loizides Exp $ |
3 | loizides | 1.1 | // |
4 | // CompoundParticle | ||
5 | // | ||
6 | // A compound particle class that holds other (daughter) particles. The class provides | ||
7 | // the same features as the CompositeParticle but allows to transfer ownership of daughters. | ||
8 | loizides | 1.2 | // This class is not supposed and can not be stored in a tree. |
9 | loizides | 1.1 | // |
10 | // Authors: C.Loizides | ||
11 | //-------------------------------------------------------------------------------------------------- | ||
12 | |||
13 | #ifndef MITANA_DATATREE_COMPOUNDPARTICLE_H | ||
14 | #define MITANA_DATATREE_COMPOUNDPARTICLE_H | ||
15 | |||
16 | loizides | 1.2 | #include "MitAna/DataTree/interface/ParticleCol.h" |
17 | loizides | 1.1 | |
18 | namespace mithep | ||
19 | { | ||
20 | class CompoundParticle : public Particle | ||
21 | { | ||
22 | public: | ||
23 | CompoundParticle(); | ||
24 | void AddDaughter(const Particle *p) | ||
25 | { fDaughters1.Add(p); ClearMom(); ClearCharge(); } | ||
26 | void AddDaughter(Particle *p, Bool_t owned); | ||
27 | void Clear(Option_t *opt=""); | ||
28 | const Particle *Daughter(UInt_t i) const; | ||
29 | UInt_t NDaughters() const; | ||
30 | Bool_t HasDaughter(const Particle *p) const; | ||
31 | Bool_t HasCommonDaughter(const CompoundParticle *p) const; | ||
32 | Bool_t HasSameDaughters(const CompoundParticle *p) const; | ||
33 | EObjType ObjType() const { return kCompoundParticle; } | ||
34 | |||
35 | protected: | ||
36 | Double_t GetCharge() const; | ||
37 | void GetMom() const; | ||
38 | |||
39 | ParticleOArr fDaughters1; //daughter particles (not owned) | ||
40 | ParticleOArr fDaughters2; //daughter particles (owned) | ||
41 | |||
42 | ClassDef(CompoundParticle, 1) // Compound particle class | ||
43 | }; | ||
44 | } | ||
45 | |||
46 | //-------------------------------------------------------------------------------------------------- | ||
47 | inline void mithep::CompoundParticle::Clear(Option_t *opt) | ||
48 | { | ||
49 | // Clear object. | ||
50 | |||
51 | fDaughters1.Clear(opt); | ||
52 | fDaughters2.Clear(opt); | ||
53 | ClearMom(); | ||
54 | ClearCharge(); | ||
55 | } | ||
56 | |||
57 | //-------------------------------------------------------------------------------------------------- | ||
58 | inline const mithep::Particle *mithep::CompoundParticle::Daughter(UInt_t i) const | ||
59 | { | ||
60 | // Return daughter at given index. | ||
61 | |||
62 | if (i<fDaughters1.Entries()) | ||
63 | return fDaughters1.At(i); | ||
64 | |||
65 | return fDaughters2.At(i-fDaughters1.Entries()); | ||
66 | } | ||
67 | |||
68 | //-------------------------------------------------------------------------------------------------- | ||
69 | inline Double_t mithep::CompoundParticle::GetCharge() const | ||
70 | { | ||
71 | // Return sum of charge of daughter particles. | ||
72 | |||
73 | Double_t charge = 0; | ||
74 | for (UInt_t i=0; i<NDaughters(); ++i) | ||
75 | charge += Daughter(i)->Charge(); | ||
76 | |||
77 | return charge; | ||
78 | } | ||
79 | |||
80 | //-------------------------------------------------------------------------------------------------- | ||
81 | inline void mithep::CompoundParticle::GetMom() const | ||
82 | { | ||
83 | // Calculate the vector sum of the momenta of the daughters. | ||
84 | |||
85 | FourVector mom; | ||
86 | for (UInt_t i=0; i<NDaughters(); ++i) | ||
87 | mom += (Daughter(i))->Mom(); | ||
88 | |||
89 | fCachedMom.SetCoordinates(mom.Pt(),mom.Eta(),mom.Phi(),mom.M()); | ||
90 | } | ||
91 | |||
92 | //-------------------------------------------------------------------------------------------------- | ||
93 | inline UInt_t mithep::CompoundParticle::NDaughters() const | ||
94 | { | ||
95 | // Return number of daughters. | ||
96 | |||
97 | return (fDaughters1.Entries()+fDaughters2.Entries()); | ||
98 | } | ||
99 | #endif |