ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/StableParticle.h
Revision: 1.14
Committed: Thu Mar 29 23:41:55 2012 UTC (13 years, 1 month ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, HEAD
Changes since 1.13: +5 -5 lines
Log Message:
Version with working skimming and last 4.4 tag.

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: StableParticle.h,v 1.13 2012/03/28 12:15:34 paus Exp $
3 //
4 // StableParticle
5 //
6 // Generic stable particle with track. Stores absolute pdg code and link to track.
7 //
8 // Authors: C.Loizides, J.Bendavid
9 //--------------------------------------------------------------------------------------------------
10
11 #ifndef MITANA_DATATREE_STABLEPARTICLE_H
12 #define MITANA_DATATREE_STABLEPARTICLE_H
13
14 #include "MitAna/DataTree/interface/ChargedParticle.h"
15
16 namespace mithep
17 {
18 class StableParticle : public ChargedParticle
19 {
20 public:
21 StableParticle() : fAbsPdgId(0) {}
22 StableParticle(UInt_t absPdgId) : fAbsPdgId(absPdgId) {}
23 StableParticle(UInt_t absPdgId, const Track *track) : fAbsPdgId(absPdgId), fTrackRef(track) {}
24
25 UInt_t AbsPdgId() const { return fAbsPdgId; }
26 const Track *Trk() const { return fTrackRef.Obj(); }
27 const Track *TrackerTrk() const { return Trk(); }
28 EObjType ObjType() const { return kStableParticle; }
29 TParticlePDG *PdgEntry() const;
30 void SetAbsPdgId(UInt_t apdg) { fAbsPdgId=apdg; ClearMom(); }
31 void SetTrk(const Track *t) { fTrackRef = t; ClearMom(); ClearCharge(); }
32
33 // Some structural tools
34 void Mark(UInt_t i=1) const;
35
36 protected:
37 Double_t GetMass() const;
38
39 UInt_t fAbsPdgId; //pdg identifier (absolute value)
40 Ref<Track> fTrackRef; //tracker track reference
41
42 ClassDef(StableParticle, 1) // Stable particle class
43 };
44 }
45
46 //--------------------------------------------------------------------------------------------------
47 inline void mithep::StableParticle::Mark(UInt_t ib) const
48 {
49 // mark myself
50 mithep::DataObject::Mark(ib);
51 // mark my dependencies if they are there
52 if (fTrackRef.IsValid())
53 fTrackRef.Obj()->Mark(ib);
54 }
55
56 //--------------------------------------------------------------------------------------------------
57 inline Double_t mithep::StableParticle::GetMass() const
58 {
59 // Get mass from pdg lookup.
60
61 TParticlePDG *pdgEntry = PdgEntry();
62 if (pdgEntry)
63 return pdgEntry->Mass();
64 else {
65 Error("GetMass",
66 "Absolute pdg code %i not found in table, returning mass=-99.0 GeV", fAbsPdgId);
67 return -99.0;
68 }
69 }
70 #endif