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.6 by loizides, Mon Jul 14 09:41:59 2008 UTC vs.
Revision 1.19 by bendavid, Thu Feb 26 17:06:24 2009 UTC

# Line 8 | Line 8
8   // Authors: J.Bendavid, C.Loizides
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  
14   #include "MitAna/DataTree/interface/Types.h"
15 #include "MitAna/DataTree/interface/RefArray.h"
15   #include "MitAna/DataTree/interface/Particle.h"
16 + #include "MitAna/DataCont/interface/RefArray.h"
17  
18   namespace mithep
19   {
20    class CompositeParticle : public Particle
21    {
22      public:
23 <      CompositeParticle(UInt_t rsv=0) : fDaughters(rsv) { SetClearBit(); }
24 <      ~CompositeParticle() {}
23 >      CompositeParticle() {}
24      
25 <      void                      AddDaughter(Particle *p)    { fDaughters.Add(p); }
26 <      void                      Clear(Option_t *opt="")     { fDaughters.Clear(opt); }
27 <      Int_t                     Charge()              const;
28 <      const Particle           *GetDaughter(UInt_t i) const { return fDaughters.At(i); }
29 <      UInt_t                    GetNDaughters()       const { return fDaughters.GetEntries(); }
25 >      void                      AddDaughter(const Particle *p)    { fDaughters.Add(p); ClearMom(); ClearCharge(); }
26 >      void                      Clear(Option_t *opt="")           { fDaughters.Clear(opt); ClearMom(); ClearCharge(); }
27 >      const Particle           *Daughter(UInt_t i)    const       { return fDaughters.At(i);     }
28 >      UInt_t                    NDaughters()          const       { return fDaughters.Entries(); }
29 >      Bool_t                    HasDaughter(const Particle *p)                const;
30        Bool_t                    HasCommonDaughter(const CompositeParticle *p) const;
31        Bool_t                    HasSameDaughters(const CompositeParticle *p)  const;
32 <      Bool_t                    IsDaughter(const Particle *p)                 const;
34 <      FourVector                Mom()                 const;
35 <      void                      Trim()                      { fDaughters.Trim(); }
32 >      EObjType                  ObjType()             const       { return kCompositeParticle;   }
33  
34      protected:
35 +      Double_t                  GetCharge()           const;
36 +      void                      GetMom()              const;
37 +
38        RefArray<Particle>        fDaughters; //references to daughter particles
39        
40      ClassDef(CompositeParticle, 1) // Composite particle class
41    };
42   }
43 +
44 + //--------------------------------------------------------------------------------------------------
45 + inline Double_t mithep::CompositeParticle::GetCharge() const
46 + {
47 +  // Return sum of charge of daughter particles.
48 +
49 +  Double_t charge = 0;
50 +  for (UInt_t i=0; i<NDaughters(); ++i)
51 +    charge += Daughter(i)->Charge();
52 +  
53 +  return charge;
54 + }
55 +
56 + //--------------------------------------------------------------------------------------------------
57 + inline void mithep::CompositeParticle::GetMom() const
58 + {
59 +  // Calculate the vector sum of the momenta of the daughters.
60 +
61 +  FourVector mom;
62 +  for (UInt_t i=0; i<NDaughters(); ++i)
63 +    mom += (Daughter(i))->Mom();
64 +  
65 +  fCachedMom.SetCoordinates(mom.Pt(),mom.Eta(),mom.Phi(),mom.M());
66 + }
67   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines