ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/StableParticle.h
Revision: 1.9
Committed: Wed Feb 18 15:38:55 2009 UTC (16 years, 2 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.8: +18 -3 lines
Log Message:
Reworked particle interface to cache FourVectorM

File Contents

# User Rev Content
1 bendavid 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.9 // $Id: StableParticle.h,v 1.8 2009/02/17 15:09:45 bendavid Exp $
3 bendavid 1.1 //
4     // StableParticle
5     //
6 loizides 1.4 // Generic stable particle with track. Stores absolute pdg code and link to track.
7 bendavid 1.1 //
8     // Authors: C.Loizides, J.Bendavid
9     //--------------------------------------------------------------------------------------------------
10    
11 loizides 1.5 #ifndef MITANA_DATATREE_STABLEPARTICLE_H
12     #define MITANA_DATATREE_STABLEPARTICLE_H
13 bendavid 1.1
14     #include "MitAna/DataTree/interface/ChargedParticle.h"
15    
16     namespace mithep
17     {
18     class StableParticle : public ChargedParticle
19     {
20     public:
21 bendavid 1.3 StableParticle() : fAbsPdgId(0) {}
22     StableParticle(UInt_t absPdgId) : fAbsPdgId(absPdgId) {}
23 bendavid 1.8 StableParticle(UInt_t absPdgId, const Track *track) : fAbsPdgId(absPdgId), fTrackRef(track) {}
24 bendavid 1.1
25 loizides 1.7 UInt_t AbsPdgId() const { return fAbsPdgId; }
26 bendavid 1.8 const Track *Trk() const { return fTrackRef.Obj(); }
27 loizides 1.7 const Track *TrackerTrk() const { return Trk(); }
28     EObjType ObjType() const { return kStableParticle; }
29 bendavid 1.1 TParticlePDG *ParticlePdgEntry() const;
30     void SetAbsPdgId(UInt_t absPdgId) { fAbsPdgId=absPdgId; }
31 bendavid 1.8 void SetTrk(const Track *t) { fTrackRef = t; }
32 bendavid 1.1
33     protected:
34 loizides 1.9 Double_t GetMass() const;
35    
36 bendavid 1.1 UInt_t fAbsPdgId; //pdg identifier (absolute value)
37 bendavid 1.8 Ref<Track> fTrackRef; //tracker track reference
38 bendavid 1.1
39 loizides 1.4 ClassDef(StableParticle, 1) // Stable particle class
40 bendavid 1.1 };
41     }
42    
43     //--------------------------------------------------------------------------------------------------
44 loizides 1.9 inline Double_t mithep::StableParticle::GetMass() const
45     {
46     // Get Mass from Pdg Lookup
47    
48     TParticlePDG* pdgEntry = ParticlePdgEntry();
49     if (pdgEntry)
50     return pdgEntry->Mass();
51     else {
52     Error("GetMass",
53     "Absolute pdg code %i not found in table, returning mass=-99.0 GeV", fAbsPdgId);
54     return -99.0;
55     }
56     }
57    
58     //--------------------------------------------------------------------------------------------------
59 bendavid 1.1 inline TParticlePDG *mithep::StableParticle::ParticlePdgEntry() const
60     {
61     // Return entry to pdg database for the PARTICLE.
62    
63     return TDatabasePDG::Instance()->GetParticle(fAbsPdgId);
64     }
65     #endif