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