ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/GenericParticle.h
Revision: 1.7
Committed: Fri Jun 26 14:35:14 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, 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, Mit_011a, Mit_011, Mit_010a, Mit_010, HEAD
Branch point for: Mit_025c_branch
Changes since 1.6: +4 -1 lines
Log Message:
Added constructor that takes a track. Note this is very similar to the StableParticle class which would allow also to keep reference to the original track.

File Contents

# User Rev Content
1 ceballos 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.7 // $Id: GenericParticle.h,v 1.6 2009/06/19 07:41:34 loizides Exp $
3 ceballos 1.1 //
4     // GenericParticle
5     //
6 loizides 1.3 // General particle class to be filled and used at analysis time.
7     // It provides an abstract interface to kinematical quantities computed by derived classes.
8 ceballos 1.1 //
9 loizides 1.3 // Authors: G.Ceballos, C.Loizides
10 ceballos 1.1 //--------------------------------------------------------------------------------------------------
11    
12     #ifndef MITANA_DATATREE_GENERICPARTICLE_H
13     #define MITANA_DATATREE_GENERICPARTICLE_H
14    
15     #include <TMath.h>
16     #include "MitAna/DataTree/interface/Particle.h"
17 loizides 1.7 #include "MitAna/DataTree/interface/Track.h"
18 ceballos 1.1
19     namespace mithep
20     {
21     class GenericParticle : public Particle
22     {
23     public:
24 loizides 1.6 GenericParticle(): fQ(0), fObjId(kGenericParticle), fObjType(kGenericParticle) {}
25 loizides 1.5 GenericParticle(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t c,
26 loizides 1.6 Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
27     fMom(FourVector(px,py,pz,e)), fQ(c), fObjId(id), fObjType(type) {}
28 loizides 1.5 GenericParticle(Double_t px, Double_t py, Double_t pz, Double_t e,
29 loizides 1.6 Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
30     fMom(FourVector(px,py,pz,e)), fQ(0), fObjId(id), fObjType(type) {}
31     GenericParticle(const FourVector &m, Double_t c,
32     Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
33     fMom(m), fQ(c), fObjId(id), fObjType(type) {}
34     GenericParticle(const FourVectorM &m, Double_t c,
35     Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
36     fMom(m), fQ(c), fObjId(id), fObjType(type) {}
37     GenericParticle(const Particle &p) :
38     fMom(p.Mom()), fQ(p.Charge()), fObjId(p.ObjId()), fObjType(p.ObjType()) {}
39 loizides 1.7 GenericParticle(const Track &t, Double_t mass=0) :
40     fMom(t.Mom4(mass)), fQ(t.Charge()), fObjId(t.ObjId()), fObjType(t.ObjType()) {}
41 ceballos 1.1
42     void Print(Option_t *opt="") const;
43 loizides 1.6 Int_t ObjId() const { return fObjId; }
44     EObjType ObjType() const { return fObjType; }
45     void SetCharge(Double_t c) { fQ = c; ClearCharge(); }
46 ceballos 1.1 void SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
47 loizides 1.6 void SetObjId(Int_t id) { fObjId = id; }
48     void SetObjType(EObjType t) { fObjType = t; }
49 ceballos 1.1
50     protected:
51 loizides 1.6 Double_t GetCharge() const { return fQ; }
52     Double_t GetMass() const { return fMom.M(); }
53 ceballos 1.1 void GetMom() const;
54    
55     FourVectorM fMom; //momentum vector
56     Double_t fQ; //charge value
57 loizides 1.6 Int_t fObjId; //object id
58 ceballos 1.1 EObjType fObjType; //object type
59    
60 loizides 1.6 ClassDef(GenericParticle, 2) // Generic particle class
61 ceballos 1.1 };
62     }
63    
64     //--------------------------------------------------------------------------------------------------
65     inline void mithep::GenericParticle::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
66     {
67     // Set four vector.
68    
69     fMom.SetXYZT(px, py, pz, e);
70 loizides 1.4 ClearMom();
71 ceballos 1.1 }
72    
73     //--------------------------------------------------------------------------------------------------
74     inline void mithep::GenericParticle::GetMom() const
75     {
76 loizides 1.3 // Get momentum values.
77 ceballos 1.1
78     fCachedMom = fMom;
79     }
80     #endif