ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/CompositeParticle.h
Revision: 1.23
Committed: Wed Mar 28 12:15:34 2012 UTC (13 years, 1 month ago) by paus
Content type: text/plain
Branch: MAIN
Changes since 1.22: +23 -9 lines
Log Message:
Enable skimming.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 paus 1.23 // $Id: CompositeParticle.h,v 1.22 2009/07/13 11:00:18 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 paus 1.23 // Authors: J.Bendavid, C.Loizides, C.Paus
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 paus 1.23 void AddDaughter (const Particle *p)
25 loizides 1.20 { fDaughters.Add(p); ClearMom(); ClearCharge(); }
26 paus 1.23 void Clear (Option_t *opt="")
27 loizides 1.20 { fDaughters.Clear(opt); ClearMom(); ClearCharge(); }
28 paus 1.23 const Particle *Daughter (UInt_t i) const { return fDaughters.At(i); }
29     UInt_t NDaughters () const { return fDaughters.Entries(); }
30     Bool_t HasDaughter (const Particle *p) const;
31 loizides 1.2 Bool_t HasCommonDaughter(const CompositeParticle *p) const;
32 paus 1.23 Bool_t HasSameDaughters (const CompositeParticle *p) const;
33     EObjType ObjType () const
34     { return kCompositeParticle; }
35    
36     // Some structural tools
37     void Mark() const;
38 loizides 1.5
39 loizides 1.1 protected:
40 loizides 1.18 Double_t GetCharge() const;
41     void GetMom() const;
42    
43 bendavid 1.19 RefArray<Particle> fDaughters; //references to daughter particles
44 loizides 1.1
45 loizides 1.2 ClassDef(CompositeParticle, 1) // Composite particle class
46 loizides 1.1 };
47     }
48 loizides 1.18
49     //--------------------------------------------------------------------------------------------------
50 paus 1.23 inline void mithep::CompositeParticle::Mark() const
51     {
52     // mark myself
53     mithep::DataObject::Mark();
54     // mark my dependencies if they are there
55     for (UInt_t i=0; i<NDaughters(); i++)
56     fDaughters.At(i)->Mark();
57     }
58    
59     //--------------------------------------------------------------------------------------------------
60 loizides 1.18 inline Double_t mithep::CompositeParticle::GetCharge() const
61     {
62     // Return sum of charge of daughter particles.
63    
64     Double_t charge = 0;
65     for (UInt_t i=0; i<NDaughters(); ++i)
66     charge += Daughter(i)->Charge();
67    
68     return charge;
69     }
70    
71     //--------------------------------------------------------------------------------------------------
72     inline void mithep::CompositeParticle::GetMom() const
73     {
74     // Calculate the vector sum of the momenta of the daughters.
75    
76     FourVector mom;
77     for (UInt_t i=0; i<NDaughters(); ++i)
78     mom += (Daughter(i))->Mom();
79    
80     fCachedMom.SetCoordinates(mom.Pt(),mom.Eta(),mom.Phi(),mom.M());
81     }
82 loizides 1.1 #endif