ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootParticle.h
Revision: 1.2
Committed: Wed Jul 2 16:22:18 2008 UTC (16 years, 10 months ago) by mlethuil
Content type: text/plain
Branch: MAIN
CVS Tags: cmssw_1_6_12
Changes since 1.1: +1 -1 lines
Log Message:
Converted Photons MC Truth

File Contents

# User Rev Content
1 mlethuil 1.1 #ifndef TRootParticle_h
2     #define TRootParticle_h
3    
4     #include <string>
5     #include <iostream>
6    
7     #include "Rtypes.h"
8     #include "TLorentzVector.h"
9     #include "TVector3.h"
10    
11     using namespace std;
12    
13     class TRootParticle : public TLorentzVector
14     {
15 mlethuil 1.2
16 mlethuil 1.1 public:
17    
18     TRootParticle() : TLorentzVector(), vertex_(), type_(0), charge_(0.) {;}
19     TRootParticle(const TRootParticle& particle) : TLorentzVector(particle), vertex_(particle.vertex_), type_(particle.type_), charge_(particle.charge_) {;}
20     TRootParticle(Double_t px, Double_t py, Double_t pz, Double_t e) : TLorentzVector(px,py,pz,e), vertex_(), type_(0), charge_(0.) {;}
21     TRootParticle(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z) : TLorentzVector(px,py,pz,e), vertex_(vtx_x,vtx_y,vtx_z), type_(0), charge_(0.) {;}
22     TRootParticle(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z, Int_t type, Float_t charge) : TLorentzVector(px,py,pz,e), vertex_(vtx_x,vtx_y,vtx_z), type_(type), charge_(charge) {;}
23     TRootParticle(const TLorentzVector &momentum) : TLorentzVector(momentum), vertex_(), type_(0), charge_(0.) {;}
24     TRootParticle(const TLorentzVector &momentum, const TVector3 &vertex, Int_t type, Float_t charge) : TLorentzVector(momentum), vertex_(vertex), type_(type), charge_(charge) {;}
25     ~TRootParticle() {;}
26    
27     Double_t vx() const { return vertex_.x(); }
28     Double_t vy() const { return vertex_.y(); }
29     Double_t vz() const { return vertex_.z(); }
30     Int_t type() const { return type_; }
31     Float_t charge() const { return charge_; }
32    
33     // FIXME setVx, setVy and setVz must modify the TLorentzVector
34     void setVx(Double_t vx) { vertex_.SetX(vx); }
35     void setVy(Double_t vy) { vertex_.SetY(vy); }
36     void setVz(Double_t vz) { vertex_.SetZ(vz); }
37     void setType(Int_t type) { type_ = type; }
38     void setCharge(Int_t charge) { charge_ = charge; }
39    
40     friend std::ostream& operator<< (std::ostream& stream, const TRootParticle& part) {
41     stream << "Type=" << part.type_ << " Charge=" << part.charge_ << " (Et,eta,phi)=("<< part.Et() <<","<< part.Eta() <<","<< part.Phi() << ")"
42     << " vertex(x,y,z)=("<< part.vx() <<","<< part.vy() <<","<< part.vz() << ")";
43     return stream;
44     };
45    
46    
47     protected:
48    
49     TVector3 vertex_;
50     Int_t type_;
51     Float_t charge_;
52    
53     ClassDef (TRootParticle,1);
54     };
55    
56     #endif