1 |
loizides |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
loizides |
1.21 |
// $Id: CompositeParticle.h,v 1.20 2009/03/03 17:04:09 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 |
loizides |
1.2 |
// Authors: J.Bendavid, C.Loizides
|
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 |
loizides |
1.2 |
#include "MitAna/DataTree/interface/Types.h"
|
15 |
loizides |
1.1 |
#include "MitAna/DataTree/interface/Particle.h"
|
16 |
loizides |
1.11 |
#include "MitAna/DataCont/interface/RefArray.h"
|
17 |
loizides |
1.1 |
|
18 |
|
|
namespace mithep
|
19 |
|
|
{
|
20 |
|
|
class CompositeParticle : public Particle
|
21 |
|
|
{
|
22 |
|
|
public:
|
23 |
loizides |
1.10 |
CompositeParticle() {}
|
24 |
loizides |
1.1 |
|
25 |
loizides |
1.20 |
void AddDaughter(const Particle *p)
|
26 |
|
|
{ fDaughters.Add(p); ClearMom(); ClearCharge(); }
|
27 |
|
|
void Clear(Option_t *opt="")
|
28 |
|
|
{ fDaughters.Clear(opt); ClearMom(); ClearCharge(); }
|
29 |
loizides |
1.17 |
const Particle *Daughter(UInt_t i) const { return fDaughters.At(i); }
|
30 |
|
|
UInt_t NDaughters() const { return fDaughters.Entries(); }
|
31 |
loizides |
1.9 |
Bool_t HasDaughter(const Particle *p) const;
|
32 |
loizides |
1.2 |
Bool_t HasCommonDaughter(const CompositeParticle *p) const;
|
33 |
|
|
Bool_t HasSameDaughters(const CompositeParticle *p) const;
|
34 |
loizides |
1.17 |
EObjType ObjType() const { return kCompositeParticle; }
|
35 |
loizides |
1.5 |
|
36 |
loizides |
1.1 |
protected:
|
37 |
loizides |
1.18 |
Double_t GetCharge() const;
|
38 |
|
|
void GetMom() const;
|
39 |
|
|
|
40 |
bendavid |
1.19 |
RefArray<Particle> fDaughters; //references to daughter particles
|
41 |
loizides |
1.1 |
|
42 |
loizides |
1.2 |
ClassDef(CompositeParticle, 1) // Composite particle class
|
43 |
loizides |
1.1 |
};
|
44 |
|
|
}
|
45 |
loizides |
1.18 |
|
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 |
loizides |
1.1 |
#endif
|