ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/ChargedParticle.h
Revision: 1.11
Committed: Fri Oct 30 14:16:00 2009 UTC (15 years, 6 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012
Changes since 1.10: +2 -2 lines
Log Message:
Add support for explicitly stored electron charge, backwards compatibility using schema evolution

File Contents

# User Rev Content
1 bendavid 1.1 //--------------------------------------------------------------------------------------------------
2 bendavid 1.11 // $Id: ChargedParticle.h,v 1.10 2009/05/11 08:00:00 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    
24 loizides 1.9 EObjType ObjType() const { return kChargedParticle; }
25     virtual const Track *TrackerTrk() const { return Trk(); }
26 bendavid 1.11 virtual const Track *Trk() const { return 0; }
27 loizides 1.8
28     protected:
29     Double_t GetCharge() const;
30     void GetMom() const;
31 loizides 1.7
32 loizides 1.3 ClassDef(ChargedParticle, 1) // Charged particle class
33 bendavid 1.1 };
34     }
35    
36     //--------------------------------------------------------------------------------------------------
37 loizides 1.8 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 bendavid 1.1 {
51 loizides 1.8 // Get momentum values from track.
52 loizides 1.6
53 loizides 1.8 const mithep::Track *trk = Trk();
54     if (trk)
55     fCachedMom.SetCoordinates(trk->Pt(),trk->Eta(),trk->Phi(),GetMass());
56     else
57 loizides 1.10 fCachedMom.SetCoordinates(0,0,0,GetMass());
58 bendavid 1.1 }
59     #endif