ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/GenericParticle.h
Revision: 1.6
Committed: Fri Jun 19 07:41:34 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.5: +23 -16 lines
Log Message:
Introduced ObjId which returns an integer as a specific reco id for ntupeling purposes.

File Contents

# User Rev Content
1 ceballos 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.6 // $Id: GenericParticle.h,v 1.5 2009/05/11 07:59:47 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    
18     namespace mithep
19     {
20     class GenericParticle : public Particle
21     {
22     public:
23 loizides 1.6 GenericParticle(): fQ(0), fObjId(kGenericParticle), fObjType(kGenericParticle) {}
24 loizides 1.5 GenericParticle(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t c,
25 loizides 1.6 Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
26     fMom(FourVector(px,py,pz,e)), fQ(c), fObjId(id), fObjType(type) {}
27 loizides 1.5 GenericParticle(Double_t px, Double_t py, Double_t pz, Double_t e,
28 loizides 1.6 Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
29     fMom(FourVector(px,py,pz,e)), fQ(0), fObjId(id), fObjType(type) {}
30     GenericParticle(const FourVector &m, Double_t c,
31     Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
32     fMom(m), fQ(c), fObjId(id), fObjType(type) {}
33     GenericParticle(const FourVectorM &m, Double_t c,
34     Int_t id=kGenericParticle, EObjType type=kGenericParticle) :
35     fMom(m), fQ(c), fObjId(id), fObjType(type) {}
36     GenericParticle(const Particle &p) :
37     fMom(p.Mom()), fQ(p.Charge()), fObjId(p.ObjId()), fObjType(p.ObjType()) {}
38 ceballos 1.1
39     void Print(Option_t *opt="") const;
40 loizides 1.6 Int_t ObjId() const { return fObjId; }
41     EObjType ObjType() const { return fObjType; }
42     void SetCharge(Double_t c) { fQ = c; ClearCharge(); }
43 ceballos 1.1 void SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
44 loizides 1.6 void SetObjId(Int_t id) { fObjId = id; }
45     void SetObjType(EObjType t) { fObjType = t; }
46 ceballos 1.1
47     protected:
48 loizides 1.6 Double_t GetCharge() const { return fQ; }
49     Double_t GetMass() const { return fMom.M(); }
50 ceballos 1.1 void GetMom() const;
51    
52     FourVectorM fMom; //momentum vector
53     Double_t fQ; //charge value
54 loizides 1.6 Int_t fObjId; //object id
55 ceballos 1.1 EObjType fObjType; //object type
56    
57 loizides 1.6 ClassDef(GenericParticle, 2) // Generic particle class
58 ceballos 1.1 };
59     }
60    
61     //--------------------------------------------------------------------------------------------------
62     inline void mithep::GenericParticle::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
63     {
64     // Set four vector.
65    
66     fMom.SetXYZT(px, py, pz, e);
67 loizides 1.4 ClearMom();
68 ceballos 1.1 }
69    
70     //--------------------------------------------------------------------------------------------------
71     inline void mithep::GenericParticle::GetMom() const
72     {
73 loizides 1.3 // Get momentum values.
74 ceballos 1.1
75     fCachedMom = fMom;
76     }
77     #endif