1 |
//--------------------------------------------------------------------------------------------------
|
2 |
// $Id: ChargedParticle.h,v 1.9 2009/03/03 17:04:09 loizides Exp $
|
3 |
//
|
4 |
// ChargedParticle
|
5 |
//
|
6 |
// Abstract base class for particles which have a corresponding track.
|
7 |
//
|
8 |
// Authors: C.Loizides, J.Bendavid
|
9 |
//--------------------------------------------------------------------------------------------------
|
10 |
|
11 |
#ifndef MITANA_DATATREE_CHARGEDPARTICLE_H
|
12 |
#define MITANA_DATATREE_CHARGEDPARTICLE_H
|
13 |
|
14 |
#include "MitAna/DataTree/interface/Particle.h"
|
15 |
#include "MitAna/DataTree/interface/Track.h"
|
16 |
|
17 |
namespace mithep
|
18 |
{
|
19 |
class ChargedParticle : public Particle
|
20 |
{
|
21 |
public:
|
22 |
ChargedParticle() {}
|
23 |
|
24 |
EObjType ObjType() const { return kChargedParticle; }
|
25 |
virtual const Track *TrackerTrk() const { return Trk(); }
|
26 |
virtual const Track *Trk() const = 0;
|
27 |
|
28 |
protected:
|
29 |
Double_t GetCharge() const;
|
30 |
void GetMom() const;
|
31 |
|
32 |
ClassDef(ChargedParticle, 1) // Charged particle class
|
33 |
};
|
34 |
}
|
35 |
|
36 |
//--------------------------------------------------------------------------------------------------
|
37 |
inline Double_t mithep::ChargedParticle::GetCharge() const
|
38 |
{
|
39 |
// Get charge from track.
|
40 |
|
41 |
const mithep::Track *trk = Trk();
|
42 |
if (trk)
|
43 |
return trk->Charge();
|
44 |
else
|
45 |
return 0;
|
46 |
}
|
47 |
|
48 |
//--------------------------------------------------------------------------------------------------
|
49 |
inline void mithep::ChargedParticle::GetMom() const
|
50 |
{
|
51 |
// Get momentum values from track.
|
52 |
|
53 |
const mithep::Track *trk = Trk();
|
54 |
if (trk)
|
55 |
fCachedMom.SetCoordinates(trk->Pt(),trk->Eta(),trk->Phi(),GetMass());
|
56 |
else
|
57 |
fCachedMom.SetCoordinates(0,0,0,GetMass());
|
58 |
}
|
59 |
#endif
|