ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/CompositeParticle.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/CompositeParticle.h (file contents):
Revision 1.1 by loizides, Mon Jun 30 16:49:49 2008 UTC vs.
Revision 1.23 by paus, Wed Mar 28 12:15:34 2012 UTC

# Line 1 | Line 1
1   //--------------------------------------------------------------------------------------------------
2   // $Id$
3   //
4 < // Composite Particle
4 > // CompositeParticle
5   //
6 < // Details to be worked out...
7 < //
8 < // Authors: J.Bendavid...
6 > // A composite particle class that holds other (daughter) particles.
7   //
8 + // Authors: J.Bendavid, C.Loizides, C.Paus
9   //--------------------------------------------------------------------------------------------------
10  
11 <
12 < #ifndef DATATREE_COMPOSITEPARTICLE_H
14 < #define DATATREE_COMPOSITEPARTICLE_H
11 > #ifndef MITANA_DATATREE_COMPOSITEPARTICLE_H
12 > #define MITANA_DATATREE_COMPOSITEPARTICLE_H
13  
16 #include "MitAna/DataTree/interface/RefArray.h"
14   #include "MitAna/DataTree/interface/Particle.h"
15 < #include "MitAna/DataTree/interface/Types.h"
15 > #include "MitAna/DataCont/interface/RefArray.h"
16  
17   namespace mithep
18   {
# Line 23 | Line 20 | namespace mithep
20    {
21      public:
22        CompositeParticle() {}
26      ~CompositeParticle() {}
27    
28      const RefArray<Particle> *GetDaughters() const { return &fDaughters; }
23      
24 <      void                      AddDaughter(Particle* p) { fDaughters.Add(p); }
25 <      virtual Int_t             Charge() const;
26 <      Bool_t                    HasDaughter(const Particle* p) const;
27 <      Bool_t                    HasSameDaughters(CompositeParticle* p) const;
28 <      Bool_t                    HasCommonDaughter(CompositeParticle* p) const;
29 <      virtual FourVector        Mom() const;
30 <        
24 >      void                      AddDaughter      (const Particle *p)
25 >                                  { fDaughters.Add(p); ClearMom(); ClearCharge(); }
26 >      void                      Clear            (Option_t *opt="")
27 >                                  { fDaughters.Clear(opt); ClearMom(); ClearCharge(); }
28 >      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 >      Bool_t                    HasCommonDaughter(const CompositeParticle *p) const;
32 >      Bool_t                    HasSameDaughters (const CompositeParticle *p) const;
33 >      EObjType                  ObjType          ()                           const
34 >                                  { return kCompositeParticle;   }
35 >
36 >      // Some structural tools
37 >      void                      Mark()                const;
38 >
39      protected:
40 <      RefArray<Particle>        fDaughters; //
40 >      Double_t                  GetCharge()           const;
41 >      void                      GetMom()              const;
42 >
43 >      RefArray<Particle>        fDaughters; //references to daughter particles
44        
45 <    ClassDef(CompositeParticle, 1)
45 >    ClassDef(CompositeParticle, 1) // Composite particle class
46    };
47   }
48 +
49 + //--------------------------------------------------------------------------------------------------
50 + 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 + 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   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines