1 |
//--------------------------------------------------------------------------------------------------
|
2 |
// $Id: GenericParticle.h,v 1.5 2009/05/11 07:59:47 loizides Exp $
|
3 |
//
|
4 |
// GenericParticle
|
5 |
//
|
6 |
// General particle class to be filled and used at analysis time.
|
7 |
// It provides an abstract interface to kinematical quantities computed by derived classes.
|
8 |
//
|
9 |
// Authors: G.Ceballos, C.Loizides
|
10 |
//--------------------------------------------------------------------------------------------------
|
11 |
|
12 |
#ifndef MITANA_DATATREE_GENERICPARTICLE_H
|
13 |
#define MITANA_DATATREE_GENERICPARTICLE_H
|
14 |
|
15 |
#include <TMath.h>
|
16 |
#include "MitAna/DataTree/interface/Particle.h"
|
17 |
|
18 |
namespace mithep
|
19 |
{
|
20 |
class GenericParticle : public Particle
|
21 |
{
|
22 |
public:
|
23 |
GenericParticle(): fQ(0), fObjId(kGenericParticle), fObjType(kGenericParticle) {}
|
24 |
GenericParticle(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t c,
|
25 |
Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
|
26 |
fMom(FourVector(px,py,pz,e)), fQ(c), fObjId(id), fObjType(type) {}
|
27 |
GenericParticle(Double_t px, Double_t py, Double_t pz, Double_t e,
|
28 |
Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
|
29 |
fMom(FourVector(px,py,pz,e)), fQ(0), fObjId(id), fObjType(type) {}
|
30 |
GenericParticle(const FourVector &m, Double_t c,
|
31 |
Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
|
32 |
fMom(m), fQ(c), fObjId(id), fObjType(type) {}
|
33 |
GenericParticle(const FourVectorM &m, Double_t c,
|
34 |
Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
|
35 |
fMom(m), fQ(c), fObjId(id), fObjType(type) {}
|
36 |
GenericParticle(const Particle &p) :
|
37 |
fMom(p.Mom()), fQ(p.Charge()), fObjId(p.ObjId()), fObjType(p.ObjType()) {}
|
38 |
|
39 |
void Print(Option_t *opt="") const;
|
40 |
Int_t ObjId() const { return fObjId; }
|
41 |
EObjType ObjType() const { return fObjType; }
|
42 |
void SetCharge(Double_t c) { fQ = c; ClearCharge(); }
|
43 |
void SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
|
44 |
void SetObjId(Int_t id) { fObjId = id; }
|
45 |
void SetObjType(EObjType t) { fObjType = t; }
|
46 |
|
47 |
protected:
|
48 |
Double_t GetCharge() const { return fQ; }
|
49 |
Double_t GetMass() const { return fMom.M(); }
|
50 |
void GetMom() const;
|
51 |
|
52 |
FourVectorM fMom; //momentum vector
|
53 |
Double_t fQ; //charge value
|
54 |
Int_t fObjId; //object id
|
55 |
EObjType fObjType; //object type
|
56 |
|
57 |
ClassDef(GenericParticle, 2) // Generic particle class
|
58 |
};
|
59 |
}
|
60 |
|
61 |
//--------------------------------------------------------------------------------------------------
|
62 |
inline void mithep::GenericParticle::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
|
63 |
{
|
64 |
// Set four vector.
|
65 |
|
66 |
fMom.SetXYZT(px, py, pz, e);
|
67 |
ClearMom();
|
68 |
}
|
69 |
|
70 |
//--------------------------------------------------------------------------------------------------
|
71 |
inline void mithep::GenericParticle::GetMom() const
|
72 |
{
|
73 |
// Get momentum values.
|
74 |
|
75 |
fCachedMom = fMom;
|
76 |
}
|
77 |
#endif
|