ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/ChargedParticle.h
Revision: 1.7
Committed: Tue Dec 9 17:46:59 2008 UTC (16 years, 4 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_006b, Mit_006a
Changes since 1.6: +10 -9 lines
Log Message:
Added ObjType to retrieve type of object.

File Contents

# User Rev Content
1 bendavid 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.7 // $Id: ChargedParticle.h,v 1.6 2008/12/01 17:33:03 loizides Exp $
3 bendavid 1.1 //
4     // ChargedParticle
5     //
6 loizides 1.3 // Abstract base class for particles which have a corresponding track.
7 bendavid 1.1 //
8     // Authors: C.Loizides, J.Bendavid
9     //--------------------------------------------------------------------------------------------------
10    
11 loizides 1.4 #ifndef MITANA_DATATREE_CHARGEDPARTICLE_H
12     #define MITANA_DATATREE_CHARGEDPARTICLE_H
13 bendavid 1.1
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     ~ChargedParticle() {}
24    
25 loizides 1.7 Double_t Charge() const { return Trk()?Trk()->Charge():0; }
26 loizides 1.6 Double_t E() const;
27 loizides 1.7 Double_t Eta() const { return Trk()?Trk()->Mom().Eta():0; }
28 loizides 1.6 virtual const Track *Trk() const = 0;
29 bendavid 1.5 virtual const Track *TrackerTrk() const = 0;
30 loizides 1.6 FourVector Mom() const { return FourVector(Px(),Py(),Pz(),E()); }
31 loizides 1.7 EObjType ObjType() const { return kChargedParticle; }
32 loizides 1.6 Double_t Phi() const { return Trk()?Trk()->Phi():0; }
33 loizides 1.7 Double_t P() const { return Trk()?Trk()->P():0; }
34     Double_t Pt() const { return Trk()?Trk()->Pt():0; }
35     Double_t Px() const { return Trk()?Trk()->Px():0; }
36     Double_t Py() const { return Trk()?Trk()->Py():0; }
37     Double_t Pz() const { return Trk()?Trk()->Pz():0; }
38    
39 loizides 1.3 ClassDef(ChargedParticle, 1) // Charged particle class
40 bendavid 1.1 };
41     }
42    
43     //--------------------------------------------------------------------------------------------------
44     inline Double_t mithep::ChargedParticle::E() const
45     {
46 loizides 1.6 if (!Trk())
47     return Mass()*Mass();
48    
49 loizides 1.3 return TMath::Sqrt(Trk()->P()*Trk()->P() + Mass()*Mass());
50 bendavid 1.1 }
51     #endif