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.2 by loizides, Tue Jul 1 08:56:49 2008 UTC vs.
Revision 1.22 by loizides, Mon Jul 13 11:00:18 2009 UTC

# Line 1 | Line 1
1   //--------------------------------------------------------------------------------------------------
2   // $Id$
3   //
4 < // Composite Particle
4 > // CompositeParticle
5   //
6 < // Details to be worked out...
6 > // A composite particle class that holds other (daughter) particles.
7   //
8   // Authors: J.Bendavid, C.Loizides
9 //
9   //--------------------------------------------------------------------------------------------------
10  
11 < #ifndef DATATREE_COMPOSITEPARTICLE_H
12 < #define DATATREE_COMPOSITEPARTICLE_H
11 > #ifndef MITANA_DATATREE_COMPOSITEPARTICLE_H
12 > #define MITANA_DATATREE_COMPOSITEPARTICLE_H
13  
15 #include "MitAna/DataTree/interface/Types.h"
16 #include "MitAna/DataTree/interface/RefArray.h"
14   #include "MitAna/DataTree/interface/Particle.h"
15 + #include "MitAna/DataCont/interface/RefArray.h"
16  
17   namespace mithep
18   {
# Line 22 | Line 20 | namespace mithep
20    {
21      public:
22        CompositeParticle() {}
25      ~CompositeParticle() {}
23      
24 <      void                      AddDaughter(Particle *p) { fDaughters.Add(p); }
25 <      Int_t                     Charge()              const;
26 <      const Particle           *GetDaughter(UInt_t i) const { return fDaughters.At(i); }
27 <      UInt_t                    GetNDaughters()       const { return fDaughters.GetEntries(); }
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 <      Bool_t                    IsDaughter(const Particle *p)                 const;
34 <      FourVector                Mom()                 const;
35 <        
33 >      EObjType                  ObjType()             const       { return kCompositeParticle;   }
34 >
35      protected:
36 +      Double_t                  GetCharge()           const;
37 +      void                      GetMom()              const;
38 +
39        RefArray<Particle>        fDaughters; //references to daughter particles
40        
41      ClassDef(CompositeParticle, 1) // Composite particle class
42    };
43   }
44 +
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   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines